[Home] [Help]
PACKAGE BODY: APPS.BEN_LCT_SHD
Source
1 Package Body ben_lct_shd as
2 /* $Header: belctrhi.pkb 115.5 2002/12/31 23:59:34 mmudigon ship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- | Private Global Definitions |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package varchar2(33) := ' ben_lct_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_PTIP_ENRT_PK') 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 Else
42 fnd_message.set_name('PAY', 'HR_7877_API_INVALID_CONSTRAINT');
43 fnd_message.set_token('PROCEDURE', l_proc);
44 fnd_message.set_token('CONSTRAINT_NAME', p_constraint_name);
45 fnd_message.raise_error;
46 End If;
47 --
48 hr_utility.set_location(' Leaving:'||l_proc, 10);
49 End constraint_error;
50 --
51 -- ----------------------------------------------------------------------------
52 -- |-----------------------------< api_updating >-----------------------------|
53 -- ----------------------------------------------------------------------------
54 Function api_updating
55 (p_effective_date in date,
56 p_ler_chg_ptip_enrt_id in number,
57 p_object_version_number in number
58 ) Return Boolean Is
59 --
60 --
61 -- Cursor selects the 'current' row from the HR Schema
62 --
63 Cursor C_Sel1 is
64 select
65 ler_chg_ptip_enrt_id,
66 effective_start_date,
67 effective_end_date,
68 crnt_enrt_prclds_chg_flag,
69 stl_elig_cant_chg_flag,
70 dflt_flag,
71 dflt_enrt_cd,
72 dflt_enrt_rl,
73 enrt_cd,
74 enrt_mthd_cd,
75 enrt_rl,
76 tco_chg_enrt_cd,
77 ptip_id,
78 ler_id,
79 business_group_id,
80 lct_attribute_category,
81 lct_attribute1,
82 lct_attribute2,
83 lct_attribute3,
84 lct_attribute4,
85 lct_attribute5,
86 lct_attribute6,
87 lct_attribute7,
88 lct_attribute8,
89 lct_attribute9,
90 lct_attribute10,
91 lct_attribute11,
92 lct_attribute12,
93 lct_attribute13,
94 lct_attribute14,
95 lct_attribute15,
96 lct_attribute16,
97 lct_attribute17,
98 lct_attribute18,
99 lct_attribute19,
100 lct_attribute20,
101 lct_attribute21,
102 lct_attribute22,
103 lct_attribute23,
104 lct_attribute24,
105 lct_attribute25,
106 lct_attribute26,
107 lct_attribute27,
108 lct_attribute28,
109 lct_attribute29,
110 lct_attribute30,
111 object_version_number
112 from ben_ler_chg_ptip_enrt_f
113 where ler_chg_ptip_enrt_id = p_ler_chg_ptip_enrt_id
114 and p_effective_date
115 between effective_start_date and effective_end_date;
116 --
117 l_proc varchar2(72) := g_package||'api_updating';
118 l_fct_ret boolean;
119 --
120 Begin
121 hr_utility.set_location('Entering:'||l_proc, 5);
122 --
123 If (p_effective_date is null or
124 p_ler_chg_ptip_enrt_id is null or
125 p_object_version_number is null) Then
126 --
127 -- One of the primary key arguments is null therefore we must
128 -- set the returning function value to false
129 --
130 l_fct_ret := false;
131 Else
132 If (p_ler_chg_ptip_enrt_id = g_old_rec.ler_chg_ptip_enrt_id and
133 p_object_version_number = g_old_rec.object_version_number) Then
134 hr_utility.set_location(l_proc, 10);
135 --
136 -- The g_old_rec is current therefore we must
137 -- set the returning function to true
138 --
139 l_fct_ret := true;
140 Else
141 --
142 -- Select the current row
143 --
144 Open C_Sel1;
145 Fetch C_Sel1 Into g_old_rec;
146 If C_Sel1%notfound Then
147 Close C_Sel1;
148 --
149 -- The primary key is invalid therefore we must error
150 --
151 fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
152 fnd_message.raise_error;
153 End If;
154 Close C_Sel1;
155 If (p_object_version_number <> g_old_rec.object_version_number) Then
156 fnd_message.set_name('PAY', 'HR_7155_OBJECT_INVALID');
157 fnd_message.raise_error;
158 End If;
159 hr_utility.set_location(l_proc, 15);
160 l_fct_ret := true;
161 End If;
162 End If;
163 hr_utility.set_location(' Leaving:'||l_proc, 20);
164 Return (l_fct_ret);
165 --
166 End api_updating;
167 --
168 -- ----------------------------------------------------------------------------
169 -- |--------------------------< find_dt_del_modes >---------------------------|
170 -- ----------------------------------------------------------------------------
171 Procedure find_dt_del_modes
172 (p_effective_date in date,
173 p_base_key_value in number,
174 p_zap out nocopy boolean,
175 p_delete out nocopy boolean,
176 p_future_change out nocopy boolean,
177 p_delete_next_change out nocopy boolean) is
178 --
179 l_proc varchar2(72) := g_package||'find_dt_del_modes';
180 --
181 l_parent_key_value1 number;
182 l_parent_key_value2 number;
183 --
184 Cursor C_Sel1 Is
185 select t.ptip_id,
186 t.ler_id
187 from ben_ler_chg_ptip_enrt_f t
188 where t.ler_chg_ptip_enrt_id = p_base_key_value
189 and p_effective_date
190 between t.effective_start_date and t.effective_end_date;
191 --
192 Begin
193 hr_utility.set_location('Entering:'||l_proc, 5);
194 Open C_Sel1;
195 Fetch C_Sel1 Into l_parent_key_value1,
196 l_parent_key_value2;
197 If C_Sel1%notfound then
198 Close C_Sel1;
199 fnd_message.set_name('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
200 fnd_message.set_token('PROCEDURE', l_proc);
201 fnd_message.set_token('STEP','10');
202 fnd_message.raise_error;
203 End If;
204 Close C_Sel1;
205 --
206 -- Call the corresponding datetrack api
207 --
208 dt_api.find_dt_del_modes
209 (p_effective_date => p_effective_date,
210 p_base_table_name => 'ben_ler_chg_ptip_enrt_f',
211 p_base_key_column => 'ler_chg_ptip_enrt_id',
212 p_base_key_value => p_base_key_value,
213 p_parent_table_name1 => 'ben_ptip_f',
214 p_parent_key_column1 => 'ptip_id',
215 p_parent_key_value1 => l_parent_key_value1,
216 p_parent_table_name2 => 'ben_ler_f',
217 p_parent_key_column2 => 'ler_id',
218 p_parent_key_value2 => l_parent_key_value2,
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_ptip_enrt_f',
248 p_base_key_column => 'ler_chg_ptip_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_ptip_enrt_f',
281 p_base_key_column => 'ler_chg_ptip_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_ptip_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_ptip_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_ptip_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_ptip_enrt_id,
330 effective_start_date,
331 effective_end_date,
332 crnt_enrt_prclds_chg_flag,
333 stl_elig_cant_chg_flag,
334 dflt_flag,
335 dflt_enrt_cd,
336 dflt_enrt_rl,
337 enrt_cd,
338 enrt_mthd_cd,
339 enrt_rl,
340 tco_chg_enrt_cd,
341 ptip_id,
342 ler_id,
343 business_group_id,
344 lct_attribute_category,
345 lct_attribute1,
346 lct_attribute2,
347 lct_attribute3,
348 lct_attribute4,
349 lct_attribute5,
350 lct_attribute6,
351 lct_attribute7,
352 lct_attribute8,
353 lct_attribute9,
354 lct_attribute10,
355 lct_attribute11,
356 lct_attribute12,
357 lct_attribute13,
358 lct_attribute14,
359 lct_attribute15,
360 lct_attribute16,
361 lct_attribute17,
362 lct_attribute18,
363 lct_attribute19,
364 lct_attribute20,
365 lct_attribute21,
366 lct_attribute22,
367 lct_attribute23,
368 lct_attribute24,
369 lct_attribute25,
370 lct_attribute26,
371 lct_attribute27,
372 lct_attribute28,
373 lct_attribute29,
374 lct_attribute30,
375 object_version_number
376 from ben_ler_chg_ptip_enrt_f
377 where ler_chg_ptip_enrt_id = p_ler_chg_ptip_enrt_id
378 and p_effective_date
379 between effective_start_date and effective_end_date
380 for update nowait;
381 --
382 --
383 --
384 Begin
385 hr_utility.set_location('Entering:'||l_proc, 5);
386 --
387 -- Ensure that all the mandatory arguments are not null
388 --
389 hr_api.mandatory_arg_error(p_api_name => l_proc,
390 p_argument => 'effective_date',
391 p_argument_value => p_effective_date);
392 --
393 hr_api.mandatory_arg_error(p_api_name => l_proc,
394 p_argument => 'datetrack_mode',
395 p_argument_value => p_datetrack_mode);
396 --
397 hr_api.mandatory_arg_error(p_api_name => l_proc,
398 p_argument => 'ler_chg_ptip_enrt_id',
399 p_argument_value => p_ler_chg_ptip_enrt_id);
400 --
401 hr_api.mandatory_arg_error(p_api_name => l_proc,
402 p_argument => 'object_version_number',
403 p_argument_value => p_object_version_number);
404 --
405 -- Check to ensure the datetrack mode is not INSERT.
406 --
407 If (p_datetrack_mode <> 'INSERT') then
408 --
409 -- We must select and lock the current row.
410 --
411 Open C_Sel1;
412 Fetch C_Sel1 Into g_old_rec;
413 If C_Sel1%notfound then
414 Close C_Sel1;
415 --
416 -- The primary key is invalid therefore we must error
417 --
418 fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
419 fnd_message.raise_error;
420 End If;
421 Close C_Sel1;
422 If (p_object_version_number <> g_old_rec.object_version_number) Then
423 fnd_message.set_name('PAY', 'HR_7155_OBJECT_INVALID');
424 fnd_message.raise_error;
425 End If;
426 hr_utility.set_location(l_proc, 15);
427 --
428 --
429 -- Validate the datetrack mode mode getting the validation start
430 -- and end dates for the specified datetrack operation.
431 --
432 dt_api.validate_dt_mode
433 (p_effective_date => p_effective_date,
434 p_datetrack_mode => p_datetrack_mode,
435 p_base_table_name => 'ben_ler_chg_ptip_enrt_f',
436 p_base_key_column => 'ler_chg_ptip_enrt_id',
440 p_parent_key_value1 => g_old_rec.ptip_id,
437 p_base_key_value => p_ler_chg_ptip_enrt_id,
438 p_parent_table_name1 => 'ben_ptip_f',
439 p_parent_key_column1 => 'ptip_id',
441 p_parent_table_name2 => 'ben_ler_f',
442 p_parent_key_column2 => 'ler_id',
443 p_parent_key_value2 => g_old_rec.ler_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 fnd_message.set_name('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
454 fnd_message.set_token('PROCEDURE', l_proc);
455 fnd_message.set_token('STEP','20');
456 fnd_message.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 fnd_message.set_name('PAY', 'HR_7165_OBJECT_LOCKED');
475 fnd_message.set_token('TABLE_NAME', 'ben_ler_chg_ptip_enrt_f');
476 fnd_message.raise_error;
477 When l_object_invalid then
478 --
479 -- The object doesn't exist or is invalid
480 --
481 fnd_message.set_name('PAY', 'HR_7155_OBJECT_INVALID');
482 fnd_message.set_token('TABLE_NAME', 'ben_ler_chg_ptip_enrt_f');
483 fnd_message.raise_error;
484 End lck;
485 --
486 -- ----------------------------------------------------------------------------
487 -- |-----------------------------< convert_args >-----------------------------|
488 -- ----------------------------------------------------------------------------
489 Function convert_args
490 (
491 p_ler_chg_ptip_enrt_id in number,
492 p_effective_start_date in date,
493 p_effective_end_date in date,
494 p_crnt_enrt_prclds_chg_flag in varchar2,
495 p_stl_elig_cant_chg_flag in varchar2,
496 p_dflt_flag in varchar2,
497 p_dflt_enrt_cd in varchar2,
498 p_dflt_enrt_rl in varchar2,
499 p_enrt_cd in varchar2,
500 p_enrt_mthd_cd in varchar2,
501 p_enrt_rl in varchar2,
502 p_tco_chg_enrt_cd in varchar2,
503 p_ptip_id in number,
504 p_ler_id in number,
505 p_business_group_id in number,
506 p_lct_attribute_category in varchar2,
507 p_lct_attribute1 in varchar2,
508 p_lct_attribute2 in varchar2,
509 p_lct_attribute3 in varchar2,
510 p_lct_attribute4 in varchar2,
511 p_lct_attribute5 in varchar2,
512 p_lct_attribute6 in varchar2,
513 p_lct_attribute7 in varchar2,
514 p_lct_attribute8 in varchar2,
515 p_lct_attribute9 in varchar2,
516 p_lct_attribute10 in varchar2,
517 p_lct_attribute11 in varchar2,
518 p_lct_attribute12 in varchar2,
519 p_lct_attribute13 in varchar2,
520 p_lct_attribute14 in varchar2,
521 p_lct_attribute15 in varchar2,
522 p_lct_attribute16 in varchar2,
523 p_lct_attribute17 in varchar2,
524 p_lct_attribute18 in varchar2,
525 p_lct_attribute19 in varchar2,
526 p_lct_attribute20 in varchar2,
527 p_lct_attribute21 in varchar2,
528 p_lct_attribute22 in varchar2,
529 p_lct_attribute23 in varchar2,
530 p_lct_attribute24 in varchar2,
531 p_lct_attribute25 in varchar2,
532 p_lct_attribute26 in varchar2,
533 p_lct_attribute27 in varchar2,
534 p_lct_attribute28 in varchar2,
535 p_lct_attribute29 in varchar2,
536 p_lct_attribute30 in varchar2,
537 p_object_version_number in number
538 )
539 Return g_rec_type is
540 --
541 l_rec g_rec_type;
542 l_proc varchar2(72) := g_package||'convert_args';
543 --
544 Begin
545 --
546 hr_utility.set_location('Entering:'||l_proc, 5);
547 --
548 -- Convert arguments into local l_rec structure.
549 --
550 l_rec.ler_chg_ptip_enrt_id := p_ler_chg_ptip_enrt_id;
551 l_rec.effective_start_date := p_effective_start_date;
552 l_rec.effective_end_date := p_effective_end_date;
553 l_rec.crnt_enrt_prclds_chg_flag := p_crnt_enrt_prclds_chg_flag;
554 l_rec.stl_elig_cant_chg_flag := p_stl_elig_cant_chg_flag;
555 l_rec.dflt_flag := p_dflt_flag;
556 l_rec.dflt_enrt_cd := p_dflt_enrt_cd;
557 l_rec.dflt_enrt_rl := p_dflt_enrt_rl;
558 l_rec.enrt_cd := p_enrt_cd;
559 l_rec.enrt_mthd_cd := p_enrt_mthd_cd;
560 l_rec.enrt_rl := p_enrt_rl;
561 l_rec.tco_chg_enrt_cd := p_tco_chg_enrt_cd;
562 l_rec.ptip_id := p_ptip_id;
563 l_rec.ler_id := p_ler_id;
564 l_rec.business_group_id := p_business_group_id;
565 l_rec.lct_attribute_category := p_lct_attribute_category;
566 l_rec.lct_attribute1 := p_lct_attribute1;
567 l_rec.lct_attribute2 := p_lct_attribute2;
568 l_rec.lct_attribute3 := p_lct_attribute3;
569 l_rec.lct_attribute4 := p_lct_attribute4;
570 l_rec.lct_attribute5 := p_lct_attribute5;
571 l_rec.lct_attribute6 := p_lct_attribute6;
572 l_rec.lct_attribute7 := p_lct_attribute7;
573 l_rec.lct_attribute8 := p_lct_attribute8;
574 l_rec.lct_attribute9 := p_lct_attribute9;
575 l_rec.lct_attribute10 := p_lct_attribute10;
576 l_rec.lct_attribute11 := p_lct_attribute11;
577 l_rec.lct_attribute12 := p_lct_attribute12;
578 l_rec.lct_attribute13 := p_lct_attribute13;
579 l_rec.lct_attribute14 := p_lct_attribute14;
580 l_rec.lct_attribute15 := p_lct_attribute15;
581 l_rec.lct_attribute16 := p_lct_attribute16;
582 l_rec.lct_attribute17 := p_lct_attribute17;
583 l_rec.lct_attribute18 := p_lct_attribute18;
584 l_rec.lct_attribute19 := p_lct_attribute19;
585 l_rec.lct_attribute20 := p_lct_attribute20;
586 l_rec.lct_attribute21 := p_lct_attribute21;
587 l_rec.lct_attribute22 := p_lct_attribute22;
588 l_rec.lct_attribute23 := p_lct_attribute23;
589 l_rec.lct_attribute24 := p_lct_attribute24;
590 l_rec.lct_attribute25 := p_lct_attribute25;
591 l_rec.lct_attribute26 := p_lct_attribute26;
592 l_rec.lct_attribute27 := p_lct_attribute27;
593 l_rec.lct_attribute28 := p_lct_attribute28;
594 l_rec.lct_attribute29 := p_lct_attribute29;
595 l_rec.lct_attribute30 := p_lct_attribute30;
596 l_rec.object_version_number := p_object_version_number;
597 --
598 -- Return the plsql record structure.
599 --
600 hr_utility.set_location(' Leaving:'||l_proc, 10);
601 Return(l_rec);
602 --
603 End convert_args;
604 --
605 end ben_lct_shd;