[Home] [Help]
PACKAGE BODY: APPS.BEN_LPE_SHD
Source
1 Package Body ben_lpe_shd as
2 /* $Header: belperhi.pkb 115.13 2002/12/16 07:02:30 rpgupta ship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- | Private Global Definitions |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package varchar2(33) := ' ben_lpe_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 --
31 l_proc varchar2(72) := g_package||'constraint_error';
32 --
33 Begin
34 hr_utility.set_location('Entering:'||l_proc, 5);
35 --
36 If (p_constraint_name = 'BEN_LER_CHG_PL_NIP_ENRT_FK2') Then
37 hr_utility.set_message(801, 'HR_6153_ALL_PROCEDURE_FAIL');
38 hr_utility.set_message_token('PROCEDURE', l_proc);
39 hr_utility.set_message_token('STEP','5');
40 hr_utility.raise_error;
41 ElsIf (p_constraint_name = 'BEN_LER_CHG_PL_NIP_ENRT_PK') Then
42 hr_utility.set_message(801, 'HR_6153_ALL_PROCEDURE_FAIL');
43 hr_utility.set_message_token('PROCEDURE', l_proc);
44 hr_utility.set_message_token('STEP','10');
45 hr_utility.raise_error;
46 Else
47 hr_utility.set_message(801, 'HR_7877_API_INVALID_CONSTRAINT');
48 hr_utility.set_message_token('PROCEDURE', l_proc);
49 hr_utility.set_message_token('CONSTRAINT_NAME', p_constraint_name);
50 hr_utility.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_pl_nip_enrt_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_pl_nip_enrt_id,
71 effective_start_date,
72 effective_end_date,
73 business_group_id,
74 pl_id,
75 ler_id,
76 tco_chg_enrt_cd,
77 crnt_enrt_prclds_chg_flag,
78 dflt_enrt_cd,
79 dflt_enrt_rl,
80 dflt_flag,
81 enrt_rl,
82 enrt_cd,
83 stl_elig_cant_chg_flag,
84 enrt_mthd_cd,
85 auto_enrt_mthd_rl,
86 lpe_attribute_category,
87 lpe_attribute1,
88 lpe_attribute2,
89 lpe_attribute3,
90 lpe_attribute4,
91 lpe_attribute5,
92 lpe_attribute6,
93 lpe_attribute7,
94 lpe_attribute8,
95 lpe_attribute9,
96 lpe_attribute10,
97 lpe_attribute11,
98 lpe_attribute12,
99 lpe_attribute13,
100 lpe_attribute14,
101 lpe_attribute15,
102 lpe_attribute16,
103 lpe_attribute17,
104 lpe_attribute18,
105 lpe_attribute19,
106 lpe_attribute20,
107 lpe_attribute21,
108 lpe_attribute22,
109 lpe_attribute23,
110 lpe_attribute24,
111 lpe_attribute25,
112 lpe_attribute26,
113 lpe_attribute27,
114 lpe_attribute28,
115 lpe_attribute29,
116 lpe_attribute30,
117 object_version_number
118 from ben_ler_chg_pl_nip_enrt_f
119 where ler_chg_pl_nip_enrt_id = p_ler_chg_pl_nip_enrt_id
120 and p_effective_date
121 between effective_start_date and effective_end_date;
122 --
123 l_proc varchar2(72) := g_package||'api_updating';
124 l_fct_ret boolean;
125 --
126 Begin
127 hr_utility.set_location('Entering:'||l_proc, 5);
128 --
129 If (p_effective_date is null or
130 p_ler_chg_pl_nip_enrt_id is null or
131 p_object_version_number is null) Then
132 --
133 -- One of the primary key arguments is null therefore we must
134 -- set the returning function value to false
135 --
136 l_fct_ret := false;
137 Else
138 If (p_ler_chg_pl_nip_enrt_id = g_old_rec.ler_chg_pl_nip_enrt_id and
139 p_object_version_number = g_old_rec.object_version_number) Then
140 hr_utility.set_location(l_proc, 10);
141 --
142 -- The g_old_rec is current therefore we must
143 -- set the returning function to true
144 --
145 l_fct_ret := true;
146 Else
147 --
148 -- Select the current row
149 --
150 Open C_Sel1;
151 Fetch C_Sel1 Into g_old_rec;
152 If C_Sel1%notfound Then
153 Close C_Sel1;
154 --
155 -- The primary key is invalid therefore we must error
156 --
157 hr_utility.set_message(801, 'HR_7220_INVALID_PRIMARY_KEY');
158 hr_utility.raise_error;
159 End If;
160 Close C_Sel1;
161 If (p_object_version_number <> g_old_rec.object_version_number) Then
162 hr_utility.set_message(801, 'HR_7155_OBJECT_INVALID');
163 hr_utility.raise_error;
164 End If;
165 hr_utility.set_location(l_proc, 15);
166 l_fct_ret := true;
167 End If;
168 End If;
169 hr_utility.set_location(' Leaving:'||l_proc, 20);
170 Return (l_fct_ret);
171 --
172 End api_updating;
173 --
174 -- ----------------------------------------------------------------------------
175 -- |--------------------------< find_dt_del_modes >---------------------------|
176 -- ----------------------------------------------------------------------------
177 Procedure find_dt_del_modes
178 (p_effective_date in date,
179 p_base_key_value in number,
180 p_zap out nocopy boolean,
181 p_delete out nocopy boolean,
182 p_future_change out nocopy boolean,
183 p_delete_next_change out nocopy boolean) is
184 --
185 l_proc varchar2(72) := g_package||'find_dt_del_modes';
186 --
187 l_parent_key_value1 number;
188 --
189 Cursor C_Sel1 Is
190 select t.pl_id
191 from ben_ler_chg_pl_nip_enrt_f t
192 where t.ler_chg_pl_nip_enrt_id = p_base_key_value
193 and p_effective_date
194 between t.effective_start_date and t.effective_end_date;
195 --
196 Begin
197 hr_utility.set_location('Entering:'||l_proc, 5);
198 Open C_Sel1;
199 Fetch C_Sel1 Into l_parent_key_value1;
200 If C_Sel1%notfound then
201 Close C_Sel1;
202 hr_utility.set_message(801, 'HR_6153_ALL_PROCEDURE_FAIL');
203 hr_utility.set_message_token('PROCEDURE', l_proc);
204 hr_utility.set_message_token('STEP','10');
205 hr_utility.raise_error;
206 End If;
207 Close C_Sel1;
208 --
209 -- Call the corresponding datetrack api
210 --
211 dt_api.find_dt_del_modes
212 (p_effective_date => p_effective_date,
213 p_base_table_name => 'ben_ler_chg_pl_nip_enrt_f',
214 p_base_key_column => 'ler_chg_pl_nip_enrt_id',
215 p_base_key_value => p_base_key_value,
216 p_parent_table_name1 => 'ben_pl_f',
217 p_parent_key_column1 => 'pl_id',
218 p_parent_key_value1 => l_parent_key_value1,
219 p_zap => p_zap,
220 p_delete => p_delete,
221 p_future_change => p_future_change,
222 p_delete_next_change => p_delete_next_change);
223 --
224 hr_utility.set_location(' Leaving:'||l_proc, 10);
225 End find_dt_del_modes;
226 --
227 -- ----------------------------------------------------------------------------
228 -- |--------------------------< find_dt_upd_modes >---------------------------|
229 -- ----------------------------------------------------------------------------
230 Procedure find_dt_upd_modes
231 (p_effective_date in date,
232 p_base_key_value in number,
233 p_correction out nocopy boolean,
234 p_update out nocopy boolean,
235 p_update_override out nocopy boolean,
236 p_update_change_insert out nocopy boolean) is
237 --
238 l_proc varchar2(72) := g_package||'find_dt_upd_modes';
239 --
240 Begin
241 hr_utility.set_location('Entering:'||l_proc, 5);
242 --
243 -- Call the corresponding datetrack api
244 --
245 dt_api.find_dt_upd_modes
246 (p_effective_date => p_effective_date,
247 p_base_table_name => 'ben_ler_chg_pl_nip_enrt_f',
248 p_base_key_column => 'ler_chg_pl_nip_enrt_id',
249 p_base_key_value => p_base_key_value,
250 p_correction => p_correction,
251 p_update => p_update,
252 p_update_override => p_update_override,
253 p_update_change_insert => p_update_change_insert);
254 --
255 hr_utility.set_location(' Leaving:'||l_proc, 10);
256 End find_dt_upd_modes;
257 --
258 -- ----------------------------------------------------------------------------
259 -- |------------------------< upd_effective_end_date >------------------------|
260 -- ----------------------------------------------------------------------------
261 Procedure upd_effective_end_date
262 (p_effective_date in date,
263 p_base_key_value in number,
264 p_new_effective_end_date in date,
265 p_validation_start_date in date,
266 p_validation_end_date in date,
267 p_object_version_number out nocopy number) is
268 --
269 l_proc varchar2(72) := g_package||'upd_effective_end_date';
270 l_object_version_number number;
271 --
272 Begin
273 hr_utility.set_location('Entering:'||l_proc, 5);
274 --
275 -- Because we are updating a row we must get the next object
276 -- version number.
277 --
278 l_object_version_number :=
279 dt_api.get_object_version_number
280 (p_base_table_name => 'ben_ler_chg_pl_nip_enrt_f',
281 p_base_key_column => 'ler_chg_pl_nip_enrt_id',
282 p_base_key_value => p_base_key_value);
283 --
284 hr_utility.set_location(l_proc, 10);
285 g_api_dml := true; -- Set the api dml status
286 --
287 -- Update the specified datetrack row setting the effective
288 -- end date to the specified new effective end date.
289 --
290 update ben_ler_chg_pl_nip_enrt_f t
291 set t.effective_end_date = p_new_effective_end_date,
292 t.object_version_number = l_object_version_number
293 where t.ler_chg_pl_nip_enrt_id = p_base_key_value
294 and p_effective_date
295 between t.effective_start_date and t.effective_end_date;
296 --
297 g_api_dml := false; -- Unset the api dml status
298 p_object_version_number := l_object_version_number;
299 hr_utility.set_location(' Leaving:'||l_proc, 15);
300 --
301 Exception
302 When Others Then
303 g_api_dml := false; -- Unset the api dml status
304 Raise;
305 End upd_effective_end_date;
306 --
307 -- ----------------------------------------------------------------------------
308 -- |---------------------------------< lck >----------------------------------|
309 -- ----------------------------------------------------------------------------
310 Procedure lck
311 (p_effective_date in date,
312 p_datetrack_mode in varchar2,
313 p_ler_chg_pl_nip_enrt_id in number,
314 p_object_version_number in number,
315 p_validation_start_date out nocopy date,
316 p_validation_end_date out nocopy date) is
317 --
318 l_proc varchar2(72) := g_package||'lck';
319 l_validation_start_date date;
320 l_validation_end_date date;
321 l_object_invalid exception;
322 l_argument varchar2(30);
323 --
324 -- Cursor C_Sel1 selects the current locked row as of session date
325 -- ensuring that the object version numbers match.
326 --
327 Cursor C_Sel1 is
328 select
329 ler_chg_pl_nip_enrt_id,
330 effective_start_date,
331 effective_end_date,
332 business_group_id,
333 pl_id,
334 ler_id,
335 tco_chg_enrt_cd,
336 crnt_enrt_prclds_chg_flag,
337 dflt_enrt_cd,
338 dflt_enrt_rl,
339 dflt_flag,
340 enrt_rl,
341 enrt_cd,
342 stl_elig_cant_chg_flag,
343 enrt_mthd_cd,
344 auto_enrt_mthd_rl,
345 lpe_attribute_category,
346 lpe_attribute1,
347 lpe_attribute2,
348 lpe_attribute3,
349 lpe_attribute4,
350 lpe_attribute5,
351 lpe_attribute6,
352 lpe_attribute7,
353 lpe_attribute8,
354 lpe_attribute9,
355 lpe_attribute10,
356 lpe_attribute11,
357 lpe_attribute12,
358 lpe_attribute13,
359 lpe_attribute14,
360 lpe_attribute15,
361 lpe_attribute16,
362 lpe_attribute17,
363 lpe_attribute18,
364 lpe_attribute19,
365 lpe_attribute20,
366 lpe_attribute21,
367 lpe_attribute22,
368 lpe_attribute23,
369 lpe_attribute24,
370 lpe_attribute25,
371 lpe_attribute26,
372 lpe_attribute27,
373 lpe_attribute28,
374 lpe_attribute29,
375 lpe_attribute30,
376 object_version_number
377 from ben_ler_chg_pl_nip_enrt_f
378 where ler_chg_pl_nip_enrt_id = p_ler_chg_pl_nip_enrt_id
379 and p_effective_date
380 between effective_start_date and effective_end_date
381 for update nowait;
382 --
383 --
384 --
385 Begin
386 hr_utility.set_location('Entering:'||l_proc, 5);
387 --
388 -- Ensure that all the mandatory arguments are not null
389 --
390 hr_api.mandatory_arg_error(p_api_name => l_proc,
391 p_argument => 'effective_date',
392 p_argument_value => p_effective_date);
393 --
394 hr_api.mandatory_arg_error(p_api_name => l_proc,
395 p_argument => 'datetrack_mode',
396 p_argument_value => p_datetrack_mode);
397 --
398 hr_api.mandatory_arg_error(p_api_name => l_proc,
399 p_argument => 'ler_chg_pl_nip_enrt_id',
400 p_argument_value => p_ler_chg_pl_nip_enrt_id);
401 --
402 hr_api.mandatory_arg_error(p_api_name => l_proc,
403 p_argument => 'object_version_number',
404 p_argument_value => p_object_version_number);
405 --
406 -- Check to ensure the datetrack mode is not INSERT.
407 --
408 If (p_datetrack_mode <> 'INSERT') then
409 --
410 -- We must select and lock the current row.
411 --
412 Open C_Sel1;
413 Fetch C_Sel1 Into g_old_rec;
414 If C_Sel1%notfound then
415 Close C_Sel1;
416 --
417 -- The primary key is invalid therefore we must error
418 --
419 hr_utility.set_message(801, 'HR_7220_INVALID_PRIMARY_KEY');
420 hr_utility.raise_error;
421 End If;
422 Close C_Sel1;
423 If (p_object_version_number <> g_old_rec.object_version_number) Then
424 hr_utility.set_message(801, 'HR_7155_OBJECT_INVALID');
425 hr_utility.raise_error;
426 End If;
427 hr_utility.set_location(l_proc, 15);
428 --
429 --
430 -- Validate the datetrack mode mode getting the validation start
431 -- and end dates for the specified datetrack operation.
432 --
433 dt_api.validate_dt_mode
434 (p_effective_date => p_effective_date,
435 p_datetrack_mode => p_datetrack_mode,
436 p_base_table_name => 'ben_ler_chg_pl_nip_enrt_f',
437 p_base_key_column => 'ler_chg_pl_nip_enrt_id',
438 p_base_key_value => p_ler_chg_pl_nip_enrt_id,
442 p_child_table_name1 => 'ben_ler_chg_pl_nip_rl_f',
439 p_parent_table_name1 => 'ben_pl_f',
440 p_parent_key_column1 => 'pl_id',
441 p_parent_key_value1 => g_old_rec.pl_id,
443 p_child_key_column1 => 'ler_chg_pl_nip_rl_id',
444 p_enforce_foreign_locking => true,
445 p_validation_start_date => l_validation_start_date,
446 p_validation_end_date => l_validation_end_date);
447 Else
448 --
449 -- We are doing a datetrack 'INSERT' which is illegal within this
450 -- procedure therefore we must error (note: to lck on insert the
451 -- private procedure ins_lck should be called).
452 --
453 hr_utility.set_message(801, 'HR_6153_ALL_PROCEDURE_FAIL');
454 hr_utility.set_message_token('PROCEDURE', l_proc);
455 hr_utility.set_message_token('STEP','20');
456 hr_utility.raise_error;
457 End If;
458 --
459 -- Set the validation start and end date OUT arguments
460 --
461 p_validation_start_date := l_validation_start_date;
462 p_validation_end_date := l_validation_end_date;
463 --
464 hr_utility.set_location(' Leaving:'||l_proc, 30);
465 --
466 -- We need to trap the ORA LOCK exception
467 --
468 Exception
469 When HR_Api.Object_Locked then
470 --
471 -- The object is locked therefore we need to supply a meaningful
472 -- error message.
473 --
474 hr_utility.set_message(801, 'HR_7165_OBJECT_LOCKED');
475 hr_utility.set_message_token('TABLE_NAME', 'ben_ler_chg_pl_nip_enrt_f');
476 hr_utility.raise_error;
477 When l_object_invalid then
478 --
479 -- The object doesn't exist or is invalid
480 --
481 hr_utility.set_message(801, 'HR_7155_OBJECT_INVALID');
482 hr_utility.set_message_token('TABLE_NAME', 'ben_ler_chg_pl_nip_enrt_f');
483 hr_utility.raise_error;
484 End lck;
485 --
486 -- ----------------------------------------------------------------------------
487 -- |-----------------------------< convert_args >-----------------------------|
488 -- ----------------------------------------------------------------------------
489 Function convert_args
490 (
491 p_ler_chg_pl_nip_enrt_id in number,
492 p_effective_start_date in date,
493 p_effective_end_date in date,
494 p_business_group_id in number,
495 p_pl_id in number,
496 p_ler_id in number,
497 p_tco_chg_enrt_cd in varchar2,
498 p_crnt_enrt_prclds_chg_flag in varchar2,
499 p_dflt_enrt_cd in varchar2,
500 p_dflt_enrt_rl in number,
501 p_dflt_flag in varchar2,
502 p_enrt_rl in number,
503 p_enrt_cd in varchar2,
504 p_stl_elig_cant_chg_flag in varchar2,
505 p_enrt_mthd_cd in varchar2,
506 p_auto_enrt_mthd_rl in number,
507 p_lpe_attribute_category in varchar2,
508 p_lpe_attribute1 in varchar2,
509 p_lpe_attribute2 in varchar2,
510 p_lpe_attribute3 in varchar2,
511 p_lpe_attribute4 in varchar2,
512 p_lpe_attribute5 in varchar2,
513 p_lpe_attribute6 in varchar2,
514 p_lpe_attribute7 in varchar2,
515 p_lpe_attribute8 in varchar2,
516 p_lpe_attribute9 in varchar2,
517 p_lpe_attribute10 in varchar2,
518 p_lpe_attribute11 in varchar2,
519 p_lpe_attribute12 in varchar2,
520 p_lpe_attribute13 in varchar2,
521 p_lpe_attribute14 in varchar2,
522 p_lpe_attribute15 in varchar2,
523 p_lpe_attribute16 in varchar2,
524 p_lpe_attribute17 in varchar2,
525 p_lpe_attribute18 in varchar2,
526 p_lpe_attribute19 in varchar2,
527 p_lpe_attribute20 in varchar2,
528 p_lpe_attribute21 in varchar2,
529 p_lpe_attribute22 in varchar2,
530 p_lpe_attribute23 in varchar2,
531 p_lpe_attribute24 in varchar2,
532 p_lpe_attribute25 in varchar2,
533 p_lpe_attribute26 in varchar2,
534 p_lpe_attribute27 in varchar2,
535 p_lpe_attribute28 in varchar2,
536 p_lpe_attribute29 in varchar2,
537 p_lpe_attribute30 in varchar2,
538 p_object_version_number in number
539 )
540 Return g_rec_type is
541 --
542 l_rec g_rec_type;
543 l_proc varchar2(72) := g_package||'convert_args';
544 --
545 Begin
546 --
547 hr_utility.set_location('Entering:'||l_proc, 5);
548 --
549 -- Convert arguments into local l_rec structure.
550 --
551 l_rec.ler_chg_pl_nip_enrt_id := p_ler_chg_pl_nip_enrt_id;
552 l_rec.effective_start_date := p_effective_start_date;
553 l_rec.effective_end_date := p_effective_end_date;
554 l_rec.business_group_id := p_business_group_id;
555 l_rec.pl_id := p_pl_id;
556 l_rec.ler_id := p_ler_id;
557 l_rec.tco_chg_enrt_cd := p_tco_chg_enrt_cd;
558 l_rec.crnt_enrt_prclds_chg_flag := p_crnt_enrt_prclds_chg_flag;
559 l_rec.dflt_enrt_cd := p_dflt_enrt_cd;
560 l_rec.dflt_enrt_rl := p_dflt_enrt_rl;
561 l_rec.dflt_flag := p_dflt_flag;
562 l_rec.enrt_rl := p_enrt_rl;
563 l_rec.enrt_cd := p_enrt_cd;
564 l_rec.stl_elig_cant_chg_flag := p_stl_elig_cant_chg_flag;
565 l_rec.enrt_mthd_cd := p_enrt_mthd_cd;
566 l_rec.auto_enrt_mthd_rl := p_auto_enrt_mthd_rl;
567 l_rec.lpe_attribute_category := p_lpe_attribute_category;
568 l_rec.lpe_attribute1 := p_lpe_attribute1;
569 l_rec.lpe_attribute2 := p_lpe_attribute2;
570 l_rec.lpe_attribute3 := p_lpe_attribute3;
571 l_rec.lpe_attribute4 := p_lpe_attribute4;
572 l_rec.lpe_attribute5 := p_lpe_attribute5;
573 l_rec.lpe_attribute6 := p_lpe_attribute6;
574 l_rec.lpe_attribute7 := p_lpe_attribute7;
575 l_rec.lpe_attribute8 := p_lpe_attribute8;
576 l_rec.lpe_attribute9 := p_lpe_attribute9;
577 l_rec.lpe_attribute10 := p_lpe_attribute10;
578 l_rec.lpe_attribute11 := p_lpe_attribute11;
579 l_rec.lpe_attribute12 := p_lpe_attribute12;
580 l_rec.lpe_attribute13 := p_lpe_attribute13;
581 l_rec.lpe_attribute14 := p_lpe_attribute14;
582 l_rec.lpe_attribute15 := p_lpe_attribute15;
583 l_rec.lpe_attribute16 := p_lpe_attribute16;
584 l_rec.lpe_attribute17 := p_lpe_attribute17;
585 l_rec.lpe_attribute18 := p_lpe_attribute18;
586 l_rec.lpe_attribute19 := p_lpe_attribute19;
587 l_rec.lpe_attribute20 := p_lpe_attribute20;
588 l_rec.lpe_attribute21 := p_lpe_attribute21;
589 l_rec.lpe_attribute22 := p_lpe_attribute22;
590 l_rec.lpe_attribute23 := p_lpe_attribute23;
591 l_rec.lpe_attribute24 := p_lpe_attribute24;
592 l_rec.lpe_attribute25 := p_lpe_attribute25;
593 l_rec.lpe_attribute26 := p_lpe_attribute26;
594 l_rec.lpe_attribute27 := p_lpe_attribute27;
595 l_rec.lpe_attribute28 := p_lpe_attribute28;
596 l_rec.lpe_attribute29 := p_lpe_attribute29;
597 l_rec.lpe_attribute30 := p_lpe_attribute30;
598 l_rec.object_version_number := p_object_version_number;
599 --
600 -- Return the plsql record structure.
601 --
602 hr_utility.set_location(' Leaving:'||l_proc, 10);
603 Return(l_rec);
604 --
605 End convert_args;
606 --
607 end ben_lpe_shd;