[Home] [Help]
PACKAGE BODY: APPS.BEN_LOR_SHD
Source
1 Package Body ben_lor_shd as
2 /* $Header: belorrhi.pkb 115.8 2002/12/13 06:19:10 hmani ship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- | Private Global Definitions |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package varchar2(33) := ' ben_lor_shd.'; -- Global package name
9 --
10 -- ----------------------------------------------------------------------------
11 -- |------------------------< return_api_dml_status >-------------------------|
12 -- ----------------------------------------------------------------------------
13 Function return_api_dml_status Return Boolean Is
14 --
15 l_proc varchar2(72) := g_package||'return_api_dml_status';
16 --
17 Begin
18 hr_utility.set_location('Entering:'||l_proc, 5);
19 --
20 Return (nvl(g_api_dml, false));
21 --
22 hr_utility.set_location(' Leaving:'||l_proc, 10);
23 End return_api_dml_status;
24 --
25 -- ----------------------------------------------------------------------------
26 -- |---------------------------< constraint_error >---------------------------|
27 -- ----------------------------------------------------------------------------
28 Procedure constraint_error
29 (p_constraint_name in all_constraints.constraint_name%TYPE) Is
30 --
34 hr_utility.set_location('Entering:'||l_proc, 5);
31 l_proc varchar2(72) := g_package||'constraint_error';
32 --
33 Begin
35 --
36 If (p_constraint_name = 'BEN_LER_CHG_PLIP_ENRT_RL_FK1') Then
37 fnd_message.set_name('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
38 fnd_message.set_token('PROCEDURE', l_proc);
39 fnd_message.set_token('STEP','5');
40 fnd_message.raise_error;
41 ElsIf (p_constraint_name = 'BEN_LER_CHG_PLIP_EN_RL_PK') Then
42 fnd_message.set_name('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
43 fnd_message.set_token('PROCEDURE', l_proc);
44 fnd_message.set_token('STEP','10');
45 fnd_message.raise_error;
46 Else
47 fnd_message.set_name('PAY', 'HR_7877_API_INVALID_CONSTRAINT');
48 fnd_message.set_token('PROCEDURE', l_proc);
49 fnd_message.set_token('CONSTRAINT_NAME', p_constraint_name);
50 fnd_message.raise_error;
51 End If;
52 --
53 hr_utility.set_location(' Leaving:'||l_proc, 10);
54 End constraint_error;
55 --
56 -- ----------------------------------------------------------------------------
57 -- |-----------------------------< api_updating >-----------------------------|
58 -- ----------------------------------------------------------------------------
59 Function api_updating
60 (p_effective_date in date,
61 p_ler_chg_plip_enrt_rl_id in number,
62 p_object_version_number in number
63 ) Return Boolean Is
64 --
65 --
66 -- Cursor selects the 'current' row from the HR Schema
67 --
68 Cursor C_Sel1 is
69 select
70 ler_chg_plip_enrt_rl_id,
71 effective_start_date,
72 effective_end_date,
73 business_group_id,
74 formula_id,
75 ler_chg_plip_enrt_id,
76 ordr_to_aply_num,
77 lor_attribute_category,
78 lor_attribute1,
79 lor_attribute2,
80 lor_attribute3,
81 lor_attribute4,
82 lor_attribute5,
83 lor_attribute6,
84 lor_attribute7,
85 lor_attribute8,
86 lor_attribute9,
87 lor_attribute10,
88 lor_attribute11,
89 lor_attribute12,
90 lor_attribute13,
91 lor_attribute14,
92 lor_attribute15,
93 lor_attribute16,
94 lor_attribute17,
95 lor_attribute18,
96 lor_attribute19,
97 lor_attribute20,
98 lor_attribute21,
99 lor_attribute22,
100 lor_attribute23,
101 lor_attribute24,
102 lor_attribute25,
103 lor_attribute26,
104 lor_attribute27,
105 lor_attribute28,
106 lor_attribute29,
107 lor_attribute30,
108 object_version_number
109 from ben_ler_chg_plip_enrt_rl_f
110 where ler_chg_plip_enrt_rl_id = p_ler_chg_plip_enrt_rl_id
111 and p_effective_date
112 between effective_start_date and effective_end_date;
113 --
114 l_proc varchar2(72) := g_package||'api_updating';
115 l_fct_ret boolean;
116 --
117 Begin
118 hr_utility.set_location('Entering:'||l_proc, 5);
119 --
120 If (p_effective_date is null or
121 p_ler_chg_plip_enrt_rl_id is null or
122 p_object_version_number is null) Then
123 --
124 -- One of the primary key arguments is null therefore we must
125 -- set the returning function value to false
126 --
127 l_fct_ret := false;
128 Else
129 If (p_ler_chg_plip_enrt_rl_id = g_old_rec.ler_chg_plip_enrt_rl_id and
130 p_object_version_number = g_old_rec.object_version_number) Then
131 hr_utility.set_location(l_proc, 10);
132 --
133 -- The g_old_rec is current therefore we must
134 -- set the returning function to true
135 --
136 l_fct_ret := true;
137 Else
138 --
139 -- Select the current row
140 --
141 Open C_Sel1;
142 Fetch C_Sel1 Into g_old_rec;
143 If C_Sel1%notfound Then
144 Close C_Sel1;
145 --
146 -- The primary key is invalid therefore we must error
147 --
148 fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
149 fnd_message.raise_error;
150 End If;
151 Close C_Sel1;
152 If (p_object_version_number <> g_old_rec.object_version_number) Then
153 fnd_message.set_name('PAY', 'HR_7155_OBJECT_INVALID');
154 fnd_message.raise_error;
155 End If;
156 hr_utility.set_location(l_proc, 15);
157 l_fct_ret := true;
158 End If;
159 End If;
160 hr_utility.set_location(' Leaving:'||l_proc, 20);
161 Return (l_fct_ret);
162 --
163 End api_updating;
164 --
165 -- ----------------------------------------------------------------------------
166 -- |--------------------------< find_dt_del_modes >---------------------------|
167 -- ----------------------------------------------------------------------------
168 Procedure find_dt_del_modes
169 (p_effective_date in date,
170 p_base_key_value in number,
171 p_zap out nocopy boolean,
172 p_delete out nocopy boolean,
173 p_future_change out nocopy boolean,
174 p_delete_next_change out nocopy boolean) is
175 --
176 l_proc varchar2(72) := g_package||'find_dt_del_modes';
177 --
178 l_parent_key_value1 number;
179 l_parent_key_value2 number;
180 --
181 Cursor C_Sel1 Is
182 select t.formula_id,
183 t.ler_chg_plip_enrt_id
184 from ben_ler_chg_plip_enrt_rl_f t
185 where t.ler_chg_plip_enrt_rl_id = p_base_key_value
186 and p_effective_date
187 between t.effective_start_date and t.effective_end_date;
188 --
189 Begin
190 hr_utility.set_location('Entering:'||l_proc, 5);
194 If C_Sel1%notfound then
191 Open C_Sel1;
192 Fetch C_Sel1 Into l_parent_key_value1,
193 l_parent_key_value2;
195 Close C_Sel1;
196 fnd_message.set_name('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
197 fnd_message.set_token('PROCEDURE', l_proc);
198 fnd_message.set_token('STEP','10');
199 fnd_message.raise_error;
200 End If;
201 Close C_Sel1;
202 --
203 -- Call the corresponding datetrack api
204 --
205 dt_api.find_dt_del_modes
206 (p_effective_date => p_effective_date,
207 p_base_table_name => 'ben_ler_chg_plip_enrt_rl_f',
208 p_base_key_column => 'ler_chg_plip_enrt_rl_id',
209 p_base_key_value => p_base_key_value,
210 p_parent_table_name1 => 'ff_formulas_f',
211 p_parent_key_column1 => 'formula_id',
212 p_parent_key_value1 => l_parent_key_value1,
213 p_parent_table_name2 => 'ben_ler_chg_plip_enrt_f',
214 p_parent_key_column2 => 'ler_chg_plip_enrt_id',
215 p_parent_key_value2 => l_parent_key_value2,
216 p_zap => p_zap,
217 p_delete => p_delete,
218 p_future_change => p_future_change,
219 p_delete_next_change => p_delete_next_change);
220 --
221 hr_utility.set_location(' Leaving:'||l_proc, 10);
222 End find_dt_del_modes;
223 --
224 -- ----------------------------------------------------------------------------
225 -- |--------------------------< find_dt_upd_modes >---------------------------|
226 -- ----------------------------------------------------------------------------
227 Procedure find_dt_upd_modes
228 (p_effective_date in date,
229 p_base_key_value in number,
230 p_correction out nocopy boolean,
231 p_update out nocopy boolean,
232 p_update_override out nocopy boolean,
233 p_update_change_insert out nocopy boolean) is
234 --
235 l_proc varchar2(72) := g_package||'find_dt_upd_modes';
236 --
237 Begin
238 hr_utility.set_location('Entering:'||l_proc, 5);
239 --
240 -- Call the corresponding datetrack api
241 --
242 dt_api.find_dt_upd_modes
243 (p_effective_date => p_effective_date,
244 p_base_table_name => 'ben_ler_chg_plip_enrt_rl_f',
245 p_base_key_column => 'ler_chg_plip_enrt_rl_id',
246 p_base_key_value => p_base_key_value,
247 p_correction => p_correction,
248 p_update => p_update,
249 p_update_override => p_update_override,
250 p_update_change_insert => p_update_change_insert);
251 --
252 hr_utility.set_location(' Leaving:'||l_proc, 10);
253 End find_dt_upd_modes;
254 --
255 -- ----------------------------------------------------------------------------
256 -- |------------------------< upd_effective_end_date >------------------------|
257 -- ----------------------------------------------------------------------------
258 Procedure upd_effective_end_date
259 (p_effective_date in date,
260 p_base_key_value in number,
261 p_new_effective_end_date in date,
262 p_validation_start_date in date,
263 p_validation_end_date in date,
264 p_object_version_number out nocopy number) is
265 --
266 l_proc varchar2(72) := g_package||'upd_effective_end_date';
267 l_object_version_number number;
268 --
269 Begin
270 hr_utility.set_location('Entering:'||l_proc, 5);
271 --
272 -- Because we are updating a row we must get the next object
273 -- version number.
274 --
275 l_object_version_number :=
276 dt_api.get_object_version_number
277 (p_base_table_name => 'ben_ler_chg_plip_enrt_rl_f',
278 p_base_key_column => 'ler_chg_plip_enrt_rl_id',
279 p_base_key_value => p_base_key_value);
280 --
281 hr_utility.set_location(l_proc, 10);
282 g_api_dml := true; -- Set the api dml status
283 --
284 -- Update the specified datetrack row setting the effective
285 -- end date to the specified new effective end date.
286 --
287 update ben_ler_chg_plip_enrt_rl_f t
288 set t.effective_end_date = p_new_effective_end_date,
289 t.object_version_number = l_object_version_number
290 where t.ler_chg_plip_enrt_rl_id = p_base_key_value
291 and p_effective_date
292 between t.effective_start_date and t.effective_end_date;
293 --
294 g_api_dml := false; -- Unset the api dml status
295 p_object_version_number := l_object_version_number;
296 hr_utility.set_location(' Leaving:'||l_proc, 15);
297 --
298 Exception
299 When Others Then
300 g_api_dml := false; -- Unset the api dml status
301 Raise;
302 End upd_effective_end_date;
303 --
304 -- ----------------------------------------------------------------------------
305 -- |---------------------------------< lck >----------------------------------|
306 -- ----------------------------------------------------------------------------
307 Procedure lck
308 (p_effective_date in date,
309 p_datetrack_mode in varchar2,
310 p_ler_chg_plip_enrt_rl_id in number,
311 p_object_version_number in number,
312 p_validation_start_date out nocopy date,
313 p_validation_end_date out nocopy date) is
314 --
315 l_proc varchar2(72) := g_package||'lck';
316 l_validation_start_date date;
317 l_validation_end_date date;
318 l_object_invalid exception;
319 l_argument varchar2(30);
320 --
321 -- Cursor C_Sel1 selects the current locked row as of session date
322 -- ensuring that the object version numbers match.
323 --
324 Cursor C_Sel1 is
325 select
326 ler_chg_plip_enrt_rl_id,
327 effective_start_date,
328 effective_end_date,
329 business_group_id,
330 formula_id,
331 ler_chg_plip_enrt_id,
332 ordr_to_aply_num,
336 lor_attribute3,
333 lor_attribute_category,
334 lor_attribute1,
335 lor_attribute2,
337 lor_attribute4,
338 lor_attribute5,
339 lor_attribute6,
340 lor_attribute7,
341 lor_attribute8,
342 lor_attribute9,
343 lor_attribute10,
344 lor_attribute11,
345 lor_attribute12,
346 lor_attribute13,
347 lor_attribute14,
348 lor_attribute15,
349 lor_attribute16,
350 lor_attribute17,
351 lor_attribute18,
352 lor_attribute19,
353 lor_attribute20,
354 lor_attribute21,
355 lor_attribute22,
356 lor_attribute23,
357 lor_attribute24,
358 lor_attribute25,
359 lor_attribute26,
360 lor_attribute27,
361 lor_attribute28,
362 lor_attribute29,
363 lor_attribute30,
364 object_version_number
365 from ben_ler_chg_plip_enrt_rl_f
366 where ler_chg_plip_enrt_rl_id = p_ler_chg_plip_enrt_rl_id
367 and p_effective_date
368 between effective_start_date and effective_end_date
369 for update nowait;
370 --
371 --
372 --
373 Begin
374 hr_utility.set_location('Entering:'||l_proc, 5);
375 --
376 -- Ensure that all the mandatory arguments are not null
377 --
378 hr_api.mandatory_arg_error(p_api_name => l_proc,
379 p_argument => 'effective_date',
380 p_argument_value => p_effective_date);
381 --
382 hr_api.mandatory_arg_error(p_api_name => l_proc,
383 p_argument => 'datetrack_mode',
384 p_argument_value => p_datetrack_mode);
385 --
386 hr_api.mandatory_arg_error(p_api_name => l_proc,
387 p_argument => 'ler_chg_plip_enrt_rl_id',
388 p_argument_value => p_ler_chg_plip_enrt_rl_id);
389 --
390 hr_api.mandatory_arg_error(p_api_name => l_proc,
391 p_argument => 'object_version_number',
392 p_argument_value => p_object_version_number);
393 --
394 -- Check to ensure the datetrack mode is not INSERT.
395 --
396 If (p_datetrack_mode <> 'INSERT') then
397 --
398 -- We must select and lock the current row.
399 --
400 Open C_Sel1;
401 Fetch C_Sel1 Into g_old_rec;
402 If C_Sel1%notfound then
403 Close C_Sel1;
404 --
405 -- The primary key is invalid therefore we must error
406 --
407 fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
408 fnd_message.raise_error;
409 End If;
410 Close C_Sel1;
411 If (p_object_version_number <> g_old_rec.object_version_number) Then
412 fnd_message.set_name('PAY', 'HR_7155_OBJECT_INVALID');
413 fnd_message.raise_error;
414 End If;
415 hr_utility.set_location(l_proc, 15);
416 --
417 --
418 -- Validate the datetrack mode mode getting the validation start
419 -- and end dates for the specified datetrack operation.
420 --
421 dt_api.validate_dt_mode
422 (p_effective_date => p_effective_date,
423 p_datetrack_mode => p_datetrack_mode,
424 p_base_table_name => 'ben_ler_chg_plip_enrt_rl_f',
425 p_base_key_column => 'ler_chg_plip_enrt_rl_id',
426 p_base_key_value => p_ler_chg_plip_enrt_rl_id,
427 p_parent_table_name1 => 'ff_formulas_f',
428 p_parent_key_column1 => 'formula_id',
429 p_parent_key_value1 => g_old_rec.formula_id,
430 p_parent_table_name2 => 'ben_ler_chg_plip_enrt_f',
431 p_parent_key_column2 => 'ler_chg_plip_enrt_id',
432 p_parent_key_value2 => g_old_rec.ler_chg_plip_enrt_id,
433 p_enforce_foreign_locking => true,
434 p_validation_start_date => l_validation_start_date,
435 p_validation_end_date => l_validation_end_date);
436 Else
437 --
438 -- We are doing a datetrack 'INSERT' which is illegal within this
439 -- procedure therefore we must error (note: to lck on insert the
440 -- private procedure ins_lck should be called).
441 --
442 fnd_message.set_name('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
443 fnd_message.set_token('PROCEDURE', l_proc);
444 fnd_message.set_token('STEP','20');
445 fnd_message.raise_error;
446 End If;
447 --
448 -- Set the validation start and end date OUT arguments
449 --
450 p_validation_start_date := l_validation_start_date;
451 p_validation_end_date := l_validation_end_date;
452 --
453 hr_utility.set_location(' Leaving:'||l_proc, 30);
454 --
455 -- We need to trap the ORA LOCK exception
456 --
457 Exception
458 When HR_Api.Object_Locked then
459 --
460 -- The object is locked therefore we need to supply a meaningful
461 -- error message.
462 --
463 fnd_message.set_name('PAY', 'HR_7165_OBJECT_LOCKED');
464 fnd_message.set_token('TABLE_NAME', 'ben_ler_chg_plip_enrt_rl_f');
465 fnd_message.raise_error;
466 When l_object_invalid then
467 --
468 -- The object doesn't exist or is invalid
469 --
470 fnd_message.set_name('PAY', 'HR_7155_OBJECT_INVALID');
471 fnd_message.set_token('TABLE_NAME', 'ben_ler_chg_plip_enrt_rl_f');
472 fnd_message.raise_error;
473 End lck;
474 --
475 -- ----------------------------------------------------------------------------
476 -- |-----------------------------< convert_args >-----------------------------|
477 -- ----------------------------------------------------------------------------
478 Function convert_args
479 (
480 p_ler_chg_plip_enrt_rl_id in number,
481 p_effective_start_date in date,
482 p_effective_end_date in date,
483 p_business_group_id in number,
484 p_formula_id in number,
485 p_ler_chg_plip_enrt_id in number,
486 p_ordr_to_aply_num in number,
487 p_lor_attribute_category in varchar2,
488 p_lor_attribute1 in varchar2,
489 p_lor_attribute2 in varchar2,
490 p_lor_attribute3 in varchar2,
491 p_lor_attribute4 in varchar2,
492 p_lor_attribute5 in varchar2,
493 p_lor_attribute6 in varchar2,
494 p_lor_attribute7 in varchar2,
495 p_lor_attribute8 in varchar2,
496 p_lor_attribute9 in varchar2,
497 p_lor_attribute10 in varchar2,
498 p_lor_attribute11 in varchar2,
499 p_lor_attribute12 in varchar2,
500 p_lor_attribute13 in varchar2,
501 p_lor_attribute14 in varchar2,
502 p_lor_attribute15 in varchar2,
503 p_lor_attribute16 in varchar2,
504 p_lor_attribute17 in varchar2,
505 p_lor_attribute18 in varchar2,
506 p_lor_attribute19 in varchar2,
507 p_lor_attribute20 in varchar2,
508 p_lor_attribute21 in varchar2,
509 p_lor_attribute22 in varchar2,
510 p_lor_attribute23 in varchar2,
511 p_lor_attribute24 in varchar2,
512 p_lor_attribute25 in varchar2,
513 p_lor_attribute26 in varchar2,
514 p_lor_attribute27 in varchar2,
515 p_lor_attribute28 in varchar2,
516 p_lor_attribute29 in varchar2,
517 p_lor_attribute30 in varchar2,
518 p_object_version_number in number
519 )
520 Return g_rec_type is
521 --
522 l_rec g_rec_type;
523 l_proc varchar2(72) := g_package||'convert_args';
524 --
525 Begin
526 --
527 hr_utility.set_location('Entering:'||l_proc, 5);
528 --
529 -- Convert arguments into local l_rec structure.
530 --
531 l_rec.ler_chg_plip_enrt_rl_id := p_ler_chg_plip_enrt_rl_id;
532 l_rec.effective_start_date := p_effective_start_date;
533 l_rec.effective_end_date := p_effective_end_date;
534 l_rec.business_group_id := p_business_group_id;
535 l_rec.formula_id := p_formula_id;
536 l_rec.ler_chg_plip_enrt_id := p_ler_chg_plip_enrt_id;
537 l_rec.ordr_to_aply_num := p_ordr_to_aply_num;
538 l_rec.lor_attribute_category := p_lor_attribute_category;
539 l_rec.lor_attribute1 := p_lor_attribute1;
540 l_rec.lor_attribute2 := p_lor_attribute2;
541 l_rec.lor_attribute3 := p_lor_attribute3;
542 l_rec.lor_attribute4 := p_lor_attribute4;
543 l_rec.lor_attribute5 := p_lor_attribute5;
544 l_rec.lor_attribute6 := p_lor_attribute6;
545 l_rec.lor_attribute7 := p_lor_attribute7;
546 l_rec.lor_attribute8 := p_lor_attribute8;
547 l_rec.lor_attribute9 := p_lor_attribute9;
548 l_rec.lor_attribute10 := p_lor_attribute10;
549 l_rec.lor_attribute11 := p_lor_attribute11;
550 l_rec.lor_attribute12 := p_lor_attribute12;
551 l_rec.lor_attribute13 := p_lor_attribute13;
552 l_rec.lor_attribute14 := p_lor_attribute14;
553 l_rec.lor_attribute15 := p_lor_attribute15;
554 l_rec.lor_attribute16 := p_lor_attribute16;
555 l_rec.lor_attribute17 := p_lor_attribute17;
556 l_rec.lor_attribute18 := p_lor_attribute18;
557 l_rec.lor_attribute19 := p_lor_attribute19;
558 l_rec.lor_attribute20 := p_lor_attribute20;
559 l_rec.lor_attribute21 := p_lor_attribute21;
560 l_rec.lor_attribute22 := p_lor_attribute22;
561 l_rec.lor_attribute23 := p_lor_attribute23;
562 l_rec.lor_attribute24 := p_lor_attribute24;
563 l_rec.lor_attribute25 := p_lor_attribute25;
564 l_rec.lor_attribute26 := p_lor_attribute26;
565 l_rec.lor_attribute27 := p_lor_attribute27;
566 l_rec.lor_attribute28 := p_lor_attribute28;
567 l_rec.lor_attribute29 := p_lor_attribute29;
568 l_rec.lor_attribute30 := p_lor_attribute30;
569 l_rec.object_version_number := p_object_version_number;
570 --
571 -- Return the plsql record structure.
572 --
573 hr_utility.set_location(' Leaving:'||l_proc, 10);
574 Return(l_rec);
575 --
576 End convert_args;
577 --
578 end ben_lor_shd;