[Home] [Help]
PACKAGE BODY: APPS.PAY_SBT_SHD
Source
1 Package Body pay_sbt_shd as
2 /* $Header: pysbtrhi.pkb 120.0 2005/05/29 08:34:39 appldev noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- | Private Global Definitions |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package varchar2(33) := ' pay_sbt_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_BALANCE_TYPES_FK1') 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 ElsIf (p_constraint_name = 'PAY_SHADOW_BALANCE_TYPES_FK2') Then
27 hr_utility.set_message(801, 'HR_6153_ALL_PROCEDURE_FAIL');
28 hr_utility.set_message_token('PROCEDURE', l_proc);
29 hr_utility.set_message_token('STEP','10');
30 hr_utility.raise_error;
31 ElsIf (p_constraint_name = 'PAY_SHADOW_BALANCE_TYPES_PK') Then
32 hr_utility.set_message(801, 'HR_6153_ALL_PROCEDURE_FAIL');
33 hr_utility.set_message_token('PROCEDURE', l_proc);
34 hr_utility.set_message_token('STEP','15');
35 hr_utility.raise_error;
36 Else
37 hr_utility.set_message(801, 'HR_7877_API_INVALID_CONSTRAINT');
38 hr_utility.set_message_token('PROCEDURE', l_proc);
39 hr_utility.set_message_token('CONSTRAINT_NAME', p_constraint_name);
40 hr_utility.raise_error;
41 End If;
42 --
43 hr_utility.set_location(' Leaving:'||l_proc, 10);
44 End constraint_error;
45 --
46 -- ----------------------------------------------------------------------------
47 -- |-----------------------------< api_updating >-----------------------------|
48 -- ----------------------------------------------------------------------------
49 Function api_updating
50 (
51 p_balance_type_id in number,
52 p_object_version_number in number
53 ) Return Boolean Is
54 --
55 --
56 -- Cursor selects the 'current' row from the HR Schema
57 --
58 Cursor C_Sel1 is
59 select
60 balance_type_id,
61 template_id,
62 assignment_remuneration_flag,
63 balance_name,
64 balance_uom,
65 currency_code,
66 comments,
67 reporting_name,
68 attribute_category,
69 attribute1,
70 attribute2,
71 attribute3,
72 attribute4,
73 attribute5,
74 attribute6,
75 attribute7,
76 attribute8,
77 attribute9,
78 attribute10,
79 attribute11,
80 attribute12,
81 attribute13,
82 attribute14,
83 attribute15,
84 attribute16,
85 attribute17,
86 attribute18,
87 attribute19,
88 attribute20,
89 jurisdiction_level,
90 tax_type,
91 exclusion_rule_id,
92 object_version_number,
93 category_name,
94 base_balance_type_id,
95 base_balance_name,
96 input_value_id
97 from pay_shadow_balance_types
98 where balance_type_id = p_balance_type_id;
99 --
100 l_proc varchar2(72) := g_package||'api_updating';
101 l_fct_ret boolean;
102 --
103 Begin
104 hr_utility.set_location('Entering:'||l_proc, 5);
105 --
106 If (
107 p_balance_type_id is null and
108 p_object_version_number is null
109 ) Then
110 --
111 -- One of the primary key arguments is null therefore we must
112 -- set the returning function value to false
113 --
114 l_fct_ret := false;
115 Else
116 If (
117 p_balance_type_id = g_old_rec.balance_type_id and
118 p_object_version_number = g_old_rec.object_version_number
119 ) Then
120 hr_utility.set_location(l_proc, 10);
121 --
122 -- The g_old_rec is current therefore we must
123 -- set the returning function to true
124 --
125 l_fct_ret := true;
126 Else
127 --
128 -- Select the current row into g_old_rec
129 --
130 Open C_Sel1;
131 Fetch C_Sel1 Into g_old_rec;
132 If C_Sel1%notfound Then
133 Close C_Sel1;
134 --
135 -- The primary key is invalid therefore we must error
136 --
137 hr_utility.set_message(801, 'HR_7220_INVALID_PRIMARY_KEY');
138 hr_utility.raise_error;
139 End If;
140 Close C_Sel1;
141 If (p_object_version_number <> g_old_rec.object_version_number) Then
142 hr_utility.set_message(801, 'HR_7155_OBJECT_INVALID');
143 hr_utility.raise_error;
144 End If;
145 hr_utility.set_location(l_proc, 15);
146 l_fct_ret := true;
147 End If;
148 End If;
149 hr_utility.set_location(' Leaving:'||l_proc, 20);
150 Return (l_fct_ret);
151 --
152 End api_updating;
153 --
154 -- ----------------------------------------------------------------------------
155 -- |---------------------------------< lck >----------------------------------|
156 -- ----------------------------------------------------------------------------
157 Procedure lck
158 (
159 p_balance_type_id in number,
160 p_object_version_number in number
161 ) is
162 --
163 -- Cursor selects the 'current' row from the HR Schema
164 --
165 Cursor C_Sel1 is
166 select balance_type_id,
167 template_id,
168 assignment_remuneration_flag,
169 balance_name,
170 balance_uom,
171 currency_code,
172 comments,
173 reporting_name,
174 attribute_category,
175 attribute1,
176 attribute2,
177 attribute3,
178 attribute4,
179 attribute5,
180 attribute6,
181 attribute7,
182 attribute8,
183 attribute9,
184 attribute10,
185 attribute11,
186 attribute12,
187 attribute13,
188 attribute14,
189 attribute15,
190 attribute16,
191 attribute17,
192 attribute18,
193 attribute19,
194 attribute20,
195 jurisdiction_level,
196 tax_type,
197 exclusion_rule_id,
198 object_version_number,
199 category_name,
200 base_balance_type_id,
201 base_balance_name,
202 input_value_id
203 from pay_shadow_balance_types
204 where balance_type_id = p_balance_type_id
205 for update nowait;
206 --
207 l_proc varchar2(72) := g_package||'lck';
208 --
209 Begin
210 hr_utility.set_location('Entering:'||l_proc, 5);
211 --
212 hr_api.mandatory_arg_error
213 (p_api_name => l_proc,
214 p_argument => 'p_object_version_number',
215 p_argument_value => p_object_version_number);
216 hr_api.mandatory_arg_error
217 (p_api_name => l_proc,
218 p_argument => 'p_balance_type_id',
219 p_argument_value => p_balance_type_id);
220 Open C_Sel1;
221 Fetch C_Sel1 Into g_old_rec;
222 If C_Sel1%notfound then
223 Close C_Sel1;
224 --
225 -- The primary key is invalid therefore we must error
226 --
227 hr_utility.set_message(801, 'HR_7220_INVALID_PRIMARY_KEY');
228 hr_utility.raise_error;
229 End If;
230 Close C_Sel1;
231 If (p_object_version_number <> g_old_rec.object_version_number) Then
232 hr_utility.set_message(801, 'HR_7155_OBJECT_INVALID');
233 hr_utility.raise_error;
234 End If;
235 --
236 hr_utility.set_location(' Leaving:'||l_proc, 10);
237 --
238 -- We need to trap the ORA LOCK exception
239 --
240 Exception
241 When HR_Api.Object_Locked then
242 --
243 -- The object is locked therefore we need to supply a meaningful
244 -- error message.
245 --
246 hr_utility.set_message(801, 'HR_7165_OBJECT_LOCKED');
247 hr_utility.set_message_token('TABLE_NAME', 'pay_shadow_balance_types');
248 hr_utility.raise_error;
249 End lck;
250 --
251 -- ----------------------------------------------------------------------------
252 -- |-----------------------------< convert_args >-----------------------------|
253 -- ----------------------------------------------------------------------------
254 Function convert_args
255 (
256 p_balance_type_id in number,
257 p_template_id in number,
258 p_assignment_remuneration_flag in varchar2,
259 p_balance_name in varchar2,
260 p_balance_uom in varchar2,
261 p_currency_code in varchar2,
262 p_comments in varchar2,
263 p_reporting_name in varchar2,
264 p_attribute_category in varchar2,
265 p_attribute1 in varchar2,
266 p_attribute2 in varchar2,
267 p_attribute3 in varchar2,
268 p_attribute4 in varchar2,
269 p_attribute5 in varchar2,
270 p_attribute6 in varchar2,
271 p_attribute7 in varchar2,
272 p_attribute8 in varchar2,
273 p_attribute9 in varchar2,
274 p_attribute10 in varchar2,
275 p_attribute11 in varchar2,
276 p_attribute12 in varchar2,
277 p_attribute13 in varchar2,
278 p_attribute14 in varchar2,
279 p_attribute15 in varchar2,
280 p_attribute16 in varchar2,
281 p_attribute17 in varchar2,
282 p_attribute18 in varchar2,
283 p_attribute19 in varchar2,
284 p_attribute20 in varchar2,
285 p_jurisdiction_level in number,
286 p_tax_type in varchar2,
287 p_exclusion_rule_id in number,
288 p_object_version_number in number,
289 p_category_name in varchar2,
290 p_base_balance_type_id in number,
291 p_base_balance_name in varchar2,
292 p_input_value_id in number
293 )
294 Return g_rec_type is
295 --
296 l_rec g_rec_type;
297 l_proc varchar2(72) := g_package||'convert_args';
298 --
299 Begin
300 --
301 hr_utility.set_location('Entering:'||l_proc, 5);
302 --
303 -- Convert arguments into local l_rec structure.
304 --
305 l_rec.balance_type_id := p_balance_type_id;
306 l_rec.template_id := p_template_id;
307 l_rec.assignment_remuneration_flag := p_assignment_remuneration_flag;
308 l_rec.balance_name := p_balance_name;
309 l_rec.balance_uom := p_balance_uom;
310 l_rec.currency_code := p_currency_code;
311 l_rec.comments := p_comments;
312 l_rec.reporting_name := p_reporting_name;
313 l_rec.attribute_category := p_attribute_category;
314 l_rec.attribute1 := p_attribute1;
315 l_rec.attribute2 := p_attribute2;
316 l_rec.attribute3 := p_attribute3;
317 l_rec.attribute4 := p_attribute4;
318 l_rec.attribute5 := p_attribute5;
319 l_rec.attribute6 := p_attribute6;
320 l_rec.attribute7 := p_attribute7;
321 l_rec.attribute8 := p_attribute8;
322 l_rec.attribute9 := p_attribute9;
323 l_rec.attribute10 := p_attribute10;
324 l_rec.attribute11 := p_attribute11;
325 l_rec.attribute12 := p_attribute12;
326 l_rec.attribute13 := p_attribute13;
327 l_rec.attribute14 := p_attribute14;
328 l_rec.attribute15 := p_attribute15;
329 l_rec.attribute16 := p_attribute16;
330 l_rec.attribute17 := p_attribute17;
331 l_rec.attribute18 := p_attribute18;
332 l_rec.attribute19 := p_attribute19;
333 l_rec.attribute20 := p_attribute20;
334 l_rec.jurisdiction_level := p_jurisdiction_level;
335 l_rec.tax_type := p_tax_type;
336 l_rec.exclusion_rule_id := p_exclusion_rule_id;
337 l_rec.object_version_number := p_object_version_number;
338 l_rec.category_name := p_category_name;
339 l_rec.base_balance_type_id := p_base_balance_type_id;
340 l_rec.base_balance_name := p_base_balance_name;
341 l_rec.input_value_id := p_input_value_id;
342 --
343 -- Return the plsql record structure.
344 --
345 hr_utility.set_location(' Leaving:'||l_proc, 10);
346 Return(l_rec);
347 --
348 End convert_args;
349 --
350 end pay_sbt_shd;