[Home] [Help]
PACKAGE BODY: APPS.BEN_LOP_SHD
Source
4 -- ----------------------------------------------------------------------------
1 Package Body ben_lop_shd as
2 /* $Header: beloprhi.pkb 115.12 2002/12/13 06:19:42 hmani ship $ */
3 --
5 -- | Private Global Definitions |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package varchar2(33) := ' ben_lop_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_OIPL_ENRT_FK2') 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_OIPL_ENRT_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_oipl_enrt_id in number,
62 p_object_version_number in number
66 -- Cursor selects the 'current' row from the HR Schema
63 ) Return Boolean Is
64 --
65 --
67 --
68 Cursor C_Sel1 is
69 select
70 ler_chg_oipl_enrt_id,
71 effective_start_date,
72 effective_end_date,
73 business_group_id,
74 oipl_id,
75 ler_id,
76 auto_enrt_mthd_rl,
77 crnt_enrt_prclds_chg_flag,
78 enrt_cd,
79 enrt_rl,
80 dflt_enrt_rl,
81 dflt_enrt_cd,
82 dflt_flag,
83 stl_elig_cant_chg_flag,
84 auto_enrt_flag,
85 lop_attribute_category,
86 lop_attribute1,
87 lop_attribute2,
88 lop_attribute3,
89 lop_attribute4,
90 lop_attribute5,
91 lop_attribute6,
92 lop_attribute7,
93 lop_attribute8,
94 lop_attribute9,
95 lop_attribute10,
96 lop_attribute11,
97 lop_attribute12,
98 lop_attribute13,
99 lop_attribute14,
100 lop_attribute15,
101 lop_attribute16,
102 lop_attribute17,
103 lop_attribute18,
104 lop_attribute19,
105 lop_attribute20,
106 lop_attribute21,
107 lop_attribute22,
108 lop_attribute23,
109 lop_attribute24,
110 lop_attribute25,
111 lop_attribute26,
112 lop_attribute27,
113 lop_attribute28,
114 lop_attribute29,
115 lop_attribute30,
116 object_version_number
117 from ben_ler_chg_oipl_enrt_f
118 where ler_chg_oipl_enrt_id = p_ler_chg_oipl_enrt_id
119 and p_effective_date
120 between effective_start_date and effective_end_date;
121 --
122 l_proc varchar2(72) := g_package||'api_updating';
123 l_fct_ret boolean;
124 --
125 Begin
126 hr_utility.set_location('Entering:'||l_proc, 5);
127 --
128 If (p_effective_date is null or
129 p_ler_chg_oipl_enrt_id is null or
130 p_object_version_number is null) Then
131 --
132 -- One of the primary key arguments is null therefore we must
133 -- set the returning function value to false
134 --
135 l_fct_ret := false;
136 Else
137 If (p_ler_chg_oipl_enrt_id = g_old_rec.ler_chg_oipl_enrt_id and
138 p_object_version_number = g_old_rec.object_version_number) Then
139 hr_utility.set_location(l_proc, 10);
140 --
141 -- The g_old_rec is current therefore we must
142 -- set the returning function to true
143 --
144 l_fct_ret := true;
145 Else
146 --
147 -- Select the current row
148 --
149 Open C_Sel1;
150 Fetch C_Sel1 Into g_old_rec;
151 If C_Sel1%notfound Then
152 Close C_Sel1;
153 --
154 -- The primary key is invalid therefore we must error
155 --
156 fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
157 fnd_message.raise_error;
158 End If;
159 Close C_Sel1;
160 If (p_object_version_number <> g_old_rec.object_version_number) Then
161 fnd_message.set_name('PAY', 'HR_7155_OBJECT_INVALID');
162 fnd_message.raise_error;
163 End If;
164 hr_utility.set_location(l_proc, 15);
165 l_fct_ret := true;
166 End If;
167 End If;
168 hr_utility.set_location(' Leaving:'||l_proc, 20);
169 Return (l_fct_ret);
170 --
171 End api_updating;
172 --
173 -- ----------------------------------------------------------------------------
174 -- |--------------------------< find_dt_del_modes >---------------------------|
175 -- ----------------------------------------------------------------------------
176 Procedure find_dt_del_modes
177 (p_effective_date in date,
178 p_base_key_value in number,
179 p_zap out nocopy boolean,
180 p_delete out nocopy boolean,
181 p_future_change out nocopy boolean,
182 p_delete_next_change out nocopy boolean) is
183 --
184 l_proc varchar2(72) := g_package||'find_dt_del_modes';
185 --
186 l_parent_key_value1 number;
187 l_parent_key_value2 number;
188 --
189 Cursor C_Sel1 Is
193 where t.ler_chg_oipl_enrt_id = p_base_key_value
190 select t.ler_id,
191 t.oipl_id
192 from ben_ler_chg_oipl_enrt_f t
194 and p_effective_date
195 between t.effective_start_date and t.effective_end_date;
196 --
197 Begin
198 hr_utility.set_location('Entering:'||l_proc, 5);
199 Open C_Sel1;
200 Fetch C_Sel1 Into l_parent_key_value1,
201 l_parent_key_value2;
202 If C_Sel1%notfound then
206 fnd_message.set_token('STEP','10');
203 Close C_Sel1;
204 fnd_message.set_name('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
205 fnd_message.set_token('PROCEDURE', l_proc);
207 fnd_message.raise_error;
208 End If;
209 Close C_Sel1;
210 --
211 -- Call the corresponding datetrack api
212 --
213 dt_api.find_dt_del_modes
214 (p_effective_date => p_effective_date,
215 p_base_table_name => 'ben_ler_chg_oipl_enrt_f',
216 p_base_key_column => 'ler_chg_oipl_enrt_id',
217 p_base_key_value => p_base_key_value,
218 p_parent_table_name1 => 'ben_ler_f',
219 p_parent_key_column1 => 'ler_id',
220 p_parent_key_value1 => l_parent_key_value1,
221 p_parent_table_name2 => 'ben_oipl_f',
222 p_parent_key_column2 => 'oipl_id',
223 p_parent_key_value2 => l_parent_key_value2,
224 p_zap => p_zap,
225 p_delete => p_delete,
226 p_future_change => p_future_change,
227 p_delete_next_change => p_delete_next_change);
228 --
229 hr_utility.set_location(' Leaving:'||l_proc, 10);
230 End find_dt_del_modes;
231 --
232 -- ----------------------------------------------------------------------------
233 -- |--------------------------< find_dt_upd_modes >---------------------------|
234 -- ----------------------------------------------------------------------------
235 Procedure find_dt_upd_modes
236 (p_effective_date in date,
237 p_base_key_value in number,
238 p_correction out nocopy boolean,
239 p_update out nocopy boolean,
240 p_update_override out nocopy boolean,
241 p_update_change_insert out nocopy boolean) is
242 --
243 l_proc varchar2(72) := g_package||'find_dt_upd_modes';
244 --
245 Begin
246 hr_utility.set_location('Entering:'||l_proc, 5);
247 --
248 -- Call the corresponding datetrack api
249 --
250 dt_api.find_dt_upd_modes
251 (p_effective_date => p_effective_date,
252 p_base_table_name => 'ben_ler_chg_oipl_enrt_f',
253 p_base_key_column => 'ler_chg_oipl_enrt_id',
254 p_base_key_value => p_base_key_value,
255 p_correction => p_correction,
256 p_update => p_update,
257 p_update_override => p_update_override,
258 p_update_change_insert => p_update_change_insert);
259 --
260 hr_utility.set_location(' Leaving:'||l_proc, 10);
261 End find_dt_upd_modes;
262 --
263 -- ----------------------------------------------------------------------------
264 -- |------------------------< upd_effective_end_date >------------------------|
265 -- ----------------------------------------------------------------------------
266 Procedure upd_effective_end_date
267 (p_effective_date in date,
268 p_base_key_value in number,
269 p_new_effective_end_date in date,
270 p_validation_start_date in date,
271 p_validation_end_date in date,
272 p_object_version_number out nocopy number) is
273 --
274 l_proc varchar2(72) := g_package||'upd_effective_end_date';
275 l_object_version_number number;
276 --
277 Begin
278 hr_utility.set_location('Entering:'||l_proc, 5);
279 --
280 -- Because we are updating a row we must get the next object
281 -- version number.
282 --
283 l_object_version_number :=
284 dt_api.get_object_version_number
285 (p_base_table_name => 'ben_ler_chg_oipl_enrt_f',
286 p_base_key_column => 'ler_chg_oipl_enrt_id',
287 p_base_key_value => p_base_key_value);
288 --
289 hr_utility.set_location(l_proc, 10);
290 g_api_dml := true; -- Set the api dml status
291 --
292 -- Update the specified datetrack row setting the effective
293 -- end date to the specified new effective end date.
294 --
295 update ben_ler_chg_oipl_enrt_f t
296 set t.effective_end_date = p_new_effective_end_date,
297 t.object_version_number = l_object_version_number
298 where t.ler_chg_oipl_enrt_id = p_base_key_value
299 and p_effective_date
300 between t.effective_start_date and t.effective_end_date;
301 --
302 g_api_dml := false; -- Unset the api dml status
303 p_object_version_number := l_object_version_number;
304 hr_utility.set_location(' Leaving:'||l_proc, 15);
305 --
306 Exception
307 When Others Then
308 g_api_dml := false; -- Unset the api dml status
309 Raise;
310 End upd_effective_end_date;
311 --
312 -- ----------------------------------------------------------------------------
313 -- |---------------------------------< lck >----------------------------------|
314 -- ----------------------------------------------------------------------------
315 Procedure lck
316 (p_effective_date in date,
317 p_datetrack_mode in varchar2,
318 p_ler_chg_oipl_enrt_id in number,
319 p_object_version_number in number,
320 p_validation_start_date out nocopy date,
321 p_validation_end_date out nocopy date) is
322 --
323 l_proc varchar2(72) := g_package||'lck';
324 l_validation_start_date date;
325 l_validation_end_date date;
326 l_object_invalid exception;
327 l_argument varchar2(30);
328 --
329 -- Cursor C_Sel1 selects the current locked row as of session date
330 -- ensuring that the object version numbers match.
331 --
332 Cursor C_Sel1 is
333 select
334 ler_chg_oipl_enrt_id,
335 effective_start_date,
336 effective_end_date,
337 business_group_id,
338 oipl_id,
339 ler_id,
340 auto_enrt_mthd_rl,
341 crnt_enrt_prclds_chg_flag,
342 enrt_cd,
343 enrt_rl,
344 dflt_enrt_rl,
345 dflt_enrt_cd,
346 dflt_flag,
347 stl_elig_cant_chg_flag,
351 lop_attribute2,
348 auto_enrt_flag,
349 lop_attribute_category,
350 lop_attribute1,
352 lop_attribute3,
353 lop_attribute4,
354 lop_attribute5,
355 lop_attribute6,
356 lop_attribute7,
357 lop_attribute8,
358 lop_attribute9,
359 lop_attribute10,
360 lop_attribute11,
361 lop_attribute12,
362 lop_attribute13,
363 lop_attribute14,
364 lop_attribute15,
365 lop_attribute16,
366 lop_attribute17,
367 lop_attribute18,
368 lop_attribute19,
369 lop_attribute20,
370 lop_attribute21,
371 lop_attribute22,
372 lop_attribute23,
373 lop_attribute24,
374 lop_attribute25,
378 lop_attribute29,
375 lop_attribute26,
376 lop_attribute27,
377 lop_attribute28,
379 lop_attribute30,
380 object_version_number
381 from ben_ler_chg_oipl_enrt_f
382 where ler_chg_oipl_enrt_id = p_ler_chg_oipl_enrt_id
383 and p_effective_date
384 between effective_start_date and effective_end_date
385 for update nowait;
386 --
387 --
388 --
389 Begin
390 hr_utility.set_location('Entering:'||l_proc, 5);
391 --
392 -- Ensure that all the mandatory arguments are not null
393 --
394 hr_api.mandatory_arg_error(p_api_name => l_proc,
395 p_argument => 'effective_date',
396 p_argument_value => p_effective_date);
397 --
398 hr_api.mandatory_arg_error(p_api_name => l_proc,
399 p_argument => 'datetrack_mode',
400 p_argument_value => p_datetrack_mode);
401 --
402 hr_api.mandatory_arg_error(p_api_name => l_proc,
403 p_argument => 'ler_chg_oipl_enrt_id',
404 p_argument_value => p_ler_chg_oipl_enrt_id);
405 --
406 hr_api.mandatory_arg_error(p_api_name => l_proc,
407 p_argument => 'object_version_number',
408 p_argument_value => p_object_version_number);
409 --
410 -- Check to ensure the datetrack mode is not INSERT.
411 --
412 If (p_datetrack_mode <> 'INSERT') then
413 --
414 -- We must select and lock the current row.
415 --
416 Open C_Sel1;
417 Fetch C_Sel1 Into g_old_rec;
418 If C_Sel1%notfound then
419 Close C_Sel1;
420 --
421 -- The primary key is invalid therefore we must error
422 --
423 fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
424 fnd_message.raise_error;
425 End If;
426 Close C_Sel1;
427 If (p_object_version_number <> g_old_rec.object_version_number) Then
428 fnd_message.set_name('PAY', 'HR_7155_OBJECT_INVALID');
429 fnd_message.raise_error;
430 End If;
431 hr_utility.set_location(l_proc, 15);
432 --
433 --
434 -- Validate the datetrack mode mode getting the validation start
435 -- and end dates for the specified datetrack operation.
436 --
437 dt_api.validate_dt_mode
438 (p_effective_date => p_effective_date,
439 p_datetrack_mode => p_datetrack_mode,
440 p_base_table_name => 'ben_ler_chg_oipl_enrt_f',
441 p_base_key_column => 'ler_chg_oipl_enrt_id',
442 p_base_key_value => p_ler_chg_oipl_enrt_id,
443 p_parent_table_name1 => 'ben_ler_f',
444 p_parent_key_column1 => 'ler_id',
445 p_parent_key_value1 => g_old_rec.ler_id,
446 p_parent_table_name2 => 'ben_oipl_f',
447 p_parent_key_column2 => 'oipl_id',
448 p_parent_key_value2 => g_old_rec.oipl_id,
449 p_child_table_name1 => 'ben_ler_chg_oipl_enrt_rl_f',
453 p_validation_end_date => l_validation_end_date);
450 p_child_key_column1 => 'ler_chg_oipl_enrt_rl_id',
451 p_enforce_foreign_locking => true,
452 p_validation_start_date => l_validation_start_date,
454 Else
455 --
456 -- We are doing a datetrack 'INSERT' which is illegal within this
457 -- procedure therefore we must error (note: to lck on insert the
458 -- private procedure ins_lck should be called).
459 --
460 fnd_message.set_name('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
461 fnd_message.set_token('PROCEDURE', l_proc);
462 fnd_message.set_token('STEP','20');
463 fnd_message.raise_error;
464 End If;
465 --
466 -- Set the validation start and end date OUT arguments
467 --
468 p_validation_start_date := l_validation_start_date;
469 p_validation_end_date := l_validation_end_date;
470 --
471 hr_utility.set_location(' Leaving:'||l_proc, 30);
472 --
473 -- We need to trap the ORA LOCK exception
474 --
475 Exception
476 When HR_Api.Object_Locked then
477 --
478 -- The object is locked therefore we need to supply a meaningful
479 -- error message.
480 --
481 fnd_message.set_name('PAY', 'HR_7165_OBJECT_LOCKED');
482 fnd_message.set_token('TABLE_NAME', 'ben_ler_chg_oipl_enrt_f');
483 fnd_message.raise_error;
484 When l_object_invalid then
485 --
486 -- The object doesn't exist or is invalid
487 --
488 fnd_message.set_name('PAY', 'HR_7155_OBJECT_INVALID');
489 fnd_message.set_token('TABLE_NAME', 'ben_ler_chg_oipl_enrt_f');
490 fnd_message.raise_error;
491 End lck;
492 --
493 -- ----------------------------------------------------------------------------
494 -- |-----------------------------< convert_args >-----------------------------|
495 -- ----------------------------------------------------------------------------
496 Function convert_args
497 (
498 p_ler_chg_oipl_enrt_id in number,
499 p_effective_start_date in date,
500 p_effective_end_date in date,
501 p_business_group_id in number,
502 p_oipl_id in number,
503 p_ler_id in number,
504 p_auto_enrt_mthd_rl in number,
505 p_crnt_enrt_prclds_chg_flag in varchar2,
506 p_enrt_cd in varchar2,
507 p_enrt_rl in number,
508 p_dflt_enrt_rl in number,
509 p_dflt_enrt_cd in varchar2,
510 p_dflt_flag in varchar2,
511 p_stl_elig_cant_chg_flag in varchar2,
512 p_auto_enrt_flag in varchar2,
513 p_lop_attribute_category in varchar2,
514 p_lop_attribute1 in varchar2,
515 p_lop_attribute2 in varchar2,
516 p_lop_attribute3 in varchar2,
517 p_lop_attribute4 in varchar2,
518 p_lop_attribute5 in varchar2,
519 p_lop_attribute6 in varchar2,
520 p_lop_attribute7 in varchar2,
521 p_lop_attribute8 in varchar2,
522 p_lop_attribute9 in varchar2,
523 p_lop_attribute10 in varchar2,
524 p_lop_attribute11 in varchar2,
525 p_lop_attribute12 in varchar2,
526 p_lop_attribute13 in varchar2,
527 p_lop_attribute14 in varchar2,
528 p_lop_attribute15 in varchar2,
529 p_lop_attribute16 in varchar2,
530 p_lop_attribute17 in varchar2,
531 p_lop_attribute18 in varchar2,
532 p_lop_attribute19 in varchar2,
533 p_lop_attribute20 in varchar2,
534 p_lop_attribute21 in varchar2,
535 p_lop_attribute22 in varchar2,
536 p_lop_attribute23 in varchar2,
537 p_lop_attribute24 in varchar2,
538 p_lop_attribute25 in varchar2,
539 p_lop_attribute26 in varchar2,
540 p_lop_attribute27 in varchar2,
541 p_lop_attribute28 in varchar2,
542 p_lop_attribute29 in varchar2,
543 p_lop_attribute30 in varchar2,
544 p_object_version_number in number
545 )
546 Return g_rec_type is
547 --
548 l_rec g_rec_type;
549 l_proc varchar2(72) := g_package||'convert_args';
550 --
551 Begin
552 --
553 hr_utility.set_location('Entering:'||l_proc, 5);
554 --
555 -- Convert arguments into local l_rec structure.
556 --
557 l_rec.ler_chg_oipl_enrt_id := p_ler_chg_oipl_enrt_id;
558 l_rec.effective_start_date := p_effective_start_date;
559 l_rec.effective_end_date := p_effective_end_date;
560 l_rec.business_group_id := p_business_group_id;
561 l_rec.oipl_id := p_oipl_id;
562 l_rec.ler_id := p_ler_id;
563 l_rec.auto_enrt_mthd_rl := p_auto_enrt_mthd_rl;
564 l_rec.crnt_enrt_prclds_chg_flag := p_crnt_enrt_prclds_chg_flag;
565 l_rec.enrt_cd := p_enrt_cd;
566 l_rec.enrt_rl := p_enrt_rl;
567 l_rec.dflt_enrt_rl := p_dflt_enrt_rl;
568 l_rec.dflt_enrt_cd := p_dflt_enrt_cd;
569 l_rec.dflt_flag := p_dflt_flag;
570 l_rec.stl_elig_cant_chg_flag := p_stl_elig_cant_chg_flag;
571 l_rec.auto_enrt_flag := p_auto_enrt_flag;
572 l_rec.lop_attribute_category := p_lop_attribute_category;
573 l_rec.lop_attribute1 := p_lop_attribute1;
574 l_rec.lop_attribute2 := p_lop_attribute2;
575 l_rec.lop_attribute3 := p_lop_attribute3;
579 l_rec.lop_attribute7 := p_lop_attribute7;
576 l_rec.lop_attribute4 := p_lop_attribute4;
577 l_rec.lop_attribute5 := p_lop_attribute5;
578 l_rec.lop_attribute6 := p_lop_attribute6;
580 l_rec.lop_attribute8 := p_lop_attribute8;
581 l_rec.lop_attribute9 := p_lop_attribute9;
582 l_rec.lop_attribute10 := p_lop_attribute10;
583 l_rec.lop_attribute11 := p_lop_attribute11;
584 l_rec.lop_attribute12 := p_lop_attribute12;
585 l_rec.lop_attribute13 := p_lop_attribute13;
586 l_rec.lop_attribute14 := p_lop_attribute14;
587 l_rec.lop_attribute15 := p_lop_attribute15;
588 l_rec.lop_attribute16 := p_lop_attribute16;
589 l_rec.lop_attribute17 := p_lop_attribute17;
590 l_rec.lop_attribute18 := p_lop_attribute18;
591 l_rec.lop_attribute19 := p_lop_attribute19;
592 l_rec.lop_attribute20 := p_lop_attribute20;
593 l_rec.lop_attribute21 := p_lop_attribute21;
594 l_rec.lop_attribute22 := p_lop_attribute22;
595 l_rec.lop_attribute23 := p_lop_attribute23;
596 l_rec.lop_attribute24 := p_lop_attribute24;
597 l_rec.lop_attribute25 := p_lop_attribute25;
598 l_rec.lop_attribute26 := p_lop_attribute26;
599 l_rec.lop_attribute27 := p_lop_attribute27;
600 l_rec.lop_attribute28 := p_lop_attribute28;
601 l_rec.lop_attribute29 := p_lop_attribute29;
602 l_rec.lop_attribute30 := p_lop_attribute30;
603 l_rec.object_version_number := p_object_version_number;
604 --
605 -- Return the plsql record structure.
606 --
607 hr_utility.set_location(' Leaving:'||l_proc, 10);
608 Return(l_rec);
609 --
610 End convert_args;
611 --
612 end ben_lop_shd;