[Home] [Help]
PACKAGE BODY: APPS.BEN_LPE_BUS
Source
1 Package Body ben_lpe_bus 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_bus.'; -- Global package name
9 --
10 -- ----------------------------------------------------------------------------
11 -- |------< chk_ler_chg_pl_nip_enrt_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 -- ler_chg_pl_nip_enrt_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_ler_chg_pl_nip_enrt_id
38 (p_ler_chg_pl_nip_enrt_id in number,
39 p_effective_date in date,
40 p_object_version_number in number) is
41 --
42 l_proc varchar2(72) := g_package||'chk_ler_chg_pl_nip_enrt_id';
43 l_api_updating boolean;
44 --
45 Begin
46 --
47 hr_utility.set_location('Entering:'||l_proc, 5);
48 --
49 l_api_updating := ben_lpe_shd.api_updating
50 (p_effective_date => p_effective_date,
51 p_ler_chg_pl_nip_enrt_id => p_ler_chg_pl_nip_enrt_id,
52 p_object_version_number => p_object_version_number);
53 --
54 if (l_api_updating
55 and nvl(p_ler_chg_pl_nip_enrt_id,hr_api.g_number)
56 <> ben_lpe_shd.g_old_rec.ler_chg_pl_nip_enrt_id) then
57 --
58 -- raise error as PK has changed
59 --
60 ben_lpe_shd.constraint_error('BEN_LER_CHG_PL_NIP_ENRT_PK');
61 --
62 elsif not l_api_updating then
63 --
64 -- check if PK is null
65 --
66 if p_ler_chg_pl_nip_enrt_id is not null then
67 --
68 -- raise error as PK is not null
69 --
70 ben_lpe_shd.constraint_error('BEN_LER_CHG_PL_NIP_ENRT_PK');
71 --
72 end if;
73 --
74 end if;
75 --
76 hr_utility.set_location('Leaving:'||l_proc, 10);
77 --
78 End chk_ler_chg_pl_nip_enrt_id;
79 --
80 -- ----------------------------------------------------------------------------
81 -- |------< chk_auto_enrt_mthd_rl >------|
82 -- ----------------------------------------------------------------------------
83 --
84 -- Description
85 -- This procedure is used to check that the Formula Rule is valid.
86 --
87 -- Pre Conditions
88 -- None.
89 --
90 -- In Parameters
91 -- ler_chg_pl_nip_enrt_id PK of record being inserted or updated.
92 -- auto_enrt_mthd_rl Value of formula rule id.
93 -- effective_date effective date
94 -- object_version_number Object version number of record being
95 -- inserted or updated.
96 --
97 -- Post Success
98 -- Processing continues
99 --
100 -- Post Failure
101 -- Error handled by procedure
102 --
103 -- Access Status
104 -- Internal table handler use only.
105 --
106 Procedure chk_auto_enrt_mthd_rl(p_ler_chg_pl_nip_enrt_id in number,
107 p_auto_enrt_mthd_rl in number,
108 p_effective_date in date,
109 p_business_group_id in number,
110 p_object_version_number in number) is
111 --
112 l_proc varchar2(72) := g_package||'chk_auto_enrt_mthd_rl';
113 l_api_updating boolean;
114 l_dummy varchar2(1);
115 --
116 cursor c1 is
117 select null
118 from ff_formulas_f ff,
119 per_business_groups pbg
120 where ff.formula_id = p_auto_enrt_mthd_rl
121 and ff.formula_type_id = - 146
122 and pbg.business_group_id = p_business_group_id
123 and nvl(ff.business_group_id, p_business_group_id) =
124 p_business_group_id
125 and nvl(ff.legislation_code, pbg.legislation_code) =
126 pbg.legislation_code
127 and p_effective_date
128 between ff.effective_start_date
129 and ff.effective_end_date;
130 --
131 Begin
132 --
133 hr_utility.set_location('Entering:'||l_proc, 5);
134 --
135 l_api_updating := ben_lpe_shd.api_updating
136 (p_ler_chg_pl_nip_enrt_id => p_ler_chg_pl_nip_enrt_id,
137 p_effective_date => p_effective_date,
138 p_object_version_number => p_object_version_number);
139 --
140 if (l_api_updating
141 and nvl(p_auto_enrt_mthd_rl,hr_api.g_number)
142 <> ben_lpe_shd.g_old_rec.auto_enrt_mthd_rl
143 or not l_api_updating)
144 and p_auto_enrt_mthd_rl is not null then
145 --
146 -- check if value of formula rule is valid.
147 --
148 open c1;
149 --
150 -- fetch value from cursor if it returns a record then the
151 -- formula is valid otherwise its invalid
152 --
153 fetch c1 into l_dummy;
154 if c1%notfound then
155 --
156 close c1;
157 --
158 -- raise error
159 --
160 fnd_message.set_name('BEN','BEN_91471_FORMULA_NOT_FOUND');
161 fnd_message.set_token('ID',p_auto_enrt_mthd_rl);
162 fnd_message.set_token('TYPE_ID',-146);
163 fnd_message.raise_error;
164 --
165 end if;
166 --
167 close c1;
168 --
169 end if;
170 --
171 hr_utility.set_location('Leaving:'||l_proc,10);
172 --
173 end chk_auto_enrt_mthd_rl;
174 --
175 -- ----------------------------------------------------------------------------
176 -- |------< chk_enrt_mthd_cd >------|
177 -- ----------------------------------------------------------------------------
178 --
179 -- Description
180 -- This procedure is used to check that the lookup value is valid.
181 --
182 -- Pre Conditions
183 -- None.
184 --
185 -- In Parameters
186 -- ler_chg_pl_nip_enrt_id PK of record being inserted or updated.
187 -- enrt_mthd_cd Value of lookup code.
188 -- effective_date effective date
189 -- object_version_number Object version number of record being
190 -- inserted or updated.
191 --
192 -- Post Success
193 -- Processing continues
194 --
195 -- Post Failure
196 -- Error handled by procedure
197 --
198 -- Access Status
199 -- Internal table handler use only.
200 --
201 Procedure chk_enrt_mthd_cd(p_ler_chg_pl_nip_enrt_id in number,
202 p_enrt_mthd_cd in varchar2,
203 p_effective_date in date,
204 p_object_version_number in number) is
205 --
206 l_proc varchar2(72) := g_package||'chk_enrt_mthd_cd';
207 l_api_updating boolean;
208 --
209 Begin
210 --
211 hr_utility.set_location('Entering:'||l_proc, 5);
212 --
213 l_api_updating := ben_lpe_shd.api_updating
214 (p_ler_chg_pl_nip_enrt_id => p_ler_chg_pl_nip_enrt_id,
215 p_effective_date => p_effective_date,
216 p_object_version_number => p_object_version_number);
217 --
218 if (l_api_updating
219 and p_enrt_mthd_cd
220 <> nvl(ben_lpe_shd.g_old_rec.enrt_mthd_cd,hr_api.g_varchar2)
221 or not l_api_updating)
222 and p_enrt_mthd_cd is not null then
223 --
224 -- check if value of lookup falls within lookup type.
225 --
226 if hr_api.not_exists_in_hr_lookups
227 (p_lookup_type => 'BEN_ENRT_MTHD',
228 p_lookup_code => p_enrt_mthd_cd,
229 p_effective_date => p_effective_date) then
230 --
231 -- raise error as does not exist as lookup
232 --
233 fnd_message.set_name('BEN','BEN_91628_LOOKUP_TYPE_GENERIC');
234 fnd_message.set_token('FIELD','p_enrt_mthd_cd');
235 fnd_message.set_token('TYPE','BEN_ENRT_MTHD');
236 fnd_message.raise_error;
237 --
238 end if;
239 --
240 end if;
241 --
242 hr_utility.set_location('Leaving:'||l_proc,10);
243 --
244 end chk_enrt_mthd_cd;
245 --
246 -- ----------------------------------------------------------------------------
247 -- |------< chk_stl_elig_cant_chg_flag >------|
248 -- ----------------------------------------------------------------------------
249 --
250 -- Description
251 -- This procedure is used to check that the lookup value is valid.
252 --
253 -- Pre Conditions
254 -- None.
255 --
256 -- In Parameters
257 -- ler_chg_pl_nip_enrt_id PK of record being inserted or updated.
258 -- stl_elig_cant_chg_flag Value of lookup code.
259 -- effective_date effective date
260 -- object_version_number Object version number of record being
261 -- inserted or updated.
262 --
263 -- Post Success
264 -- Processing continues
265 --
266 -- Post Failure
267 -- Error handled by procedure
268 --
269 -- Access Status
270 -- Internal table handler use only.
271 --
272 Procedure chk_stl_elig_cant_chg_flag(p_ler_chg_pl_nip_enrt_id in number,
273 p_stl_elig_cant_chg_flag in varchar2,
274 p_effective_date in date,
275 p_object_version_number in number) is
276 --
277 l_proc varchar2(72) := g_package||'chk_stl_elig_cant_chg_flag';
278 l_api_updating boolean;
279 --
280 Begin
281 --
282 hr_utility.set_location('Entering:'||l_proc, 5);
283 --
284 l_api_updating := ben_lpe_shd.api_updating
285 (p_ler_chg_pl_nip_enrt_id => p_ler_chg_pl_nip_enrt_id,
286 p_effective_date => p_effective_date,
287 p_object_version_number => p_object_version_number);
288 --
289 if (l_api_updating
290 and p_stl_elig_cant_chg_flag
291 <> nvl(ben_lpe_shd.g_old_rec.stl_elig_cant_chg_flag,hr_api.g_varchar2)
292 or not l_api_updating) then
293 --
294 -- check if value of lookup falls within lookup type.
295 --
296 --
297 if hr_api.not_exists_in_hr_lookups
298 (p_lookup_type => 'YES_NO',
299 p_lookup_code => p_stl_elig_cant_chg_flag,
300 p_effective_date => p_effective_date) then
301 --
302 -- raise error as does not exist as lookup
303 --
304 fnd_message.set_name('BEN','BEN_91628_LOOKUP_TYPE_GENERIC');
305 fnd_message.set_token('FIELD','p_stl_elig_cant_chg_flag');
306 fnd_message.set_token('TYPE','YES_NO');
307 fnd_message.raise_error;
308 --
309 end if;
310 --
311 end if;
312 --
313 hr_utility.set_location('Leaving:'||l_proc,10);
314 --
315 end chk_stl_elig_cant_chg_flag;
316 --
317 -- ----------------------------------------------------------------------------
318 -- |------< chk_enrt_cd >------|
319 -- ----------------------------------------------------------------------------
320 --
321 -- Description
322 -- This procedure is used to check that the lookup value is valid.
323 --
324 -- Pre Conditions
325 -- None.
326 --
327 -- In Parameters
328 -- ler_chg_pl_nip_enrt_id PK of record being inserted or updated.
329 -- enrt_cd Value of lookup code.
330 -- effective_date effective date
331 -- object_version_number Object version number of record being
332 -- inserted or updated.
333 --
334 -- Post Success
335 -- Processing continues
336 --
337 -- Post Failure
338 -- Error handled by procedure
339 --
340 -- Access Status
341 -- Internal table handler use only.
342 --
343 Procedure chk_enrt_cd(p_ler_chg_pl_nip_enrt_id in number,
344 p_enrt_cd in varchar2,
345 p_effective_date in date,
346 p_object_version_number in number) is
347 --
348 l_proc varchar2(72) := g_package||'chk_enrt_cd';
349 l_api_updating boolean;
350 --
351 Begin
352 --
353 hr_utility.set_location('Entering:'||l_proc, 5);
354 --
355 l_api_updating := ben_lpe_shd.api_updating
356 (p_ler_chg_pl_nip_enrt_id => p_ler_chg_pl_nip_enrt_id,
357 p_effective_date => p_effective_date,
358 p_object_version_number => p_object_version_number);
359 --
360 if (l_api_updating
361 and p_enrt_cd
362 <> nvl(ben_lpe_shd.g_old_rec.enrt_cd,hr_api.g_varchar2)
363 or not l_api_updating)
364 and p_enrt_cd is not null then
365 --
366 -- check if value of lookup falls within lookup type.
367 --
368 if hr_api.not_exists_in_hr_lookups
369 (p_lookup_type => 'BEN_ENRT',
370 p_lookup_code => p_enrt_cd,
371 p_effective_date => p_effective_date) then
372 --
373 -- raise error as does not exist as lookup
374 --
375 fnd_message.set_name('BEN','BEN_91628_LOOKUP_TYPE_GENERIC');
376 fnd_message.set_token('FIELD','p_enrt_cd');
377 fnd_message.set_token('TYPE','BEN_ENRT');
378 fnd_message.raise_error;
379 --
380 end if;
381 --
382 end if;
383 --
384 hr_utility.set_location('Leaving:'||l_proc,10);
385 --
386 end chk_enrt_cd;
387 --
388 -- ----------------------------------------------------------------------------
389 -- |------< chk_enrt_rl >------|
390 -- ----------------------------------------------------------------------------
391 --
392 -- Description
393 -- This procedure is used to check that the Formula Rule is valid.
394 --
395 -- Pre Conditions
396 -- None.
397 --
398 -- In Parameters
399 -- ler_chg_pl_nip_enrt_id PK of record being inserted or updated.
400 -- enrt_rl Value of formula rule id.
401 -- effective_date effective date
402 -- object_version_number Object version number of record being
403 -- inserted or updated.
404 -- business_group_id
405 --
406 -- Post Success
407 -- Processing continues
408 --
409 -- Post Failure
410 -- Error handled by procedure
411 --
412 -- Access Status
413 -- Internal table handler use only.
414 --
415 Procedure chk_enrt_rl(p_ler_chg_pl_nip_enrt_id in number,
416 p_enrt_rl in number,
417 p_effective_date in date,
418 p_object_version_number in number,
419 p_business_group_id in number) is
420 --
421 l_proc varchar2(72) := g_package||'chk_enrt_rl';
422 l_api_updating boolean;
423 l_dummy varchar2(1);
424 --
425 cursor c1 is
426 select null
427 from ff_formulas_f ff,
428 per_business_groups pbg
429 where ff.formula_id = p_enrt_rl
430 and ff.formula_type_id = - 393
431 and pbg.business_group_id = p_business_group_id
432 and nvl(ff.business_group_id, p_business_group_id) =
436 and p_effective_date
433 p_business_group_id
434 and nvl(ff.legislation_code, pbg.legislation_code) =
435 pbg.legislation_code
437 between ff.effective_start_date
438 and ff.effective_end_date;
439 --
440 Begin
441 --
442 hr_utility.set_location('Entering:'||l_proc, 5);
443 --
444 l_api_updating := ben_lpe_shd.api_updating
445 (p_ler_chg_pl_nip_enrt_id => p_ler_chg_pl_nip_enrt_id,
446 p_effective_date => p_effective_date,
447 p_object_version_number => p_object_version_number);
448 --
449 if (l_api_updating
450 and nvl(p_enrt_rl,hr_api.g_number)
451 <> ben_lpe_shd.g_old_rec.enrt_rl
452 or not l_api_updating)
453 and p_enrt_rl is not null then
454 --
455 -- check if value of formula rule is valid.
456 --
457 open c1;
458 --
459 -- fetch value from cursor if it returns a record then the
460 -- formula is valid otherwise its invalid
461 --
462 fetch c1 into l_dummy;
463 if c1%notfound then
464 --
465 close c1;
466 --
467 -- raise error
468 --
469 fnd_message.set_name('BEN','BEN_91471_FORMULA_NOT_FOUND');
470 fnd_message.set_token('ID',p_enrt_rl);
471 fnd_message.set_token('TYPE_ID',-393);
472 fnd_message.raise_error;
473 --
474 end if;
475 --
476 close c1;
477 --
478 end if;
479 --
480 hr_utility.set_location('Leaving:'||l_proc,10);
481 --
482 end chk_enrt_rl;
483 --
484 -- ----------------------------------------------------------------------------
485 -- |------< chk_dflt_flag >------|
486 -- ----------------------------------------------------------------------------
487 --
488 -- Description
489 -- This procedure is used to check that the lookup value is valid.
490 --
491 -- Pre Conditions
492 -- None.
493 --
494 -- In Parameters
495 -- ler_chg_pl_nip_enrt_id PK of record being inserted or updated.
496 -- dflt_flag Value of lookup code.
497 -- effective_date effective date
498 -- object_version_number Object version number of record being
499 -- inserted or updated.
500 --
501 -- Post Success
502 -- Processing continues
503 --
504 -- Post Failure
505 -- Error handled by procedure
506 --
507 -- Access Status
508 -- Internal table handler use only.
509 --
510 Procedure chk_dflt_flag(p_ler_chg_pl_nip_enrt_id in number,
511 p_dflt_flag in varchar2,
512 p_effective_date in date,
513 p_object_version_number in number) is
514 --
515 l_proc varchar2(72) := g_package||'chk_dflt_flag';
516 l_api_updating boolean;
517 --
518 Begin
519 --
520 hr_utility.set_location('Entering:'||l_proc, 5);
521 --
522 l_api_updating := ben_lpe_shd.api_updating
523 (p_ler_chg_pl_nip_enrt_id => p_ler_chg_pl_nip_enrt_id,
524 p_effective_date => p_effective_date,
525 p_object_version_number => p_object_version_number);
526 --
527 if (l_api_updating
528 and p_dflt_flag
529 <> nvl(ben_lpe_shd.g_old_rec.dflt_flag,hr_api.g_varchar2)
530 or not l_api_updating) then
531 --
532 -- check if value of lookup falls within lookup type.
533 --
534 --
535 if hr_api.not_exists_in_hr_lookups
536 (p_lookup_type => 'YES_NO',
537 p_lookup_code => p_dflt_flag,
538 p_effective_date => p_effective_date) then
539 --
540 -- raise error as does not exist as lookup
541 --
542 fnd_message.set_name('BEN','BEN_91628_LOOKUP_TYPE_GENERIC');
543 fnd_message.set_token('FIELD','p_dflt_flag');
544 fnd_message.set_token('TYPE','YES_NO');
545 fnd_message.raise_error;
546 --
547 end if;
548 --
549 end if;
550 --
551 hr_utility.set_location('Leaving:'||l_proc,10);
552 --
553 end chk_dflt_flag;
554 --
555 -- ----------------------------------------------------------------------------
556 -- |------< chk_dflt_enrt_rl >------|
557 -- ----------------------------------------------------------------------------
558 --
559 -- Description
560 -- This procedure is used to check that the Formula Rule is valid.
561 --
562 -- Pre Conditions
563 -- None.
564 --
565 -- In Parameters
566 -- ler_chg_pl_nip_enrt_id PK of record being inserted or updated.
567 -- dflt_enrt_rl Value of formula rule id.
568 -- effective_date effective date
569 -- object_version_number Object version number of record being
570 -- inserted or updated.
571 -- business_group_id
572 --
573 -- Post Success
574 -- Processing continues
575 --
576 -- Post Failure
577 -- Error handled by procedure
578 --
579 -- Access Status
580 -- Internal table handler use only.
581 --
582 Procedure chk_dflt_enrt_rl(p_ler_chg_pl_nip_enrt_id in number,
586 p_business_group_id in number) is
583 p_dflt_enrt_rl in number,
584 p_effective_date in date,
585 p_object_version_number in number,
587 --
588 l_proc varchar2(72) := g_package||'chk_dflt_enrt_rl';
589 l_api_updating boolean;
590 l_dummy varchar2(1);
591 --
592 cursor c1 is
593 select null
594 from ff_formulas_f ff,
595 per_business_groups pbg
596 where ff.formula_id = p_dflt_enrt_rl
597 and ff.formula_type_id = - 32
598 and pbg.business_group_id = p_business_group_id
599 and nvl(ff.business_group_id, p_business_group_id) =
600 p_business_group_id
601 and nvl(ff.legislation_code, pbg.legislation_code) =
602 pbg.legislation_code
603 and p_effective_date
604 between ff.effective_start_date
605 and ff.effective_end_date;
606 --
607 Begin
608 --
609 hr_utility.set_location('Entering:'||l_proc, 5);
610 --
611 l_api_updating := ben_lpe_shd.api_updating
612 (p_ler_chg_pl_nip_enrt_id => p_ler_chg_pl_nip_enrt_id,
613 p_effective_date => p_effective_date,
614 p_object_version_number => p_object_version_number);
615 --
616 if (l_api_updating
617 and nvl(p_dflt_enrt_rl,hr_api.g_number)
618 <> ben_lpe_shd.g_old_rec.dflt_enrt_rl
619 or not l_api_updating)
620 and p_dflt_enrt_rl is not null then
621 --
622 -- check if value of formula rule is valid.
623 --
624 open c1;
625 --
626 -- fetch value from cursor if it returns a record then the
627 -- formula is valid otherwise its invalid
628 --
629 fetch c1 into l_dummy;
630 if c1%notfound then
631 --
632 close c1;
633 --
634 -- raise error
635 --
636 fnd_message.set_name('BEN','BEN_91471_FORMULA_NOT_FOUND');
637 fnd_message.set_token('ID',p_dflt_enrt_rl);
638 fnd_message.set_token('TYPE_ID',-32);
639 fnd_message.raise_error;
640 --
641 end if;
642 --
643 close c1;
644 --
645 end if;
646 --
647 hr_utility.set_location('Leaving:'||l_proc,10);
648 --
649 end chk_dflt_enrt_rl;
650 --
651 -- ----------------------------------------------------------------------------
652 -- |------< chk_dflt_enrt_cd >------|
653 -- ----------------------------------------------------------------------------
654 --
655 -- Description
656 -- This procedure is used to check that the lookup value is valid.
657 --
658 -- Pre Conditions
659 -- None.
660 --
661 -- In Parameters
662 -- ler_chg_pl_nip_enrt_id PK of record being inserted or updated.
663 -- dflt_enrt_cd Value of lookup code.
664 -- effective_date effective date
665 -- object_version_number Object version number of record being
666 -- inserted or updated.
667 --
668 -- Post Success
669 -- Processing continues
670 --
671 -- Post Failure
672 -- Error handled by procedure
673 --
674 -- Access Status
675 -- Internal table handler use only.
676 --
677 Procedure chk_dflt_enrt_cd(p_ler_chg_pl_nip_enrt_id in number,
678 p_dflt_enrt_cd in varchar2,
679 p_effective_date in date,
680 p_object_version_number in number) is
681 --
682 l_proc varchar2(72) := g_package||'chk_dflt_enrt_cd';
683 l_api_updating boolean;
684 --
685 Begin
686 --
687 hr_utility.set_location('Entering:'||l_proc, 5);
688 --
689 l_api_updating := ben_lpe_shd.api_updating
690 (p_ler_chg_pl_nip_enrt_id => p_ler_chg_pl_nip_enrt_id,
691 p_effective_date => p_effective_date,
692 p_object_version_number => p_object_version_number);
693 --
694 if (l_api_updating
695 and p_dflt_enrt_cd
696 <> nvl(ben_lpe_shd.g_old_rec.dflt_enrt_cd,hr_api.g_varchar2)
697 or not l_api_updating)
698 and p_dflt_enrt_cd is not null then
699 --
700 -- check if value of lookup falls within lookup type.
701 --
702 if hr_api.not_exists_in_hr_lookups
703 (p_lookup_type => 'BEN_DFLT_ENRT',
704 p_lookup_code => p_dflt_enrt_cd,
705 p_effective_date => p_effective_date) then
706 --
707 -- raise error as does not exist as lookup
708 --
709 fnd_message.set_name('BEN','BEN_91628_LOOKUP_TYPE_GENERIC');
710 fnd_message.set_token('FIELD','p_dflt_enrt_cd');
711 fnd_message.set_token('TYPE','BEN_DFLT_ENRT');
712 fnd_message.raise_error;
713 --
714 end if;
715 --
716 end if;
717 --
718 hr_utility.set_location('Leaving:'||l_proc,10);
719 --
720 end chk_dflt_enrt_cd;
721 --
722 -- ----------------------------------------------------------------------------
723 -- |------< chk_crnt_enrt_prclds_chg_flag >------|
727 -- This procedure is used to check that the lookup value is valid.
724 -- ----------------------------------------------------------------------------
725 --
726 -- Description
728 --
729 -- Pre Conditions
730 -- None.
731 --
732 -- In Parameters
733 -- ler_chg_pl_nip_enrt_id PK of record being inserted or updated.
734 -- crnt_enrt_prclds_chg_flag Value of lookup code.
735 -- effective_date effective date
736 -- object_version_number Object version number of record being
737 -- inserted or updated.
738 --
739 -- Post Success
740 -- Processing continues
741 --
742 -- Post Failure
743 -- Error handled by procedure
744 --
745 -- Access Status
746 -- Internal table handler use only.
747 --
748 Procedure chk_crnt_enrt_prclds_chg_flag(p_ler_chg_pl_nip_enrt_id in number,
749 p_crnt_enrt_prclds_chg_flag in varchar2,
750 p_effective_date in date,
751 p_object_version_number in number) is
752 --
753 l_proc varchar2(72) := g_package||'chk_crnt_enrt_prclds_chg_flag';
754 l_api_updating boolean;
755 --
756 Begin
757 --
758 hr_utility.set_location('Entering:'||l_proc, 5);
759 --
760 l_api_updating := ben_lpe_shd.api_updating
761 (p_ler_chg_pl_nip_enrt_id => p_ler_chg_pl_nip_enrt_id,
762 p_effective_date => p_effective_date,
763 p_object_version_number => p_object_version_number);
764 --
765 if (l_api_updating
766 and p_crnt_enrt_prclds_chg_flag
767 <> nvl(ben_lpe_shd.g_old_rec.crnt_enrt_prclds_chg_flag,hr_api.g_varchar2)
768 or not l_api_updating) then
769 --
770 -- check if value of lookup falls within lookup type.
771 --
772 --
773 if hr_api.not_exists_in_hr_lookups
774 (p_lookup_type => 'YES_NO',
775 p_lookup_code => p_crnt_enrt_prclds_chg_flag,
776 p_effective_date => p_effective_date) then
777 --
778 -- raise error as does not exist as lookup
779 --
780 fnd_message.set_name('BEN','BEN_91628_LOOKUP_TYPE_GENERIC');
781 fnd_message.set_token('FIELD','p_crnt_enrt_prclds_chg_flag');
782 fnd_message.set_token('TYPE','YES_NO');
783 fnd_message.raise_error;
784 --
785 end if;
786 --
787 end if;
788 --
789 hr_utility.set_location('Leaving:'||l_proc,10);
790 --
791 end chk_crnt_enrt_prclds_chg_flag;
792 --
793 -- ----------------------------------------------------------------------------
794 -- |------< chk_tco_chg_enrt_cd >------|
795 -- ----------------------------------------------------------------------------
796 --
797 -- Description
798 -- This procedure is used to check that the lookup value is valid.
799 --
800 -- Pre Conditions
801 -- None.
802 --
803 -- In Parameters
804 -- ler_chg_pl_nip_enrt_id PK of record being inserted or updated.
805 -- tco_chg_enrt_cd Value of lookup code.
806 -- effective_date effective date
807 -- object_version_number Object version number of record being
808 -- inserted or updated.
809 --
810 -- Post Success
811 -- Processing continues
812 --
813 -- Post Failure
814 -- Error handled by procedure
815 --
816 -- Access Status
817 -- Internal table handler use only.
818 --
819 Procedure chk_tco_chg_enrt_cd(p_ler_chg_pl_nip_enrt_id in number,
820 p_tco_chg_enrt_cd in varchar2,
821 p_effective_date in date,
822 p_object_version_number in number) is
823 --
824 l_proc varchar2(72) := g_package||'chk_tco_chg_enrt_cd';
825 l_api_updating boolean;
826 --
827 Begin
828 --
829 hr_utility.set_location('Entering:'||l_proc, 5);
830 --
831 l_api_updating := ben_lpe_shd.api_updating
832 (p_ler_chg_pl_nip_enrt_id => p_ler_chg_pl_nip_enrt_id,
833 p_effective_date => p_effective_date,
834 p_object_version_number => p_object_version_number);
835 --
836 if (l_api_updating
837 and p_tco_chg_enrt_cd is not null
838 and p_tco_chg_enrt_cd
839 <> nvl(ben_lpe_shd.g_old_rec.tco_chg_enrt_cd,hr_api.g_varchar2)
840 or not l_api_updating)and p_tco_chg_enrt_cd is not null then
841 --
842 -- check if value of lookup falls within lookup type.
843 --
844 --
845 if hr_api.not_exists_in_hr_lookups
846 (p_lookup_type => 'BEN_TCO_CHG_ENRT',
847 p_lookup_code => p_tco_chg_enrt_cd,
848 p_effective_date => p_effective_date) then
849 --
850 -- raise error as does not exist as lookup
851 --
852 fnd_message.set_name('BEN','BEN_91628_LOOKUP_TYPE_GENERIC');
853 fnd_message.set_token('FIELD','p_tco_chg_enrt_cd');
854 fnd_message.set_token('TYPE','BEN_TCO_CHG_ENRT');
855 fnd_message.raise_error;
856 --
857 end if;
858 --
859 end if;
860 --
861 hr_utility.set_location('Leaving:'||l_proc,10);
862 --
863 end chk_tco_chg_enrt_cd;
867 -- ----------------------------------------------------------------------------
864 --
865 -- ----------------------------------------------------------------------------
866 -- |--------------------------< dt_update_validate >--------------------------|
868 -- {Start Of Comments}
869 --
870 -- Description:
871 -- This procedure is used for referential integrity of datetracked
872 -- parent entities when a datetrack update operation is taking place
873 -- and where there is no cascading of update defined for this entity.
874 --
875 -- Prerequisites:
876 -- This procedure is called from the update_validate.
877 --
878 -- In Parameters:
879 --
880 -- Post Success:
881 -- Processing continues.
882 --
883 -- Post Failure:
884 --
885 -- Developer Implementation Notes:
886 -- This procedure should not need maintenance unless the HR Schema model
887 -- changes.
888 --
889 -- Access Status:
890 -- Internal Row Handler Use Only.
891 --
892 -- {End Of Comments}
893 -- ----------------------------------------------------------------------------
894 Procedure dt_update_validate
895 (p_pl_id in number default hr_api.g_number,
896 p_datetrack_mode in varchar2,
897 p_validation_start_date in date,
898 p_validation_end_date in date) Is
899 --
900 l_proc varchar2(72) := g_package||'dt_update_validate';
901 l_integrity_error Exception;
902 l_table_name all_tables.table_name%TYPE;
903 --
904 Begin
905 hr_utility.set_location('Entering:'||l_proc, 5);
906 --
907 -- Ensure that the p_datetrack_mode argument is not null
908 --
909 hr_api.mandatory_arg_error
910 (p_api_name => l_proc,
911 p_argument => 'datetrack_mode',
912 p_argument_value => p_datetrack_mode);
913 --
914 -- Only perform the validation if the datetrack update mode is valid
915 --
916 If (dt_api.validate_dt_upd_mode(p_datetrack_mode => p_datetrack_mode)) then
917 --
918 --
919 -- Ensure the arguments are not null
920 --
921 hr_api.mandatory_arg_error
922 (p_api_name => l_proc,
923 p_argument => 'validation_start_date',
924 p_argument_value => p_validation_start_date);
925 --
926 hr_api.mandatory_arg_error
927 (p_api_name => l_proc,
928 p_argument => 'validation_end_date',
929 p_argument_value => p_validation_end_date);
930 --
931 If ((nvl(p_pl_id, hr_api.g_number) <> hr_api.g_number) and
932 NOT (dt_api.check_min_max_dates
933 (p_base_table_name => 'ben_pl_f',
934 p_base_key_column => 'pl_id',
935 p_base_key_value => p_pl_id,
936 p_from_date => p_validation_start_date,
937 p_to_date => p_validation_end_date))) Then
938 l_table_name := 'ben_pl_f';
939 Raise l_integrity_error;
940 End If;
941 --
942 End If;
943 --
944 hr_utility.set_location(' Leaving:'||l_proc, 10);
945 Exception
946 When l_integrity_error Then
947 --
948 -- A referential integrity check was violated therefore
949 -- we must error
950 --
951 hr_utility.set_message(801, 'HR_7216_DT_UPD_INTEGRITY_ERR');
952 hr_utility.set_message_token('TABLE_NAME', l_table_name);
953 hr_utility.raise_error;
954 When Others Then
955 --
956 -- An unhandled or unexpected error has occurred which
957 -- we must report
958 --
959 hr_utility.set_message(801, 'HR_6153_ALL_PROCEDURE_FAIL');
960 hr_utility.set_message_token('PROCEDURE', l_proc);
961 hr_utility.set_message_token('STEP','15');
962 hr_utility.raise_error;
963 End dt_update_validate;
964 --
965 -- ----------------------------------------------------------------------------
966 -- |--------------------------< dt_delete_validate >--------------------------|
967 -- ----------------------------------------------------------------------------
968 -- {Start Of Comments}
969 --
970 -- Description:
971 -- This procedure is used for referential integrity of datetracked
972 -- child entities when either a datetrack DELETE or ZAP is in operation
973 -- and where there is no cascading of delete defined for this entity.
974 -- For the datetrack mode of DELETE or ZAP we must ensure that no
975 -- datetracked child rows exist between the validation start and end
976 -- dates.
977 --
978 -- Prerequisites:
979 -- This procedure is called from the delete_validate.
980 --
981 -- In Parameters:
982 --
983 -- Post Success:
984 -- Processing continues.
985 --
986 -- Post Failure:
987 -- If a row exists by determining the returning Boolean value from the
988 -- generic dt_api.rows_exist function then we must supply an error via
989 -- the use of the local exception handler l_rows_exist.
990 --
991 -- Developer Implementation Notes:
992 -- This procedure should not need maintenance unless the HR Schema model
993 -- changes.
994 --
995 -- Access Status:
996 -- Internal Row Handler Use Only.
997 --
998 -- {End Of Comments}
999 -- ----------------------------------------------------------------------------
1000 Procedure dt_delete_validate
1004 p_validation_end_date in date) Is
1001 (p_ler_chg_pl_nip_enrt_id in number,
1002 p_datetrack_mode in varchar2,
1003 p_validation_start_date in date,
1005 --
1006 l_proc varchar2(72) := g_package||'dt_delete_validate';
1007 l_rows_exist Exception;
1008 l_table_name all_tables.table_name%TYPE;
1009 --
1010 Begin
1011 hr_utility.set_location('Entering:'||l_proc, 5);
1012 --
1013 -- Ensure that the p_datetrack_mode argument is not null
1014 --
1015 hr_api.mandatory_arg_error
1016 (p_api_name => l_proc,
1017 p_argument => 'datetrack_mode',
1018 p_argument_value => p_datetrack_mode);
1019 --
1020 -- Only perform the validation if the datetrack mode is either
1021 -- DELETE or ZAP
1022 --
1023 If (p_datetrack_mode = 'DELETE' or
1024 p_datetrack_mode = 'ZAP') then
1025 --
1026 --
1027 -- Ensure the arguments are not null
1028 --
1029 hr_api.mandatory_arg_error
1030 (p_api_name => l_proc,
1031 p_argument => 'validation_start_date',
1032 p_argument_value => p_validation_start_date);
1033 --
1034 hr_api.mandatory_arg_error
1035 (p_api_name => l_proc,
1036 p_argument => 'validation_end_date',
1037 p_argument_value => p_validation_end_date);
1038 --
1039 hr_api.mandatory_arg_error
1040 (p_api_name => l_proc,
1041 p_argument => 'ler_chg_pl_nip_enrt_id',
1042 p_argument_value => p_ler_chg_pl_nip_enrt_id);
1043 --
1044 If (dt_api.rows_exist
1045 (p_base_table_name => 'ben_ler_chg_pl_nip_rl_f',
1046 p_base_key_column => 'ler_chg_pl_nip_enrt_id',
1047 p_base_key_value => p_ler_chg_pl_nip_enrt_id,
1048 p_from_date => p_validation_start_date,
1049 p_to_date => p_validation_end_date)) Then
1050 l_table_name := 'ben_ler_chg_pl_nip_rl_f';
1051 Raise l_rows_exist;
1052 End If;
1053 --
1054 End If;
1055 --
1056 hr_utility.set_location(' Leaving:'||l_proc, 10);
1057 Exception
1058 When l_rows_exist Then
1059 --
1060 -- A referential integrity check was violated therefore
1061 -- we must error
1062 --
1063 hr_utility.set_message(801, 'HR_7215_DT_CHILD_EXISTS');
1064 hr_utility.set_message_token('TABLE_NAME', l_table_name);
1065 hr_utility.raise_error;
1066 When Others Then
1067 --
1068 -- An unhandled or unexpected error has occurred which
1069 -- we must report
1070 --
1071 hr_utility.set_message(801, 'HR_6153_ALL_PROCEDURE_FAIL');
1072 hr_utility.set_message_token('PROCEDURE', l_proc);
1073 hr_utility.set_message_token('STEP','15');
1074 hr_utility.raise_error;
1075 End dt_delete_validate;
1076 --
1077 -- ----------------------------------------------------------------------------
1078 -- |---------------------------< insert_validate >----------------------------|
1079 -- ----------------------------------------------------------------------------
1080 Procedure insert_validate
1081 (p_rec in ben_lpe_shd.g_rec_type,
1082 p_effective_date in date,
1083 p_datetrack_mode in varchar2,
1084 p_validation_start_date in date,
1085 p_validation_end_date in date) is
1086 --
1087 l_proc varchar2(72) := g_package||'insert_validate';
1088 --
1089 Begin
1090 hr_utility.set_location('Entering:'||l_proc, 5);
1091 --
1092 -- Call all supporting business operations
1093 --
1094 --
1095 hr_api.validate_bus_grp_id(p_rec.business_group_id); -- Validate Bus Grp
1096 --
1097 chk_ler_chg_pl_nip_enrt_id
1098 (p_ler_chg_pl_nip_enrt_id => p_rec.ler_chg_pl_nip_enrt_id,
1099 p_effective_date => p_effective_date,
1100 p_object_version_number => p_rec.object_version_number);
1101 --
1102 chk_auto_enrt_mthd_rl
1103 (p_ler_chg_pl_nip_enrt_id => p_rec.ler_chg_pl_nip_enrt_id,
1104 p_auto_enrt_mthd_rl => p_rec.auto_enrt_mthd_rl,
1105 p_effective_date => p_effective_date,
1106 p_business_group_id => p_rec.business_group_id,
1107 p_object_version_number => p_rec.object_version_number);
1108 --
1109 chk_enrt_mthd_cd
1110 (p_ler_chg_pl_nip_enrt_id => p_rec.ler_chg_pl_nip_enrt_id,
1111 p_enrt_mthd_cd => p_rec.enrt_mthd_cd,
1112 p_effective_date => p_effective_date,
1113 p_object_version_number => p_rec.object_version_number);
1114 --
1115 chk_stl_elig_cant_chg_flag
1116 (p_ler_chg_pl_nip_enrt_id => p_rec.ler_chg_pl_nip_enrt_id,
1117 p_stl_elig_cant_chg_flag => p_rec.stl_elig_cant_chg_flag,
1118 p_effective_date => p_effective_date,
1119 p_object_version_number => p_rec.object_version_number);
1120 --
1121 chk_enrt_cd
1122 (p_ler_chg_pl_nip_enrt_id => p_rec.ler_chg_pl_nip_enrt_id,
1123 p_enrt_cd => p_rec.enrt_cd,
1124 p_effective_date => p_effective_date,
1125 p_object_version_number => p_rec.object_version_number);
1126 --
1127 chk_enrt_rl
1128 (p_ler_chg_pl_nip_enrt_id => p_rec.ler_chg_pl_nip_enrt_id,
1129 p_enrt_rl => p_rec.enrt_rl,
1130 p_effective_date => p_effective_date,
1131 p_object_version_number => p_rec.object_version_number,
1132 p_business_group_id => p_rec.business_group_id);
1133 --
1137 p_effective_date => p_effective_date,
1134 chk_dflt_flag
1135 (p_ler_chg_pl_nip_enrt_id => p_rec.ler_chg_pl_nip_enrt_id,
1136 p_dflt_flag => p_rec.dflt_flag,
1138 p_object_version_number => p_rec.object_version_number);
1139 --
1140 chk_dflt_enrt_rl
1141 (p_ler_chg_pl_nip_enrt_id => p_rec.ler_chg_pl_nip_enrt_id,
1142 p_dflt_enrt_rl => p_rec.dflt_enrt_rl,
1143 p_effective_date => p_effective_date,
1144 p_object_version_number => p_rec.object_version_number,
1145 p_business_group_id => p_rec.business_group_id);
1146 --
1147 chk_dflt_enrt_cd
1148 (p_ler_chg_pl_nip_enrt_id => p_rec.ler_chg_pl_nip_enrt_id,
1149 p_dflt_enrt_cd => p_rec.dflt_enrt_cd,
1150 p_effective_date => p_effective_date,
1151 p_object_version_number => p_rec.object_version_number);
1152 --
1153 chk_crnt_enrt_prclds_chg_flag
1154 (p_ler_chg_pl_nip_enrt_id => p_rec.ler_chg_pl_nip_enrt_id,
1155 p_crnt_enrt_prclds_chg_flag => p_rec.crnt_enrt_prclds_chg_flag,
1156 p_effective_date => p_effective_date,
1157 p_object_version_number => p_rec.object_version_number);
1158 --
1159 chk_tco_chg_enrt_cd
1160 (p_ler_chg_pl_nip_enrt_id => p_rec.ler_chg_pl_nip_enrt_id,
1161 p_tco_chg_enrt_cd => p_rec.tco_chg_enrt_cd,
1162 p_effective_date => p_effective_date,
1163 p_object_version_number => p_rec.object_version_number);
1164 --
1165 hr_utility.set_location(' Leaving:'||l_proc, 10);
1166 End insert_validate;
1167 --
1168 -- ----------------------------------------------------------------------------
1169 -- |---------------------------< update_validate >----------------------------|
1170 -- ----------------------------------------------------------------------------
1171 Procedure update_validate
1172 (p_rec in ben_lpe_shd.g_rec_type,
1173 p_effective_date in date,
1174 p_datetrack_mode in varchar2,
1175 p_validation_start_date in date,
1176 p_validation_end_date in date) is
1177 --
1178 l_proc varchar2(72) := g_package||'update_validate';
1179 --
1180 Begin
1181 hr_utility.set_location('Entering:'||l_proc, 5);
1182 --
1183 -- Call all supporting business operations
1184 --
1185 --
1186 hr_api.validate_bus_grp_id(p_rec.business_group_id); -- Validate Bus Grp
1187 --
1188 chk_ler_chg_pl_nip_enrt_id
1189 (p_ler_chg_pl_nip_enrt_id => p_rec.ler_chg_pl_nip_enrt_id,
1190 p_effective_date => p_effective_date,
1191 p_object_version_number => p_rec.object_version_number);
1192 --
1193 chk_auto_enrt_mthd_rl
1194 (p_ler_chg_pl_nip_enrt_id => p_rec.ler_chg_pl_nip_enrt_id,
1195 p_auto_enrt_mthd_rl => p_rec.auto_enrt_mthd_rl,
1196 p_effective_date => p_effective_date,
1197 p_business_group_id => p_rec.business_group_id,
1198 p_object_version_number => p_rec.object_version_number);
1199 --
1200 chk_enrt_mthd_cd
1201 (p_ler_chg_pl_nip_enrt_id => p_rec.ler_chg_pl_nip_enrt_id,
1202 p_enrt_mthd_cd => p_rec.enrt_mthd_cd,
1203 p_effective_date => p_effective_date,
1204 p_object_version_number => p_rec.object_version_number);
1205 --
1206 chk_stl_elig_cant_chg_flag
1207 (p_ler_chg_pl_nip_enrt_id => p_rec.ler_chg_pl_nip_enrt_id,
1208 p_stl_elig_cant_chg_flag => p_rec.stl_elig_cant_chg_flag,
1209 p_effective_date => p_effective_date,
1210 p_object_version_number => p_rec.object_version_number);
1211 --
1212 chk_enrt_cd
1213 (p_ler_chg_pl_nip_enrt_id => p_rec.ler_chg_pl_nip_enrt_id,
1214 p_enrt_cd => p_rec.enrt_cd,
1215 p_effective_date => p_effective_date,
1216 p_object_version_number => p_rec.object_version_number);
1217 --
1218 chk_enrt_rl
1219 (p_ler_chg_pl_nip_enrt_id => p_rec.ler_chg_pl_nip_enrt_id,
1220 p_enrt_rl => p_rec.enrt_rl,
1221 p_effective_date => p_effective_date,
1222 p_object_version_number => p_rec.object_version_number,
1223 p_business_group_id => p_rec.business_group_id);
1224 --
1225 chk_dflt_flag
1226 (p_ler_chg_pl_nip_enrt_id => p_rec.ler_chg_pl_nip_enrt_id,
1227 p_dflt_flag => p_rec.dflt_flag,
1228 p_effective_date => p_effective_date,
1229 p_object_version_number => p_rec.object_version_number);
1230 --
1231 chk_dflt_enrt_rl
1232 (p_ler_chg_pl_nip_enrt_id => p_rec.ler_chg_pl_nip_enrt_id,
1233 p_dflt_enrt_rl => p_rec.dflt_enrt_rl,
1234 p_effective_date => p_effective_date,
1235 p_object_version_number => p_rec.object_version_number,
1236 p_business_group_id => p_rec.business_group_id);
1237 --
1238 chk_dflt_enrt_cd
1239 (p_ler_chg_pl_nip_enrt_id => p_rec.ler_chg_pl_nip_enrt_id,
1240 p_dflt_enrt_cd => p_rec.dflt_enrt_cd,
1241 p_effective_date => p_effective_date,
1242 p_object_version_number => p_rec.object_version_number);
1243 --
1244 chk_crnt_enrt_prclds_chg_flag
1245 (p_ler_chg_pl_nip_enrt_id => p_rec.ler_chg_pl_nip_enrt_id,
1246 p_crnt_enrt_prclds_chg_flag => p_rec.crnt_enrt_prclds_chg_flag,
1247 p_effective_date => p_effective_date,
1248 p_object_version_number => p_rec.object_version_number);
1249 --
1250 chk_tco_chg_enrt_cd
1251 (p_ler_chg_pl_nip_enrt_id => p_rec.ler_chg_pl_nip_enrt_id,
1252 p_tco_chg_enrt_cd => p_rec.tco_chg_enrt_cd,
1253 p_effective_date => p_effective_date,
1254 p_object_version_number => p_rec.object_version_number);
1255 --
1259 (p_pl_id => p_rec.pl_id,
1256 -- Call the datetrack update integrity operation
1257 --
1258 dt_update_validate
1260 p_datetrack_mode => p_datetrack_mode,
1261 p_validation_start_date => p_validation_start_date,
1262 p_validation_end_date => p_validation_end_date);
1263 --
1264 hr_utility.set_location(' Leaving:'||l_proc, 10);
1265 End update_validate;
1266 --
1267 -- ----------------------------------------------------------------------------
1268 -- |---------------------------< delete_validate >----------------------------|
1269 -- ----------------------------------------------------------------------------
1270 Procedure delete_validate
1271 (p_rec in ben_lpe_shd.g_rec_type,
1272 p_effective_date in date,
1273 p_datetrack_mode in varchar2,
1274 p_validation_start_date in date,
1275 p_validation_end_date in date) is
1276 --
1277 l_proc varchar2(72) := g_package||'delete_validate';
1278 --
1279 Begin
1280 hr_utility.set_location('Entering:'||l_proc, 5);
1281 --
1282 -- Call all supporting business operations
1283 --
1284 dt_delete_validate
1285 (p_datetrack_mode => p_datetrack_mode,
1286 p_validation_start_date => p_validation_start_date,
1287 p_validation_end_date => p_validation_end_date,
1288 p_ler_chg_pl_nip_enrt_id => p_rec.ler_chg_pl_nip_enrt_id);
1289 --
1290 hr_utility.set_location(' Leaving:'||l_proc, 10);
1291 End delete_validate;
1292 --
1293 --
1294 -- ---------------------------------------------------------------------------
1295 -- |---------------------< return_legislation_code >-------------------------|
1296 -- ---------------------------------------------------------------------------
1297 --
1298 function return_legislation_code
1299 (p_ler_chg_pl_nip_enrt_id in number) return varchar2 is
1300 --
1301 -- Declare cursor
1302 --
1303 cursor csr_leg_code is
1304 select a.legislation_code
1305 from per_business_groups a,
1306 ben_ler_chg_pl_nip_enrt_f b
1307 where b.ler_chg_pl_nip_enrt_id = p_ler_chg_pl_nip_enrt_id
1308 and a.business_group_id = b.business_group_id;
1309 --
1310 -- Declare local variables
1311 --
1312 l_legislation_code varchar2(150);
1313 l_proc varchar2(72) := g_package||'return_legislation_code';
1314 --
1315 begin
1316 --
1317 hr_utility.set_location('Entering:'|| l_proc, 10);
1318 --
1319 -- Ensure that all the mandatory parameter are not null
1320 --
1321 hr_api.mandatory_arg_error(p_api_name => l_proc,
1322 p_argument => 'ler_chg_pl_nip_enrt_id',
1323 p_argument_value => p_ler_chg_pl_nip_enrt_id);
1324 --
1325 open csr_leg_code;
1326 --
1327 fetch csr_leg_code into l_legislation_code;
1328 --
1329 if csr_leg_code%notfound then
1330 --
1331 close csr_leg_code;
1332 --
1333 -- The primary key is invalid therefore we must error
1334 --
1335 hr_utility.set_message(801,'HR_7220_INVALID_PRIMARY_KEY');
1336 hr_utility.raise_error;
1337 --
1338 end if;
1339 --
1340 close csr_leg_code;
1341 --
1342 hr_utility.set_location(' Leaving:'|| l_proc, 20);
1343 --
1344 return l_legislation_code;
1345 --
1346 end return_legislation_code;
1347 --
1348 end ben_lpe_bus;