[Home] [Help]
PACKAGE BODY: APPS.BEN_EPM_BUS
Source
1 Package Body ben_epm_bus as
2 /* $Header: beepmrhi.pkb 120.2 2006/03/31 00:06:33 gsehgal noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- | Private Global Definitions |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package varchar2(33) := ' ben_epm_bus.'; -- Global package name
9 --
10 -- ----------------------------------------------------------------------------
11 -- |------< chk_enrld_anthr_pgm_rt_id >------|
12 -- ----------------------------------------------------------------------------
13 --
14 -- Description
15 -- This procedure is used to check that the primary key for the table
16 -- is created properly. It should be null on insert and
17 -- should not be able to be updated.
18 --
19 -- Pre Conditions
20 -- None.
21 --
22 -- In Parameters
23 -- enrld_anthr_pgm_rt_id PK of record being inserted or updated.
24 -- effective_date Effective Date of session
25 -- object_version_number Object version number of record being
26 -- inserted or updated.
27 --
28 -- Post Success
29 -- Processing continues
30 --
31 -- Post Failure
32 -- Errors handled by the procedure
33 --
34 -- Access Status
35 -- Internal table handler use only.
36 --
37 Procedure chk_enrld_anthr_pgm_rt_id(p_enrld_anthr_pgm_rt_id in number,
38 p_effective_date in date,
39 p_object_version_number in number) is
40 --
41 l_proc varchar2(72) := g_package||'chk_enrld_anthr_pgm_rt_id';
42 l_api_updating boolean;
43 --
44 Begin
45 --
46 hr_utility.set_location('Entering:'||l_proc, 5);
47 --
48 l_api_updating := ben_epm_shd.api_updating
49 (p_effective_date => p_effective_date,
50 p_enrld_anthr_pgm_rt_id => p_enrld_anthr_pgm_rt_id,
51 p_object_version_number => p_object_version_number);
52 --
53 if (l_api_updating
54 and nvl(p_enrld_anthr_pgm_rt_id,hr_api.g_number)
55 <> ben_epm_shd.g_old_rec.enrld_anthr_pgm_rt_id) then
56 --
57 -- raise error as PK has changed
58 --
59 ben_epm_shd.constraint_error('BEN_ENRLD_ANTHR_PGM_RT_PK');
60 --
61 elsif not l_api_updating then
62 --
63 -- check if PK is null
64 --
65 if p_enrld_anthr_pgm_rt_id is not null then
66 --
67 -- raise error as PK is not null
68 --
69 ben_epm_shd.constraint_error('BEN_ENRLD_ANTHR_PGM_RT_PK');
70 --
71 end if;
72 --
73 end if;
74 --
75 hr_utility.set_location('Leaving:'||l_proc, 10);
76 --
77 End chk_enrld_anthr_pgm_rt_id;
78 --
79 -- ----------------------------------------------------------------------------
80 -- |------< chk_pgm_id >------|
81 -- ----------------------------------------------------------------------------
82 --
83 -- Description
84 -- This procedure checks that a referenced foreign key actually exists
85 -- in the referenced table.
86 --
87 -- Pre-Conditions
88 -- None.
89 --
90 -- In Parameters
91 -- p_enrld_anthr_pgm_rt_id PK
92 -- p_pgm_id ID of FK column
93 -- p_effective_date session date
94 -- p_object_version_number object version number
95 --
96 -- Post Success
97 -- Processing continues
98 --
99 -- Post Failure
100 -- Error raised.
101 --
102 -- Access Status
103 -- Internal table handler use only.
104 --
105 Procedure chk_pgm_id (p_enrld_anthr_pgm_rt_id in number,
106 p_pgm_id in number,
107 p_vrbl_rt_prfl_id in number,
108 p_validation_start_date in date,
109 p_validation_end_date in date,
110 p_effective_date in date,
111 p_business_group_id in number,
112 p_object_version_number in number) is
113 --
114 l_proc varchar2(72) := g_package||'chk_pgm_id';
115 l_api_updating boolean;
116 l_dummy varchar2(1);
117 l_exists varchar2(1);
118 --
119 cursor c1 is
120 select null
121 from ben_pgm_f pgm
122 where pgm.pgm_id = p_pgm_id
123 and pgm.business_group_id = p_business_group_id
124 and p_effective_date
125 between pgm.effective_start_date and pgm.effective_end_date;
126 --
127 cursor c3 is
128 select null
129 from ben_enrld_anthr_pgm_rt_f epm
130 where epm.pgm_id = p_pgm_id
131 and epm.vrbl_rt_prfl_id = p_vrbl_rt_prfl_id
132 and epm.enrld_anthr_pgm_rt_id <> nvl(p_enrld_anthr_pgm_rt_id,hr_api.g_number)
133
134 and epm.business_group_id + 0 = p_business_group_id
135 and p_validation_start_date <= epm.effective_end_date
136 and p_validation_end_date >= epm.effective_start_date;
137 --
138 Begin
139 --
140 hr_utility.set_location('Entering:'||l_proc,5);
141 --
142 l_api_updating := ben_epm_shd.api_updating
143 (p_enrld_anthr_pgm_rt_id => p_enrld_anthr_pgm_rt_id,
144 p_effective_date => p_effective_date,
145 p_object_version_number => p_object_version_number);
146 --
147 if (l_api_updating
148 and nvl(p_pgm_id,hr_api.g_number)
149 <> nvl(ben_epm_shd.g_old_rec.pgm_id,hr_api.g_number)
150 or not l_api_updating) then
151 --
152 -- check if pgm_id value exists in the program table
153 open c1;
154 --
155 fetch c1 into l_dummy;
156 if c1%notfound then
157 --
158 close c1;
159 --
160 -- raise error as FK does not relate to PK in the program
161 -- table.
162 --
163 ben_epm_shd.constraint_error('BEN_ENRLD_ANTHR_PGM_RT_DT2');
164 --
165 end if;
166 --
167 close c1;
168 --
169 end if;
170 --
171 open c3;
172 fetch c3 into l_exists;
173 if c3%found then
174 close c3;
175 --
176 -- raise error as this pgm already exists for this profile
177 --
178 fnd_message.set_name('BEN', 'BEN_92992_DUPS_ROW');
179 fnd_message.set_token('VAR1','Enrolled in Another Program criteria');
180 fnd_message.set_token('VAR2','Variable Rate Profile');
181 fnd_message.raise_error;
182 --
183 end if;
184 close c3;
185 --
186 --
187 hr_utility.set_location('Leaving:'||l_proc,10);
188 --
189 End chk_pgm_id;
190 --
191 -- ----------------------------------------------------------------------------
192 -- |------< chk_enrl_det_dt_cd >------|
193 -- ----------------------------------------------------------------------------
194 --
195 -- Description
196 -- This procedure is used to check that the lookup value is valid.
197 --
198 -- Pre Conditions
199 -- None.
200 --
201 -- In Parameters
202 -- enrld_anthr_pgm_rt_id PK of record being inserted or updated.
203 -- enrl_det_dt_cd Value of lookup code.
204 -- effective_date effective date
205 -- object_version_number Object version number of record being
206 -- inserted or updated.
207 --
208 -- Post Success
209 -- Processing continues
210 --
211 -- Post Failure
212 -- Error handled by procedure
213 --
214 -- Access Status
215 -- Internal table handler use only.
216 --
217 Procedure chk_enrl_det_dt_cd(p_enrld_anthr_pgm_rt_id in number,
218 p_enrl_det_dt_cd in varchar2,
219 p_effective_date in date,
220 p_object_version_number in number) is
221 --
222 l_proc varchar2(72) := g_package||'chk_enrl_det_dt_cd';
223 l_api_updating boolean;
224 --
225 Begin
226 --
227 hr_utility.set_location('Entering:'||l_proc, 5);
228 --
229 l_api_updating := ben_epm_shd.api_updating
230 (p_enrld_anthr_pgm_rt_id => p_enrld_anthr_pgm_rt_id,
231 p_effective_date => p_effective_date,
232 p_object_version_number => p_object_version_number);
233 --
234 if (l_api_updating
235 and p_enrl_det_dt_cd
236 <> nvl(ben_epm_shd.g_old_rec.enrl_det_dt_cd,hr_api.g_varchar2)
237 or not l_api_updating)
238 and p_enrl_det_dt_cd is not null then
239 --
240 -- check if value of lookup falls within lookup type.
241 --
242 if hr_api.not_exists_in_hr_lookups
243 (p_lookup_type => 'BEN_ENRL_DET_DT',
244 p_lookup_code => p_enrl_det_dt_cd,
245 p_effective_date => p_effective_date) then
246 --
247 -- raise error as does not exist as lookup
248 --
249 fnd_message.set_name('BEN','BEN_91628_LOOKUP_TYPE_GENERIC');
250 fnd_message.set_token('FIELD','p_enrl_det_dt_cd');
251 fnd_message.set_token('TYPE','BEN_ENRL_DET_DT');
252 fnd_message.raise_error;
253 --
254 end if;
255 --
256 end if;
257 --
258 hr_utility.set_location('Leaving:'||l_proc,10);
259 --
260 end chk_enrl_det_dt_cd;
261 --
262 -- ----------------------------------------------------------------------------
263 -- |------< chk_excld_flag >------|
264 -- ----------------------------------------------------------------------------
265 --
266 -- Description
267 -- This procedure is used to check that the lookup value is valid.
268 --
269 -- Pre Conditions
270 -- None.
271 --
272 -- In Parameters
273 -- enrld_anthr_pgm_rt_id PK of record being inserted or updated.
274 -- excld_flag Value of lookup code.
275 -- effective_date effective date
276 -- object_version_number Object version number of record being
277 -- inserted or updated.
278 --
279 -- Post Success
280 -- Processing continues
281 --
282 -- Post Failure
283 -- Error handled by procedure
284 --
285 -- Access Status
286 -- Internal table handler use only.
287 --
288 Procedure chk_excld_flag(p_enrld_anthr_pgm_rt_id in number,
289 p_excld_flag in varchar2,
290 p_effective_date in date,
291 p_object_version_number in number) is
292 --
293 l_proc varchar2(72) := g_package||'chk_excld_flag';
294 l_api_updating boolean;
295 --
296 Begin
297 --
298 hr_utility.set_location('Entering:'||l_proc, 5);
299 --
300 l_api_updating := ben_epm_shd.api_updating
301 (p_enrld_anthr_pgm_rt_id => p_enrld_anthr_pgm_rt_id,
302 p_effective_date => p_effective_date,
303 p_object_version_number => p_object_version_number);
304 --
305 if (l_api_updating
306 and p_excld_flag
307 <> nvl(ben_epm_shd.g_old_rec.excld_flag,hr_api.g_varchar2)
308 or not l_api_updating) then
309 --
310 -- check if value of lookup falls within lookup type.
311 --
312 --
313 if hr_api.not_exists_in_hr_lookups
314 (p_lookup_type => 'YES_NO',
315 p_lookup_code => p_excld_flag,
316 p_effective_date => p_effective_date) then
317 --
318 -- raise error as does not exist as lookup
319 --
320 fnd_message.set_name('BEN','BEN_91628_LOOKUP_TYPE_GENERIC');
321 fnd_message.set_token('FIELD','p_excld_flag');
322 fnd_message.set_token('TYPE','YES_NO');
323 fnd_message.raise_error;
324 --
325 end if;
326 --
327 end if;
328 --
329 hr_utility.set_location('Leaving:'||l_proc,10);
330 --
331 end chk_excld_flag;
332 --
333 --
334 --
335 -- added for Bug 5078478 .. add this procedure to check the duplicate seq no
336 -- |--------------------< chk_duplicate_ordr_num >----------------------------|
337 -- ----------------------------------------------------------------------------
338 --
339 -- Description
340 --
341 -- Pre Conditions
342 -- None.
343 --
344 -- In Parameters
345 -- p_enrld_anthr_pgm_rt_id
346 -- p_vrbl_rt_prfl_id
347 -- p_ordr_num
348 -- p_effective_date
349 -- p_business_group_id
350 --
351 -- Post Success
352 -- Processing continues
353 --
354 -- Post Failure
355 -- Errors handled by the procedure
356 --
357 -- Access Status
358 -- Internal table handler use only.
359 --
360 -- ----------------------------------------------------------------------------
361
362
363 procedure chk_duplicate_ordr_num
364 (p_vrbl_rt_prfl_id in number
365 ,p_enrld_anthr_pgm_rt_id in number
366 ,p_ordr_num in number
367 ,p_validation_start_date in date
368 ,p_validation_end_date in date
369 ,p_business_group_id in number)
370 is
371 l_proc varchar2(72) := g_package||' chk_duplicate_ordr_num ';
372 l_dummy char(1);
373 cursor c1 is select null
374 from ben_enrld_anthr_pgm_rt_f
375 where vrbl_rt_prfl_id = p_vrbl_rt_prfl_id
376 and enrld_anthr_pgm_rt_id <> nvl(p_enrld_anthr_pgm_rt_id ,-1)
377 --and p_effective_date between effective_start_date
378 -- and effective_end_date
379 and p_validation_start_date <= effective_end_date
380 and p_validation_end_date >= effective_start_date
381 and business_group_id + 0 = p_business_group_id
382 and ordr_num = p_ordr_num;
383 --
384 Begin
385 hr_utility.set_location('Entering:'||l_proc, 5);
386
387 --
388 open c1;
389 fetch c1 into l_dummy;
390 --
391 if c1%found then
392 fnd_message.set_name('BEN','BEN_91001_SEQ_NOT_UNIQUE');
393 fnd_message.raise_error;
394 end if;
395 close c1;
396 --
397 hr_utility.set_location('Leaving:'||l_proc, 15);
398 End chk_duplicate_ordr_num;
399 --
400
401 -- ----------------------------------------------------------------------------
402 -- |--------------------------< dt_update_validate >--------------------------|
403 -- ----------------------------------------------------------------------------
404 -- {Start Of Comments}
405 --
406 -- Description:
407 -- This procedure is used for referential integrity of datetracked
408 -- parent entities when a datetrack update operation is taking place
409 -- and where there is no cascading of update defined for this entity.
410 --
411 -- Prerequisites:
412 -- This procedure is called from the update_validate.
413 --
414 -- In Parameters:
415 --
416 -- Post Success:
417 -- Processing continues.
418 --
419 -- Post Failure:
420 --
421 -- Developer Implementation Notes:
422 -- This procedure should not need maintenance unless the HR Schema model
423 -- changes.
424 --
425 -- Access Status:
426 -- Internal Row Handler Use Only.
427 --
428 -- {End Of Comments}
429 -- ----------------------------------------------------------------------------
430 Procedure dt_update_validate
431 (p_vrbl_rt_prfl_id in number default hr_api.g_number,
432 p_pgm_id in number default hr_api.g_number,
433 p_datetrack_mode in varchar2,
434 p_validation_start_date in date,
435 p_validation_end_date in date) Is
436 --
437 l_proc varchar2(72) := g_package||'dt_update_validate';
438 l_integrity_error Exception;
439 l_table_name all_tables.table_name%TYPE;
440 --
441 Begin
442 hr_utility.set_location('Entering:'||l_proc, 5);
443 --
444 -- Ensure that the p_datetrack_mode argument is not null
445 --
446 hr_api.mandatory_arg_error
447 (p_api_name => l_proc,
448 p_argument => 'datetrack_mode',
449 p_argument_value => p_datetrack_mode);
450 --
451 -- Only perform the validation if the datetrack update mode is valid
452 --
453 If (dt_api.validate_dt_upd_mode(p_datetrack_mode => p_datetrack_mode)) then
454 --
455 --
456 -- Ensure the arguments are not null
457 --
458 hr_api.mandatory_arg_error
459 (p_api_name => l_proc,
460 p_argument => 'validation_start_date',
461 p_argument_value => p_validation_start_date);
462 --
463 hr_api.mandatory_arg_error
464 (p_api_name => l_proc,
465 p_argument => 'validation_end_date',
466 p_argument_value => p_validation_end_date);
467 --
468 If ((nvl(p_vrbl_rt_prfl_id, hr_api.g_number) <> hr_api.g_number) and
469 NOT (dt_api.check_min_max_dates
470 (p_base_table_name => 'ben_vrbl_rt_prfl_f',
471 p_base_key_column => 'vrbl_rt_prfl_id',
472 p_base_key_value => p_vrbl_rt_prfl_id,
473 p_from_date => p_validation_start_date,
474 p_to_date => p_validation_end_date))) Then
475 l_table_name := 'ben_vrbl_rt_prfl_f';
476 Raise l_integrity_error;
477 End If;
478 If ((nvl(p_pgm_id, hr_api.g_number) <> hr_api.g_number) and
479 NOT (dt_api.check_min_max_dates
480 (p_base_table_name => 'ben_pgm_f',
481 p_base_key_column => 'pgm_id',
482 p_base_key_value => p_pgm_id,
483 p_from_date => p_validation_start_date,
484 p_to_date => p_validation_end_date))) Then
485 l_table_name := 'ben_pgm_f';
486 Raise l_integrity_error;
487 End If;
488 --
489 End If;
490 --
491 hr_utility.set_location(' Leaving:'||l_proc, 10);
492 Exception
493 When l_integrity_error Then
494 --
495 -- A referential integrity check was violated therefore
496 -- we must error
497 --
498 ben_utility.parent_integrity_error(p_table_name => l_table_name);
499 When Others Then
500 --
501 -- An unhandled or unexpected error has occurred which
502 -- we must report
503 --
504 fnd_message.set_name('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
505 fnd_message.set_token('PROCEDURE', l_proc);
506 fnd_message.set_token('STEP','15');
507 fnd_message.raise_error;
508 End dt_update_validate;
509 --
510 -- ----------------------------------------------------------------------------
511 -- |--------------------------< dt_delete_validate >--------------------------|
512 -- ----------------------------------------------------------------------------
513 -- {Start Of Comments}
514 --
515 -- Description:
516 -- This procedure is used for referential integrity of datetracked
517 -- child entities when either a datetrack DELETE or ZAP is in operation
518 -- and where there is no cascading of delete defined for this entity.
519 -- For the datetrack mode of DELETE or ZAP we must ensure that no
520 -- datetracked child rows exist between the validation start and end
521 -- dates.
522 --
523 -- Prerequisites:
524 -- This procedure is called from the delete_validate.
525 --
526 -- In Parameters:
527 --
528 -- Post Success:
529 -- Processing continues.
530 --
531 -- Post Failure:
532 -- If a row exists by determining the returning Boolean value from the
533 -- generic dt_api.rows_exist function then we must supply an error via
534 -- the use of the local exception handler l_rows_exist.
535 --
536 -- Developer Implementation Notes:
537 -- This procedure should not need maintenance unless the HR Schema model
538 -- changes.
539 --
540 -- Access Status:
541 -- Internal Row Handler Use Only.
542 --
543 -- {End Of Comments}
544 -- ----------------------------------------------------------------------------
545 Procedure dt_delete_validate
546 (p_enrld_anthr_pgm_rt_id in number,
547 p_datetrack_mode in varchar2,
548 p_validation_start_date in date,
549 p_validation_end_date in date) Is
550 --
551 l_proc varchar2(72) := g_package||'dt_delete_validate';
552 l_rows_exist Exception;
553 l_table_name all_tables.table_name%TYPE;
554 --
555 Begin
556 hr_utility.set_location('Entering:'||l_proc, 5);
557 --
558 -- Ensure that the p_datetrack_mode argument is not null
559 --
560 hr_api.mandatory_arg_error
561 (p_api_name => l_proc,
562 p_argument => 'datetrack_mode',
563 p_argument_value => p_datetrack_mode);
564 --
565 -- Only perform the validation if the datetrack mode is either
566 -- DELETE or ZAP
567 --
568 If (p_datetrack_mode = 'DELETE' or
569 p_datetrack_mode = 'ZAP') then
570 --
571 --
572 -- Ensure the arguments are not null
573 --
574 hr_api.mandatory_arg_error
575 (p_api_name => l_proc,
576 p_argument => 'validation_start_date',
577 p_argument_value => p_validation_start_date);
578 --
579 hr_api.mandatory_arg_error
580 (p_api_name => l_proc,
581 p_argument => 'validation_end_date',
582 p_argument_value => p_validation_end_date);
583 --
584 hr_api.mandatory_arg_error
585 (p_api_name => l_proc,
586 p_argument => 'enrld_anthr_pgm_rt_id',
587 p_argument_value => p_enrld_anthr_pgm_rt_id);
588 --
589 --
590 --
591 End If;
592 --
593 hr_utility.set_location(' Leaving:'||l_proc, 10);
594 Exception
595 When l_rows_exist Then
596 --
597 -- A referential integrity check was violated therefore
598 -- we must error
599 --
600 fnd_message.set_name('PAY', 'HR_7215_DT_CHILD_EXISTS');
601 fnd_message.set_token('TABLE_NAME', l_table_name);
602 fnd_message.raise_error;
603 When Others Then
604 --
605 -- An unhandled or unexpected error has occurred which
606 -- we must report
607 --
608 fnd_message.set_name('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
609 fnd_message.set_token('PROCEDURE', l_proc);
610 fnd_message.set_token('STEP','15');
611 fnd_message.raise_error;
612 End dt_delete_validate;
613 --
614 -- ----------------------------------------------------------------------------
615 -- |---------------------------< insert_validate >----------------------------|
616 -- ----------------------------------------------------------------------------
617 Procedure insert_validate
618 (p_rec in ben_epm_shd.g_rec_type,
619 p_effective_date in date,
620 p_datetrack_mode in varchar2,
621 p_validation_start_date in date,
622 p_validation_end_date in date) is
623 --
624 l_proc varchar2(72) := g_package||'insert_validate';
625 --
626 Begin
627 hr_utility.set_location('Entering:'||l_proc, 5);
628 --
629 -- Call all supporting business operations
630 --
631 --
632 hr_api.validate_bus_grp_id(p_rec.business_group_id); -- Validate Bus Grp
633 --
634 chk_enrld_anthr_pgm_rt_id
635 (p_enrld_anthr_pgm_rt_id => p_rec.enrld_anthr_pgm_rt_id,
636 p_effective_date => p_effective_date,
637 p_object_version_number => p_rec.object_version_number);
638 --
639 chk_pgm_id
640 (p_enrld_anthr_pgm_rt_id => p_rec.enrld_anthr_pgm_rt_id,
641 p_pgm_id => p_rec.pgm_id,
642 p_vrbl_rt_prfl_id => p_rec.vrbl_rt_prfl_id,
643 p_validation_start_date => p_validation_start_date,
644 p_validation_end_date => p_validation_end_date,
645 p_effective_date => p_effective_date,
646 p_business_group_id => p_rec.business_group_id,
647 p_object_version_number => p_rec.object_version_number);
648 --
649 chk_enrl_det_dt_cd
650 (p_enrld_anthr_pgm_rt_id => p_rec.enrld_anthr_pgm_rt_id,
651 p_enrl_det_dt_cd => p_rec.enrl_det_dt_cd,
652 p_effective_date => p_effective_date,
653 p_object_version_number => p_rec.object_version_number);
654 --
655 chk_excld_flag
656 (p_enrld_anthr_pgm_rt_id => p_rec.enrld_anthr_pgm_rt_id,
657 p_excld_flag => p_rec.excld_flag,
658 p_effective_date => p_effective_date,
659 p_object_version_number => p_rec.object_version_number);
660 --
661 -- added for Bug 5078478 .. add this procedure to check the duplicate seq no
662 chk_duplicate_ordr_num
663 (p_vrbl_rt_prfl_id => p_rec.vrbl_rt_prfl_id
664 ,p_enrld_anthr_pgm_rt_id => p_rec.enrld_anthr_pgm_rt_id
665 ,p_ordr_num => p_rec.ordr_num
666 ,p_validation_start_date => p_validation_start_date
667 ,p_validation_end_date => p_validation_end_date
668 ,p_business_group_id => p_rec.business_group_id);
669
670 --
671 hr_utility.set_location(' Leaving:'||l_proc, 10);
672 End insert_validate;
673 --
674 -- ----------------------------------------------------------------------------
675 -- |---------------------------< update_validate >----------------------------|
676 -- ----------------------------------------------------------------------------
677 Procedure update_validate
678 (p_rec in ben_epm_shd.g_rec_type,
679 p_effective_date in date,
680 p_datetrack_mode in varchar2,
681 p_validation_start_date in date,
682 p_validation_end_date in date) is
683 --
684 l_proc varchar2(72) := g_package||'update_validate';
685 --
686 Begin
687 hr_utility.set_location('Entering:'||l_proc, 5);
688 --
689 -- Call all supporting business operations
690 --
691 --
692 hr_api.validate_bus_grp_id(p_rec.business_group_id); -- Validate Bus Grp
693 --
694 chk_enrld_anthr_pgm_rt_id
695 (p_enrld_anthr_pgm_rt_id => p_rec.enrld_anthr_pgm_rt_id,
696 p_effective_date => p_effective_date,
697 p_object_version_number => p_rec.object_version_number);
698 --
699 chk_pgm_id
700 (p_enrld_anthr_pgm_rt_id => p_rec.enrld_anthr_pgm_rt_id,
701 p_pgm_id => p_rec.pgm_id,
702 p_vrbl_rt_prfl_id => p_rec.vrbl_rt_prfl_id,
703 p_validation_start_date => p_validation_start_date,
704 p_validation_end_date => p_validation_end_date,
705 p_effective_date => p_effective_date,
706 p_business_group_id => p_rec.business_group_id,
707 p_object_version_number => p_rec.object_version_number);
708 --
709 chk_enrl_det_dt_cd
710 (p_enrld_anthr_pgm_rt_id => p_rec.enrld_anthr_pgm_rt_id,
711 p_enrl_det_dt_cd => p_rec.enrl_det_dt_cd,
712 p_effective_date => p_effective_date,
713 p_object_version_number => p_rec.object_version_number);
714 --
715 chk_excld_flag
716 (p_enrld_anthr_pgm_rt_id => p_rec.enrld_anthr_pgm_rt_id,
717 p_excld_flag => p_rec.excld_flag,
718 p_effective_date => p_effective_date,
719 p_object_version_number => p_rec.object_version_number);
720 --
721 --
722 -- added for Bug 5078478 .. add this procedure to check the duplicate seq no
723 chk_duplicate_ordr_num
724 (p_vrbl_rt_prfl_id => p_rec.vrbl_rt_prfl_id
725 ,p_enrld_anthr_pgm_rt_id => p_rec.enrld_anthr_pgm_rt_id
726 ,p_ordr_num => p_rec.ordr_num
727 ,p_validation_start_date => p_validation_start_date
728 ,p_validation_end_date => p_validation_end_date
729 ,p_business_group_id => p_rec.business_group_id);
730
731 -- Call the datetrack update integrity operation
732 --
733 dt_update_validate
734 (p_vrbl_rt_prfl_id => p_rec.vrbl_rt_prfl_id,
735 p_pgm_id => p_rec.pgm_id,
736 p_datetrack_mode => p_datetrack_mode,
737 p_validation_start_date => p_validation_start_date,
738 p_validation_end_date => p_validation_end_date);
739 --
740 hr_utility.set_location(' Leaving:'||l_proc, 10);
741 End update_validate;
742 --
743 -- ----------------------------------------------------------------------------
744 -- |---------------------------< delete_validate >----------------------------|
745 -- ----------------------------------------------------------------------------
746 Procedure delete_validate
747 (p_rec in ben_epm_shd.g_rec_type,
748 p_effective_date in date,
749 p_datetrack_mode in varchar2,
750 p_validation_start_date in date,
751 p_validation_end_date in date) is
752 --
753 l_proc varchar2(72) := g_package||'delete_validate';
754 --
755 Begin
756 hr_utility.set_location('Entering:'||l_proc, 5);
757 --
758 -- Call all supporting business operations
759 --
760 dt_delete_validate
761 (p_datetrack_mode => p_datetrack_mode,
762 p_validation_start_date => p_validation_start_date,
763 p_validation_end_date => p_validation_end_date,
764 p_enrld_anthr_pgm_rt_id => p_rec.enrld_anthr_pgm_rt_id);
765 --
766 hr_utility.set_location(' Leaving:'||l_proc, 10);
767 End delete_validate;
768 --
769 --
770 -- ---------------------------------------------------------------------------
771 -- |---------------------< return_legislation_code >-------------------------|
772 -- ---------------------------------------------------------------------------
773 --
774 function return_legislation_code
775 (p_enrld_anthr_pgm_rt_id in number) return varchar2 is
776 --
777 -- Declare cursor
778 --
779 cursor csr_leg_code is
780 select a.legislation_code
781 from per_business_groups a,
782 ben_enrld_anthr_pgm_rt_f b
783 where b.enrld_anthr_pgm_rt_id = p_enrld_anthr_pgm_rt_id
784 and a.business_group_id = b.business_group_id;
785 --
786 -- Declare local variables
787 --
788 l_legislation_code varchar2(150);
789 l_proc varchar2(72) := g_package||'return_legislation_code';
790 --
791 begin
792 --
793 hr_utility.set_location('Entering:'|| l_proc, 10);
794 --
795 -- Ensure that all the mandatory parameter are not null
796 --
797 hr_api.mandatory_arg_error(p_api_name => l_proc,
798 p_argument => 'enrld_anthr_pgm_rt_id',
799 p_argument_value => p_enrld_anthr_pgm_rt_id);
800 --
801 open csr_leg_code;
802 --
803 fetch csr_leg_code into l_legislation_code;
804 --
805 if csr_leg_code%notfound then
806 --
807 close csr_leg_code;
808 --
809 -- The primary key is invalid therefore we must error
810 --
811 fnd_message.set_name('PAY','HR_7220_INVALID_PRIMARY_KEY');
812 fnd_message.raise_error;
813 --
814 end if;
815 --
816 close csr_leg_code;
817 --
818 hr_utility.set_location(' Leaving:'|| l_proc, 20);
819 --
820 return l_legislation_code;
821 --
822 end return_legislation_code;
823 --
824 end ben_epm_bus;