DBA Data[Home] [Help]

PACKAGE BODY: APPS.BEN_LCT_BUS

Source


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