[Home] [Help]
PACKAGE BODY: APPS.PAY_SF_SHD
Source
1 Package Body pay_sf_shd as
2 /* $Header: pysfrhi.pkb 120.0 2005/05/29 02:17:28 appldev noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- | Private Global Definitions |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package varchar2(33) := ' pay_sf_shd.'; -- Global package name
9 --
10 -- ----------------------------------------------------------------------------
11 -- |---------------------------< constraint_error >---------------------------|
12 -- ----------------------------------------------------------------------------
13 Procedure constraint_error
14 (p_constraint_name in all_constraints.constraint_name%TYPE) Is
15 --
16 l_proc varchar2(72) := g_package||'constraint_error';
17 --
18 Begin
19 hr_utility.set_location('Entering:'||l_proc, 5);
20 --
21 If (p_constraint_name = 'PAY_SHADOW_FORMULAS_PK') Then
22 hr_utility.set_message(801, 'HR_6153_ALL_PROCEDURE_FAIL');
23 hr_utility.set_message_token('PROCEDURE', l_proc);
24 hr_utility.set_message_token('STEP','5');
25 hr_utility.raise_error;
26 Else
27 hr_utility.set_message(801, 'HR_7877_API_INVALID_CONSTRAINT');
28 hr_utility.set_message_token('PROCEDURE', l_proc);
29 hr_utility.set_message_token('CONSTRAINT_NAME', p_constraint_name);
30 hr_utility.raise_error;
31 End If;
32 --
33 hr_utility.set_location(' Leaving:'||l_proc, 10);
34 End constraint_error;
35 --
36 -- ----------------------------------------------------------------------------
37 -- |-----------------------------< api_updating >-----------------------------|
38 -- ----------------------------------------------------------------------------
39 Function api_updating
40 (
41 p_formula_id in number,
42 p_object_version_number in number
43 ) Return Boolean Is
44 --
45 --
46 -- Cursor selects the 'current' row from the HR Schema
47 --
48 Cursor C_Sel1 is
49 select
50 formula_id,
51 template_type,
52 legislation_code,
53 business_group_id,
54 formula_name,
55 description,
56 formula_text,
57 formula_type_name,
58 object_version_number
59 from pay_shadow_formulas
60 where formula_id = p_formula_id;
61 --
62 l_proc varchar2(72) := g_package||'api_updating';
63 l_fct_ret boolean;
64 --
65 Begin
66 hr_utility.set_location('Entering:'||l_proc, 5);
67 --
68 If (
69 p_formula_id is null and
70 p_object_version_number is null
71 ) Then
72 --
73 -- One of the primary key arguments is null therefore we must
74 -- set the returning function value to false
75 --
76 l_fct_ret := false;
77 Else
78 If (
79 p_formula_id = g_old_rec.formula_id and
80 p_object_version_number = g_old_rec.object_version_number
81 ) Then
82 hr_utility.set_location(l_proc, 10);
83 --
84 -- The g_old_rec is current therefore we must
85 -- set the returning function to true
86 --
87 l_fct_ret := true;
88 Else
89 --
90 -- Select the current row into g_old_rec
91 --
92 Open C_Sel1;
93 Fetch C_Sel1 Into g_old_rec;
94 If C_Sel1%notfound Then
95 Close C_Sel1;
96 --
97 -- The primary key is invalid therefore we must error
98 --
99 hr_utility.set_message(801, 'HR_7220_INVALID_PRIMARY_KEY');
100 hr_utility.raise_error;
101 End If;
102 Close C_Sel1;
103 If (p_object_version_number <> g_old_rec.object_version_number) Then
104 hr_utility.set_message(801, 'HR_7155_OBJECT_INVALID');
105 hr_utility.raise_error;
106 End If;
107 hr_utility.set_location(l_proc, 15);
108 l_fct_ret := true;
109 End If;
110 End If;
111 hr_utility.set_location(' Leaving:'||l_proc, 20);
112 Return (l_fct_ret);
113 --
114 End api_updating;
115 --
116 -- ----------------------------------------------------------------------------
117 -- |---------------------------------< lck >----------------------------------|
118 -- ----------------------------------------------------------------------------
119 Procedure lck
120 (
121 p_formula_id in number,
122 p_object_version_number in number
123 ) is
124 --
125 -- Cursor selects the 'current' row from the HR Schema
126 --
127 Cursor C_Sel1 is
128 select formula_id,
129 template_type,
130 legislation_code,
131 business_group_id,
132 formula_name,
133 description,
134 formula_text,
135 formula_type_name,
136 object_version_number
137 from pay_shadow_formulas
138 where formula_id = p_formula_id
139 for update nowait;
140 --
141 l_proc varchar2(72) := g_package||'lck';
142 --
143 Begin
144 hr_utility.set_location('Entering:'||l_proc, 5);
145 --
146 -- Add any mandatory argument checking here:
147 -- Example:
148 -- hr_api.mandatory_arg_error
149 -- (p_api_name => l_proc,
150 -- p_argument => 'object_version_number',
151 -- p_argument_value => p_object_version_number);
152 --
153 Open C_Sel1;
154 Fetch C_Sel1 Into g_old_rec;
155 If C_Sel1%notfound then
156 Close C_Sel1;
157 --
158 -- The primary key is invalid therefore we must error
159 --
160 hr_utility.set_message(801, 'HR_7220_INVALID_PRIMARY_KEY');
161 hr_utility.raise_error;
162 End If;
163 Close C_Sel1;
164 If (p_object_version_number <> g_old_rec.object_version_number) Then
165 hr_utility.set_message(801, 'HR_7155_OBJECT_INVALID');
166 hr_utility.raise_error;
167 End If;
168 --
169 hr_utility.set_location(' Leaving:'||l_proc, 10);
170 --
171 -- We need to trap the ORA LOCK exception
172 --
173 Exception
174 When HR_Api.Object_Locked then
175 --
176 -- The object is locked therefore we need to supply a meaningful
177 -- error message.
178 --
179 hr_utility.set_message(801, 'HR_7165_OBJECT_LOCKED');
180 hr_utility.set_message_token('TABLE_NAME', 'pay_shadow_formulas');
181 hr_utility.raise_error;
182 End lck;
183 --
184 -- ----------------------------------------------------------------------------
185 -- |-----------------------------< convert_args >-----------------------------|
186 -- ----------------------------------------------------------------------------
187 Function convert_args
188 (p_formula_id in number,
189 p_template_type in varchar2,
190 p_legislation_code in varchar2,
191 p_business_group_id in number,
192 p_formula_name in varchar2,
193 p_description in varchar2,
194 p_formula_text in varchar2,
195 p_formula_type_name in varchar2,
196 p_object_version_number in number
197 )
198 Return g_rec_type is
199 --
200 l_rec g_rec_type;
201 l_proc varchar2(72) := g_package||'convert_args';
202 --
203 Begin
204 --
205 hr_utility.set_location('Entering:'||l_proc, 5);
206 --
207 -- Convert arguments into local l_rec structure.
208 --
209 l_rec.formula_id := p_formula_id;
210 l_rec.template_type := p_template_type;
211 l_rec.legislation_code := p_legislation_code;
212 l_rec.business_group_id := p_business_group_id;
213 l_rec.formula_name := p_formula_name;
214 l_rec.description := p_description;
215 l_rec.formula_text := p_formula_text;
216 l_rec.formula_type_name := p_formula_type_name;
217 l_rec.object_version_number := p_object_version_number;
218 --
219 -- Return the plsql record structure.
220 --
221 hr_utility.set_location(' Leaving:'||l_proc, 10);
222 Return(l_rec);
223 --
224 End convert_args;
225 --
226 end pay_sf_shd;