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