DBA Data[Home] [Help]

PACKAGE BODY: APPS.BEN_CTP_BUS

Source


1 Package Body ben_ctp_bus as
2 /* $Header: bectprhi.pkb 120.0.12020000.2 2012/07/03 12:06:46 amnaraya ship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33)	:= '  ben_ctp_bus.';  -- Global package name
9 --
10 --
11 -- ----------------------------------------------------------------------------
12 -- |--------------------<chk_duplicate_ordr_num >-----------------------------|
13 -- ----------------------------------------------------------------------------
14 --
15 -- Description
16 --     make sure ordr_to_aply_num is unique within prtn_elig_prfl
17 --
18 -- Pre Conditions
19 --   None.
20 --
21 -- In Parameters
22 --     p_ptip_id
23 --     p_pgm_id
24 --     p_ordr_num
25 --     p_business_group_id
26 --     p_effective_date
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 -- ----------------------------------------------------------------------------
38 Procedure chk_duplicate_ordr_num
39           ( p_ptip_id in number
40            ,p_pgm_id in number
41            ,p_ordr_num in number
42            ,p_business_group_id in number
43            ,p_effective_date in date
44            ,p_validation_start_date  in date
45            ,p_validation_end_date    in date
46             )
47 is
48    l_proc  varchar2(72) := g_package||' chk_duplicate_ordr_num ';
49    l_dummy char(1);
50    cursor c1 is select null
51                   from ben_ptip_f
52                  where ptip_id <> nvl(p_ptip_id, -1 )
53                    and pgm_id = p_pgm_id
54                    and ordr_num = p_ordr_num
55                    and business_group_id + 0 = p_business_group_id
56                     and p_validation_start_date <= effective_end_date
57                    and p_validation_end_date >= effective_start_date;
58 --
59 Begin
60    --
61    hr_utility.set_location('Entering:'||l_proc, 5);
62    --
63    open c1;
64    fetch c1 into l_dummy;
65    if c1%found then
66        close c1;
67        fnd_message.set_name('BEN','BEN_91001_SEQ_NOT_UNIQUE');
68        fnd_message.raise_error;
69    end if;
70    close c1;
71    --
72    hr_utility.set_location('Leaving:'||l_proc, 15);
73    --
74 End chk_duplicate_ordr_num;
75 --
76 -- ----------------------------------------------------------------------------
77 -- |--------------------< chk_dup_pl_typ_id_in_pgm>---------------------|
78 -- ----------------------------------------------------------------------------
79 --
80 -- Description
81 --   This procedure checks whether one pl_typ_Id is associated
82 --   to a program id once
83 --
84 -- Pre Conditions
85 --   None.
86 --
87 -- In Parameters
88 --   p_pl_typ_id    Plan  Type Id
89 --   p_pgm_id   Program Id
90 --   p_effective_date   effective_date
91 --   p_business_group_id  business_group_id
92 --   p_ptip_id            PK of record being inserted ot updated
93 --
94 -- Post Success
95 --   Processing continues
96 --
97 -- Post Failure
98 --   Errors handled by the procedure
99 --
100 -- Access Status
101 --   Internal table handler use only.
102 --
103 -- ----------------------------------------------------------------------------
104 Procedure chk_dup_pl_typ_id_in_pgm(p_pl_typ_id            in number
105                                        ,p_effective_date    in date
106                                        ,p_business_group_id in number
107                                        ,p_pgm_id            in number
108                                        ,p_ptip_id            in number
109                                        ,p_validation_start_date  in date
110                                        ,p_validation_end_date    in date)
111 is
112 l_proc	    varchar2(72) := g_package||' chk_dup_pl_typ_id_in_pgm ';
113 l_dummy   char(1);
114 cursor c1 is select null
115              from   ben_ptip_f
116              where  pgm_id = p_pgm_id
117              and    business_group_id + 0 = p_business_group_id
118              and    pl_typ_id = p_pl_typ_id
119              and    ptip_id <> nvl(p_ptip_id, -1)
120              and    p_validation_start_date <= effective_end_date
121              and    p_validation_end_date >= effective_start_date;
122 --
123 Begin
124   hr_utility.set_location('Entering:'||l_proc, 5);
125       open c1;
126       fetch c1 into l_dummy;
127       if c1%found then
128           fnd_message.set_name('BEN','BEN_91722_DUP_PL_TYP_ID_IN_PGM');
129           fnd_message.raise_error;
130       end if;
131       close c1;
132   hr_utility.set_location('Leaving:'||l_proc, 15);
133 End chk_dup_pl_typ_id_in_pgm;
134 --
135 -- ----------------------------------------------------------------------------
136 -- |------< chk_pl_typ_waivable >------|
137 -- ----------------------------------------------------------------------------
138 --
139 -- Description
140 --     ensure that if WVBL_FLAG = 'Y' then all Plans in Program must be waivable
141 --
142 -- Pre Conditions
143 --   None.
144 --
145 -- In Parameters
146 --      p_wvbl_flag
147 --      p_pgm_id
148 --      p_business_group_id
149 --      p_effective_date
150 --
151 -- Post Success
152 --   Processing continues
153 --
154 -- Post Failure
155 --   Errors handled by the procedure
156 --
157 -- Access Status
158 --   Internal table handler use only.
159 --
160 -- ----------------------------------------------------------------------------
161 Procedure chk_pl_typ_waivable
162           ( p_ptip_id in number,
163             p_wvbl_flag in varchar2
164            ,p_pgm_id in number
165            ,p_business_group_id in number
166            ,p_effective_date in date
167            ,p_object_version_number in number)
168 is
169    l_proc   varchar2(72) := g_package||' chk_pl_typ_waivable ';
170    l_dummy   char(1);
171    l_api_updating boolean;
172    --
173    cursor c1 is select null
174                   from ben_plip_f plip, ben_pl_f pl
175                   where plip.pgm_id = p_pgm_id
176                     and plip.pl_id = pl.pl_id
177                     and pl.wvbl_flag <> 'Y'
178                     and plip.business_group_id +0 = p_business_group_id
179                     and p_effective_date between plip.effective_start_date
180                                              and plip.effective_end_date;
181 --
182 Begin
183    --
184   hr_utility.set_location('Entering:'||l_proc, 5);
185   --
186   l_api_updating := ben_ctp_shd.api_updating
187     (p_ptip_id                     => p_ptip_id,
188      p_effective_date              => p_effective_date,
189      p_object_version_number       => p_object_version_number);
190   --
191   if (l_api_updating
192       and p_wvbl_flag
193       <> nvl(ben_ctp_shd.g_old_rec.wvbl_flag,hr_api.g_varchar2)
194       or not l_api_updating) then
195 
196     if p_wvbl_flag = 'Y' then
197        open c1;
198        fetch c1 into l_dummy;
199        if c1%found then
200            close c1;
201            fnd_message.set_name('BEN','BEN_92139_PLAN_MUST_B_WAIVABLE');
202            fnd_message.raise_error;
203        end if;
204        close c1;
205     end if;
206   --
207   end if;
208   --
209   hr_utility.set_location('Leaving:'||l_proc, 15);
210 End chk_pl_typ_waivable;
211 --
212 -- ----------------------------------------------------------------------------
213 -- |------< chk_date_dpndcy >------|
214 -- ----------------------------------------------------------------------------
215 --
216 -- Description
217 --   This procedure is used to check the code/rule dependency as following:
218 --             If code = 'Rule' then rule must be selected.
219 --             If code <> 'Rule' then code must not be selected.
220 --
221 -- Pre Conditions
222 --   None.
223 --
224 -- In Parameters
225 --   ptip_id PK of record being inserted or updated.
226 --   dt_cd Value of lookup code.
227 --   dt_rl
228 --   effective_date effective date
229 --   object_version_number Object version number of record being
230 --                         inserted or updated.
231 --
232 -- Post Success
233 --   Processing continues
234 --
235 -- Post Failure
236 --   Error handled by procedure
237 --
238 -- Access Status
239 --   Internal table handler use only.
240 --
241 Procedure chk_date_dpndcy(  p_ptip_id               in number,
242                             p_dt_cd             in varchar2,
243                             p_old_dt_cd         in varchar2,
244                             p_dt_rl             in number,
245                             p_old_dt_rl         in number,
246                             p_effective_date                  in date,
247                             p_object_version_number           in number) is
248   --
249   l_proc         varchar2(72) := g_package||'chk_date_dpndcy ';
250   l_api_updating boolean;
251   --
252 Begin
253   --
254   hr_utility.set_location('Entering:'||l_proc, 5);
255   --
256   l_api_updating := ben_ctp_shd.api_updating
257     (p_ptip_id                     => p_ptip_id,
258      p_effective_date              => p_effective_date,
259      p_object_version_number       => p_object_version_number);
260   --
261   if (l_api_updating
262       and
263          (nvl(p_dt_cd,hr_api.g_varchar2)
264                <> nvl(p_old_dt_cd,hr_api.g_varchar2)
265           or
266           nvl(p_dt_rl,hr_api.g_number)
267                <> nvl(p_old_dt_rl,hr_api.g_number))
268       or not l_api_updating) then
269     --
270     if (p_dt_cd = 'RL' and p_dt_rl is null) then
271              --
272              fnd_message.set_name('BEN','BEN_91380_DPNT_CVG_ST_DT_1');
273              fnd_message.raise_error;
274              --
275     end if;
276     --
277     if nvl(p_dt_cd,hr_api.g_varchar2) <> 'RL'
278        and p_dt_rl is not null then
279              --
280              fnd_message.set_name('BEN','BEN_91381_DPNT_CVG_ST_DT_2');
281              fnd_message.raise_error;
282              --
283     end if;
284     --
285   end if;
286   --
287   hr_utility.set_location('Leaving:'||l_proc,10);
288   --
289 end chk_date_dpndcy;
290 --
291 -- ----------------------------------------------------------------------------
292 -- |------------------------< chk_plan_typ_temporal >-------------------------|
293 -- ----------------------------------------------------------------------------
294 --
295 -- Description
296 --
297 -- Pre Conditions
298 --   None.
299 --
300 -- In Parameters
301 --   p_pl_id
302 --   p_effective_date
303 --   p_business_group_id
304 --   p_pgm_id
305 --
306 -- Post Success
307 --   Processing continues
308 --
309 -- Post Failure
310 --   Errors handled by the procedure
311 --
312 -- Access Status
313 --   Internal table handler use only.
314 --
315 -- ----------------------------------------------------------------------------
316 /*
317 Procedure chk_plan_typ_temporal
318           ( p_pl_typ_id in number
319            ,p_effective_date in date
320            ,p_business_group_id in number
321            ,p_pgm_id in number)
322 is
323    l_proc   varchar2(72) := g_package||' chk_plan_typ_temporal ';
324    l_dummy   char(1);
325    cursor c1 is select null
326                   from  ben_pl_typ_f
327                  where pl_typ_id = p_pl_typ_id
328                    and p_effective_date between effective_start_date
329                                             and effective_end_date
330                    and business_group_id + 0 = p_business_group_id
331                    and TMPRL_FCTR_APLS_RTS_FLAG = 'Y';
332    cursor c2 is select null
333                   from ben_pgm_f
334                  where pgm_id = p_pgm_id
335                    and p_effective_date between effective_start_date
336                                             and effective_end_date
337                    and business_group_id + 0 = p_business_group_id
338                    and TMPRL_FCTR_APLS_RTS_FLAG = 'Y';
339 --
340 Begin
341   hr_utility.set_location('Entering:'||l_proc, 5);
342   --
343   open c1;
344   fetch c1 into l_dummy;
345   if c1%found then
346       open c2;
347       fetch c2 into l_dummy;
348       if c2%notfound then
349           fnd_message.set_name('PAY','needs a message');
350           fnd_message.raise_error;
351       end if;
352       close c2;
353   end if;
354   close c1;
355   --
356   hr_utility.set_location('Leaving:'||l_proc, 15);
357 End chk_plan_typ_temporal;
358 */
359 --
360 -- ----------------------------------------------------------------------------
361 -- |------< chk_ptip_id >------|
362 -- ----------------------------------------------------------------------------
363 --
364 -- Description
365 --   This procedure is used to check that the primary key for the table
366 --   is created properly. It should be null on insert and
367 --   should not be able to be updated.
368 --
369 -- Pre Conditions
370 --   None.
371 --
372 -- In Parameters
373 --   ptip_id PK of record being inserted or updated.
374 --   effective_date Effective Date of session
375 --   object_version_number Object version number of record being
376 --                         inserted or updated.
377 --
378 -- Post Success
379 --   Processing continues
380 --
381 -- Post Failure
382 --   Errors handled by the procedure
383 --
384 -- Access Status
385 --   Internal table handler use only.
386 --
387 Procedure chk_ptip_id(p_ptip_id                in number,
388                            p_effective_date              in date,
389                            p_object_version_number       in number) is
390   --
391   l_proc         varchar2(72) := g_package||'chk_ptip_id';
392   l_api_updating boolean;
393   --
394 Begin
395   --
396   hr_utility.set_location('Entering:'||l_proc, 5);
397   --
398   l_api_updating := ben_ctp_shd.api_updating
399     (p_effective_date              => p_effective_date,
400      p_ptip_id                => p_ptip_id,
401      p_object_version_number       => p_object_version_number);
402   --
403   if (l_api_updating
404      and nvl(p_ptip_id,hr_api.g_number)
405      <>  ben_ctp_shd.g_old_rec.ptip_id) then
406     --
407     -- raise error as PK has changed
408     --
409     ben_ctp_shd.constraint_error('BEN_PTIP_PK');
410     --
411   elsif not l_api_updating then
412     --
413     -- check if PK is null
414     --
415     if p_ptip_id is not null then
416       --
417       -- raise error as PK is not null
418       --
419       ben_ctp_shd.constraint_error('BEN_PTIP_PK');
420       --
421     end if;
422     --
423   end if;
424   --
425   hr_utility.set_location('Leaving:'||l_proc, 10);
426   --
427 End chk_ptip_id;
428 --
429 -- ----------------------------------------------------------------------------
430 -- |------< chk_rqd_enrt_perd_tco_cd >------|
431 -- ----------------------------------------------------------------------------
432 --
433 -- Description
434 --   This procedure is used to check that the lookup value is valid.
435 --
436 -- Pre Conditions
437 --   None.
438 --
439 -- In Parameters
440 --   ptip_id PK of record being inserted or updated.
441 --   rqd_enrt_perd_tco_cd Value of lookup code.
442 --   effective_date effective date
443 --   object_version_number Object version number of record being
444 --                         inserted or updated.
445 --
446 -- Post Success
447 --   Processing continues
448 --
449 -- Post Failure
450 --   Error handled by procedure
451 --
452 -- Access Status
453 --   Internal table handler use only.
454 --
455 Procedure chk_rqd_enrt_perd_tco_cd(p_ptip_id                in number,
456                             p_rqd_enrt_perd_tco_cd               in varchar2,
457                             p_effective_date              in date,
458                             p_object_version_number       in number) is
459   --
460   l_proc         varchar2(72) := g_package||'chk_rqd_enrt_perd_tco_cd';
461   l_api_updating boolean;
462   --
463 Begin
464   --
465   hr_utility.set_location('Entering:'||l_proc, 5);
466   --
467   l_api_updating := ben_ctp_shd.api_updating
468     (p_ptip_id                => p_ptip_id,
469      p_effective_date              => p_effective_date,
470      p_object_version_number       => p_object_version_number);
471   --
472   if (l_api_updating
473       and p_rqd_enrt_perd_tco_cd
474       <> nvl(ben_ctp_shd.g_old_rec.rqd_enrt_perd_tco_cd,hr_api.g_varchar2)
475       or not l_api_updating)
476       and p_rqd_enrt_perd_tco_cd is not null then
477     --
478     -- check if value of lookup falls within lookup type.
479     --
480     if hr_api.not_exists_in_hr_lookups
481           (p_lookup_type    => 'BEN_RQD_ENRT_PERD_TCO',
482            p_lookup_code    => p_rqd_enrt_perd_tco_cd,
483            p_effective_date => p_effective_date) then
484       --
485       -- raise error as does not exist as lookup
486       --
487       fnd_message.set_name('BEN','BEN_91225_INV_RQD_ENRT_PERD_CD');
488       fnd_message.raise_error;
489       --
490     end if;
491     --
492   end if;
493   --
494   hr_utility.set_location('Leaving:'||l_proc,10);
495   --
496 end chk_rqd_enrt_perd_tco_cd;
497 --
498 --
499 Procedure chk_vrfy_fmly_mmbr_cd(p_ptip_id                     in number,
500                                 p_vrfy_fmly_mmbr_cd           in varchar2,
501                                 p_effective_date              in date,
502                                 p_object_version_number       in number) is
503   --
504   l_proc         varchar2(72) := g_package||'chk_vrfy_fmly_mmbr_cd';
505   l_api_updating boolean;
506   --
507 Begin
508   --
509   hr_utility.set_location('Entering:'||l_proc, 5);
510   --
511   l_api_updating := ben_ctp_shd.api_updating
512     (p_ptip_id                     => p_ptip_id,
513      p_effective_date              => p_effective_date,
514      p_object_version_number       => p_object_version_number);
515   --
516   if (l_api_updating
517       and p_vrfy_fmly_mmbr_cd
518       <> nvl(ben_ctp_shd.g_old_rec.vrfy_fmly_mmbr_cd,hr_api.g_varchar2)
519       or not l_api_updating)
520      and p_vrfy_fmly_mmbr_cd is not null
521   then
522     --
523     -- check if value of lookup falls within lookup type.
524     --
525 
526     if hr_api.not_exists_in_hr_lookups
527           (p_lookup_type    => 'BEN_FMLY_MMBR',
528            p_lookup_code    => p_vrfy_fmly_mmbr_cd,
529            p_effective_date => p_effective_date) then
530       --
531       -- raise error as does not exist as lookup
532       --
533       --
534       fnd_message.set_name('BEN','BEN_91628_LOOKUP_TYPE_GENERIC');
535       fnd_message.set_token('FIELD', 'p_vrfy_fmly_mmbr_cd');
536       fnd_message.set_token('TYPE','BEN_FMLY_MMBR');
537       fnd_message.raise_error;
538       --
539     end if;
540     --
541   end if;
542   --
543   hr_utility.set_location('Leaving:'||l_proc,10);
544   --
545 end chk_vrfy_fmly_mmbr_cd;
546 --
547 --
548 --
549 --
550 --
551 Procedure chk_vrfy_fmly_mmbr_rl
552   (p_ptip_id   in number
553   ,p_vrfy_fmly_mmbr_rl     in number
554   ,p_business_group_id     in number
555   ,p_effective_date        in date
556   ,p_object_version_number in number)
557 is
558   --
559   l_proc         varchar2(72) := g_package||'chk_vrfy_fmly_mmbr_rl';
560   l_api_updating boolean;
561   --
562 Begin
563   --
564   hr_utility.set_location('Entering:'||l_proc, 5);
565   --
566   l_api_updating := ben_ctp_shd.api_updating
567     (p_effective_date              => p_effective_date,
568      p_ptip_id                     => p_ptip_id,
569      p_object_version_number       => p_object_version_number);
570   --
571   if (l_api_updating
572       and nvl(p_vrfy_fmly_mmbr_rl,hr_api.g_number)
573       <> ben_ctp_shd.g_old_rec.vrfy_fmly_mmbr_rl
574       or not l_api_updating)
575       and p_vrfy_fmly_mmbr_rl is not null then
576     --
577     -- check if value of formula rule is valid.
578     --
579     if not benutils.formula_exists
580        (p_formula_id        => p_vrfy_fmly_mmbr_rl,
581         p_formula_type_id   => -21,
582         p_business_group_id => p_business_group_id,
583         p_effective_date    => p_effective_date) then
584       --
585       -- raise error
586       --
587       --
588       fnd_message.set_name('BEN','BEN_91471_FORMULA_NOT_FOUND');
589       fnd_message.set_token('ID',p_vrfy_fmly_mmbr_rl);
590       fnd_message.set_token('TYPE_ID',-21);
591       fnd_message.raise_error;
592       --
593     end if;
594     --
595   end if;
596   --
597   hr_utility.set_location('Leaving:'||l_proc,10);
598   --
599 end chk_vrfy_fmly_mmbr_rl;
600 --
601 
602 
603 --
604 
605 -- ----------------------------------------------------------------------------
606 -- |------< chk_no_mn_pl_typ_overid_flag >------|
607 -- ----------------------------------------------------------------------------
608 --
609 -- Description
610 --   This procedure is used to check that the lookup value is valid.
611 --
612 -- Pre Conditions
613 --   None.
614 --
615 -- In Parameters
616 --   ptip_id PK of record being inserted or updated.
617 --   no_mn_pl_typ_overid_flag Value of lookup code.
618 --   effective_date effective date
619 --   object_version_number Object version number of record being
620 --                         inserted or updated.
621 --
622 -- Post Success
623 --   Processing continues
624 --
625 -- Post Failure
626 --   Error handled by procedure
627 --
628 -- Access Status
629 --   Internal table handler use only.
630 --
631 Procedure chk_no_mn_pl_typ_overid_flag(p_ptip_id                in number,
632                             p_no_mn_pl_typ_overid_flag               in varchar2,
633                             p_effective_date              in date,
634                             p_object_version_number       in number) is
635   --
636   l_proc         varchar2(72) := g_package||'chk_no_mn_pl_typ_overid_flag';
637   l_api_updating boolean;
638   --
639 Begin
640   --
641   hr_utility.set_location('Entering:'||l_proc, 5);
642   --
643   l_api_updating := ben_ctp_shd.api_updating
644     (p_ptip_id                => p_ptip_id,
645      p_effective_date              => p_effective_date,
646      p_object_version_number       => p_object_version_number);
647   --
648   if (l_api_updating
649       and p_no_mn_pl_typ_overid_flag
650       <> nvl(ben_ctp_shd.g_old_rec.no_mn_pl_typ_overid_flag,hr_api.g_varchar2)
651       or not l_api_updating)
652       and p_no_mn_pl_typ_overid_flag is not null then
653     --
654     -- check if value of lookup falls within lookup type.
655     --
656     if hr_api.not_exists_in_hr_lookups
657           (p_lookup_type    => 'YES_NO',
658            p_lookup_code    => p_no_mn_pl_typ_overid_flag,
659            p_effective_date => p_effective_date) then
660       --
661       -- raise error as does not exist as lookup
662       --
663       fnd_message.set_name('BEN','BEN_91226_INV_NO_MIN_PT_OR_FLG');
664       fnd_message.raise_error;
665       --
666     end if;
667     --
668   end if;
669   --
670   hr_utility.set_location('Leaving:'||l_proc,10);
671   --
672 end chk_no_mn_pl_typ_overid_flag;
673 --
674 -- ----------------------------------------------------------------------------
675 -- |------------------< chk_drvbl_fctr_apls_rts_flag >------------------------|
676 -- ----------------------------------------------------------------------------
677 --
678 -- Description
679 --   This procedure is used to check that the lookup value is valid.
680 --
681 -- Pre Conditions
682 --   None.
683 --
684 -- In Parameters
685 --   ptip_id PK of record being inserted or updated.
686 --   drvbl_fctr_apls_rts_flag Value of lookup code.
687 --   effective_date effective date
688 --   object_version_number Object version number of record being
689 --                         inserted or updated.
690 --
691 -- Post Success
692 --   Processing continues
693 --
694 -- Post Failure
695 --   Error handled by procedure
696 --
697 -- Access Status
698 --   Internal table handler use only.
699 --
700 Procedure chk_drvbl_fctr_apls_rts_flag(p_ptip_id                   in number,
701                                        p_drvbl_fctr_apls_rts_flag  in varchar2,
702                                        p_effective_date            in date,
703                                        p_object_version_number     in number) is
704   --
705   l_proc         varchar2(72) := g_package||'chk_drvbl_fctr_apls_rts_flag';
706   l_api_updating boolean;
707   --
708 Begin
709   --
710   hr_utility.set_location('Entering:'||l_proc, 5);
711   --
712   l_api_updating := ben_ctp_shd.api_updating
713     (p_ptip_id                => p_ptip_id,
714      p_effective_date              => p_effective_date,
715      p_object_version_number       => p_object_version_number);
716   --
717   if (l_api_updating
718       and p_drvbl_fctr_apls_rts_flag
719       <> nvl(ben_ctp_shd.g_old_rec.drvbl_fctr_apls_rts_flag,hr_api.g_varchar2)
720       or not l_api_updating)
721       and p_drvbl_fctr_apls_rts_flag is not null then
722     --
723     -- check if value of lookup falls within lookup type.
724     --
725     if hr_api.not_exists_in_hr_lookups
726           (p_lookup_type    => 'YES_NO',
727            p_lookup_code    => p_drvbl_fctr_apls_rts_flag,
728            p_effective_date => p_effective_date) then
729       --
730       -- raise error as does not exist as lookup
731       --
732       fnd_message.set_name('BEN','BEN_91628_LOOKUP_TYPE_GENERIC');
733       fnd_message.set_token('FIELD', 'p_drvbl_fctr_apls_rts_flag');
734       fnd_message.set_token('TYPE', 'YES_NO');
735       fnd_message.raise_error;
736       --
737     end if;
738     --
739   end if;
740   --
741   hr_utility.set_location('Leaving:'||l_proc,10);
742   --
743 end chk_drvbl_fctr_apls_rts_flag;
744 --
745 -- ----------------------------------------------------------------------------
746 -- |------------------< chk_drvbl_fctr_prtn_elig_flag >----------------------|
747 -- ----------------------------------------------------------------------------
748 --
749 -- Description
750 --   This procedure is used to check that the lookup value is valid.
751 --
752 -- Pre Conditions
753 --   None.
754 --
755 -- In Parameters
756 --   ptip_id PK of record being inserted or updated.
757 --   drvbl_fctr_prtn_elig_flag Value of lookup code.
758 --   effective_date effective date
759 --   object_version_number Object version number of record being
760 --                         inserted or updated.
761 --
762 -- Post Success
763 --   Processing continues
764 --
765 -- Post Failure
766 --   Error handled by procedure
767 --
768 -- Access Status
769 --   Internal table handler use only.
770 --
771 Procedure chk_drvbl_fctr_prtn_elig_flag(p_ptip_id                   in number,
772                                        p_drvbl_fctr_prtn_elig_flag  in varchar2,
773                                        p_effective_date            in date,
774                                        p_object_version_number     in number) is
775   --
776   l_proc         varchar2(72) := g_package||'chk_drvbl_fctr_prtn_elig_flag';
777   l_api_updating boolean;
778   --
779 Begin
780   --
781   hr_utility.set_location('Entering:'||l_proc, 5);
782   --
783   l_api_updating := ben_ctp_shd.api_updating
784     (p_ptip_id                => p_ptip_id,
785      p_effective_date              => p_effective_date,
786      p_object_version_number       => p_object_version_number);
787   --
788   if (l_api_updating
789       and p_drvbl_fctr_prtn_elig_flag
790       <> nvl(ben_ctp_shd.g_old_rec.drvbl_fctr_prtn_elig_flag,hr_api.g_varchar2)
791       or not l_api_updating)
792       and p_drvbl_fctr_prtn_elig_flag is not null then
793     --
794     -- check if value of lookup falls within lookup type.
795     --
796     if hr_api.not_exists_in_hr_lookups
797           (p_lookup_type    => 'YES_NO',
798            p_lookup_code    => p_drvbl_fctr_prtn_elig_flag,
799            p_effective_date => p_effective_date) then
800       --
801       -- raise error as does not exist as lookup
802       --
803       fnd_message.set_name('BEN','BEN_91628_LOOKUP_TYPE_GENERIC');
804       fnd_message.set_token('FIELD', 'p_drvbl_fctr_prtn_elig_flag');
805       fnd_message.set_token('TYPE', 'YES_NO');
806       fnd_message.raise_error;
807       --
808     end if;
809     --
810   end if;
811   --
812   hr_utility.set_location('Leaving:'||l_proc,10);
813   --
814 end chk_drvbl_fctr_prtn_elig_flag;
815 --
816 
817 -- --------------------------------chk_cd_rl_combination >-------------------------------|
818 -- ----------------------------------------------------------------------------
819 --
820 -- Description
821 --   This procedure is used to check the code is RULE then the rule must be
822 --   defined else it should not be.
823 --
824 -- Pre Conditions
825 --   None.
826 --
827 -- In Parameters
828 --   p_vrfy_fmly_mmbr_cd         in varchar2,
829 --   p_vrfy_fmly_mmbr_rl         in number
830 --
831 -- Post Success
832 --   Processing continues
833 --
834 -- Post Failure
835 --   Error handled by procedure
836 --
837 -- Access Status
838 --   Internal table handler use only.
839 --
840 procedure chk_cd_rl_combination
841 (
842     p_vrfy_fmly_mmbr_cd     in varchar2,
843     p_vrfy_fmly_mmbr_rl     in number ) IS
844    l_proc         varchar2(72) := g_package||'chk_cd_rl_combination';
845 BEGIN
846   hr_utility.set_location('Entering:'||l_proc, 5);
847   --
848   if    ( p_vrfy_fmly_mmbr_cd <> 'RL' and  p_vrfy_fmly_mmbr_rl is not null)
849   then
850                 fnd_message.set_name('BEN','BEN_91730_NO_RULE');
851                 fnd_message.raise_error;
852   end if;
853 
854   if ( p_vrfy_fmly_mmbr_cd = 'RL' and p_vrfy_fmly_mmbr_rl is null)
855   then
856                 fnd_message.set_name('BEN','BEN_91731_RULE');
857                 fnd_message.raise_error;
858   end if;
859   --
860 --leaving Procedure.
861   --
862   hr_utility.set_location('Leaving:'||l_proc,10);
863   --
864 end chk_cd_rl_combination;
865 
866 --
867 -- ----------------------------------------------------------------------------
868 -- |------------------< chk_elig_apls_flag >----------------------|
869 -- ----------------------------------------------------------------------------
870 --
871 -- Description
872 --   This procedure is used to check that the lookup value is valid.
873 --
874 -- Pre Conditions
875 --   None.
876 --
877 -- In Parameters
878 --   ptip_id PK of record being inserted or updated.
879 --   elig_apls_flag Value of lookup code.
880 --   effective_date effective date
881 --   object_version_number Object version number of record being
882 --                         inserted or updated.
883 --
884 -- Post Success
885 --   Processing continues
886 --
887 -- Post Failure
888 --   Error handled by procedure
889 --
890 -- Access Status
891 --   Internal table handler use only.
892 --
893 Procedure chk_elig_apls_flag(p_ptip_id                   in number,
894                              p_elig_apls_flag            in varchar2,
895                              p_effective_date            in date,
896                              p_object_version_number     in number) is
897   --
898   l_proc         varchar2(72) := g_package||'chk_elig_apls_flag';
899   l_api_updating boolean;
900   --
901 Begin
902   --
903   hr_utility.set_location('Entering:'||l_proc, 5);
904   --
905   l_api_updating := ben_ctp_shd.api_updating
906     (p_ptip_id                     => p_ptip_id,
907      p_effective_date              => p_effective_date,
908      p_object_version_number       => p_object_version_number);
909   --
910   if (l_api_updating
911       and p_elig_apls_flag
912       <> nvl(ben_ctp_shd.g_old_rec.elig_apls_flag,hr_api.g_varchar2)
913       or not l_api_updating)
914       and p_elig_apls_flag is not null then
915     --
916     -- check if value of lookup falls within lookup type.
917     --
918     if hr_api.not_exists_in_hr_lookups
919           (p_lookup_type    => 'YES_NO',
920            p_lookup_code    => p_elig_apls_flag,
921            p_effective_date => p_effective_date) then
922       --
923       -- raise error as does not exist as lookup
924       --
925       fnd_message.set_name('BEN','BEN_91628_LOOKUP_TYPE_GENERIC');
926       fnd_message.set_token('FIELD', 'p_elig_apls_flag');
927       fnd_message.set_token('TYPE', 'YES_NO');
928       fnd_message.raise_error;
929       --
930     end if;
931     --
932   end if;
933   --
934   hr_utility.set_location('Leaving:'||l_proc,10);
935   --
936 end chk_elig_apls_flag;
937 --
938 -- ----------------------------------------------------------------------------
939 -- |------------------< chk_prtn_elig_ovrid_alwd_flag >----------------------|
940 -- ----------------------------------------------------------------------------
941 --
942 -- Description
943 --   This procedure is used to check that the lookup value is valid.
944 --
945 -- Pre Conditions
946 --   None.
947 --
948 -- In Parameters
949 --   ptip_id PK of record being inserted or updated.
950 --   prtn_elig_ovrid_alwd_flag Value of lookup code.
951 --   effective_date effective date
952 --   object_version_number Object version number of record being
953 --                         inserted or updated.
954 --
955 -- Post Success
956 --   Processing continues
957 --
958 -- Post Failure
959 --   Error handled by procedure
960 --
961 -- Access Status
962 --   Internal table handler use only.
963 --
964 Procedure chk_prtn_elig_ovrid_alwd_flag(p_ptip_id                   in number,
965                                         p_prtn_elig_ovrid_alwd_flag in varchar2,
966                                         p_effective_date            in date,
967                                         p_object_version_number     in number)
968   is
969   --
970   l_proc         varchar2(72) := g_package||'chk_prtn_elig_ovrid_alwd_flag';
971   l_api_updating boolean;
972   --
973 Begin
974   --
975   hr_utility.set_location('Entering:'||l_proc, 5);
976   --
977   l_api_updating := ben_ctp_shd.api_updating
978     (p_ptip_id                     => p_ptip_id,
979      p_effective_date              => p_effective_date,
980      p_object_version_number       => p_object_version_number);
981   --
982   if (l_api_updating
983       and p_prtn_elig_ovrid_alwd_flag
984       <> nvl(ben_ctp_shd.g_old_rec.prtn_elig_ovrid_alwd_flag,hr_api.g_varchar2)
985       or not l_api_updating)
986       and p_prtn_elig_ovrid_alwd_flag is not null then
987     --
988     -- check if value of lookup falls within lookup type.
989     --
990     if hr_api.not_exists_in_hr_lookups
991           (p_lookup_type    => 'YES_NO',
992            p_lookup_code    => p_prtn_elig_ovrid_alwd_flag,
993            p_effective_date => p_effective_date) then
994       --
995       -- raise error as does not exist as lookup
996       --
997       fnd_message.set_name('BEN','BEN_91628_LOOKUP_TYPE_GENERIC');
998       fnd_message.set_token('FIELD', 'p_prtn_elig_ovrid_alwd_flag');
999       fnd_message.set_token('TYPE', 'YES_NO');
1000       fnd_message.raise_error;
1001       --
1002     end if;
1003     --
1004   end if;
1005   --
1006   hr_utility.set_location('Leaving:'||l_proc,10);
1007   --
1008 end chk_prtn_elig_ovrid_alwd_flag;
1009 --
1010 -- ----------------------------------------------------------------------------
1011 -- |------------------< chk_trk_inelig_per_flag >----------------------|
1012 -- ----------------------------------------------------------------------------
1013 --
1014 -- Description
1015 --   This procedure is used to check that the lookup value is valid.
1016 --
1017 -- Pre Conditions
1018 --   None.
1019 --
1020 -- In Parameters
1021 --   ptip_id PK of record being inserted or updated.
1022 --   trk_inelig_per_flag Value of lookup code.
1023 --   effective_date effective date
1024 --   object_version_number Object version number of record being
1025 --                         inserted or updated.
1026 --
1027 -- Post Success
1028 --   Processing continues
1029 --
1030 -- Post Failure
1031 --   Error handled by procedure
1032 --
1033 -- Access Status
1034 --   Internal table handler use only.
1035 --
1036 Procedure chk_trk_inelig_per_flag(p_ptip_id                   in number,
1037                                   p_trk_inelig_per_flag       in varchar2,
1038                                   p_effective_date            in date,
1039                                   p_object_version_number     in number)
1040   is
1041   --
1042   l_proc         varchar2(72) := g_package||'chk_trk_inelig_per_flag';
1043   l_api_updating boolean;
1044   --
1045 Begin
1046   --
1047   hr_utility.set_location('Entering:'||l_proc, 5);
1048   --
1049   l_api_updating := ben_ctp_shd.api_updating
1050     (p_ptip_id                     => p_ptip_id,
1051      p_effective_date              => p_effective_date,
1052      p_object_version_number       => p_object_version_number);
1053   --
1054   if (l_api_updating
1055       and p_trk_inelig_per_flag
1056       <> nvl(ben_ctp_shd.g_old_rec.trk_inelig_per_flag,hr_api.g_varchar2)
1057       or not l_api_updating)
1058       and p_trk_inelig_per_flag is not null then
1059     --
1060     -- check if value of lookup falls within lookup type.
1061     --
1062     if hr_api.not_exists_in_hr_lookups
1063           (p_lookup_type    => 'YES_NO',
1064            p_lookup_code    => p_trk_inelig_per_flag,
1065            p_effective_date => p_effective_date) then
1066       --
1067       -- raise error as does not exist as lookup
1068       --
1069       fnd_message.set_name('BEN','BEN_91628_LOOKUP_TYPE_GENERIC');
1070       fnd_message.set_token('FIELD', 'p_trk_inelig_per_flag');
1071       fnd_message.set_token('TYPE', 'YES_NO');
1072       fnd_message.raise_error;
1073       --
1074     end if;
1075     --
1076   end if;
1077   --
1078   hr_utility.set_location('Leaving:'||l_proc,10);
1079   --
1080 end chk_trk_inelig_per_flag;
1081 --
1082 -- ----------------------------------------------------------------------------
1083 -- |------< chk_sbj_to_sps_lf_ins_mx_flag >------|
1084 -- ----------------------------------------------------------------------------
1085 --
1086 -- Description
1087 --   This procedure is used to check that the lookup value is valid.
1088 --
1089 -- Pre Conditions
1090 --   None.
1091 --
1092 -- In Parameters
1093 --   ptip_id PK of record being inserted or updated.
1094 --   sbj_to_sps_lf_ins_mx_flag Value of lookup code.
1095 --   effective_date effective date
1096 --   object_version_number Object version number of record being
1097 --                         inserted or updated.
1098 --
1099 -- Post Success
1100 --   Processing continues
1101 --
1102 -- Post Failure
1103 --   Error handled by procedure
1104 --
1105 -- Access Status
1106 --   Internal table handler use only.
1107 --
1108 Procedure chk_sbj_to_sps_lf_ins_mx_flag(p_ptip_id                in number,
1109                             p_sbj_to_sps_lf_ins_mx_flag               in varchar2,
1110                             p_effective_date              in date,
1111                             p_object_version_number       in number) is
1112   --
1113   l_proc         varchar2(72) := g_package||'chk_sbj_to_sps_lf_ins_mx_flag';
1114   l_api_updating boolean;
1115   --
1116 Begin
1117   --
1118   hr_utility.set_location('Entering:'||l_proc, 5);
1119   --
1120   l_api_updating := ben_ctp_shd.api_updating
1121     (p_ptip_id                => p_ptip_id,
1122      p_effective_date              => p_effective_date,
1123      p_object_version_number       => p_object_version_number);
1124   --
1125   if (l_api_updating
1126       and p_sbj_to_sps_lf_ins_mx_flag
1127       <> nvl(ben_ctp_shd.g_old_rec.sbj_to_sps_lf_ins_mx_flag,hr_api.g_varchar2)
1128       or not l_api_updating)
1129       and p_sbj_to_sps_lf_ins_mx_flag is not null then
1130     --
1131     -- check if value of lookup falls within lookup type.
1132     --
1133     if hr_api.not_exists_in_hr_lookups
1134           (p_lookup_type    => 'YES_NO',
1135            p_lookup_code    => p_sbj_to_sps_lf_ins_mx_flag,
1136            p_effective_date => p_effective_date) then
1137       --
1138       -- raise error as does not exist as lookup
1139       --
1140       fnd_message.set_name('BEN','BEN_91628_LOOKUP_TYPE_GENERIC');
1141       fnd_message.set_token('FIELD', 'p_sbj_to_sps_lf_ins_mx_flag');
1142       fnd_message.set_token('TYPE', 'YES_NO');
1143       fnd_message.raise_error;
1144       --
1145     end if;
1146     --
1147   end if;
1148   --
1149   hr_utility.set_location('Leaving:'||l_proc,10);
1150   --
1151 end chk_sbj_to_sps_lf_ins_mx_flag;
1152 --
1153 -- ----------------------------------------------------------------------------
1154 -- |------< chk_sbj_to_dpnt_lf_ins_mx_flag >------|
1155 -- ----------------------------------------------------------------------------
1156 --
1157 -- Description
1158 --   This procedure is used to check that the lookup value is valid.
1159 --
1160 -- Pre Conditions
1161 --   None.
1162 --
1163 -- In Parameters
1164 --   ptip_id PK of record being inserted or updated.
1165 --   sbj_to_dpnt_lf_ins_mx_flag Value of lookup code.
1166 --   effective_date effective date
1167 --   object_version_number Object version number of record being
1168 --                         inserted or updated.
1169 --
1170 -- Post Success
1171 --   Processing continues
1172 --
1173 -- Post Failure
1174 --   Error handled by procedure
1175 --
1176 -- Access Status
1177 --   Internal table handler use only.
1178 --
1179 Procedure chk_sbj_to_dpnt_lf_ins_mx_flag(p_ptip_id                in number,
1180                             p_sbj_to_dpnt_lf_ins_mx_flag               in varchar2,
1181                             p_effective_date              in date,
1182                             p_object_version_number       in number) is
1183   --
1184   l_proc         varchar2(72) := g_package||'chk_sbj_to_dpnt_lf_ins_mx_flag';
1185   l_api_updating boolean;
1186   --
1187 Begin
1188   --
1189   hr_utility.set_location('Entering:'||l_proc, 5);
1190   --
1191   l_api_updating := ben_ctp_shd.api_updating
1192     (p_ptip_id                => p_ptip_id,
1193      p_effective_date              => p_effective_date,
1194      p_object_version_number       => p_object_version_number);
1195   --
1196   if (l_api_updating
1197       and p_sbj_to_dpnt_lf_ins_mx_flag
1198       <> nvl(ben_ctp_shd.g_old_rec.sbj_to_dpnt_lf_ins_mx_flag,hr_api.g_varchar2)
1199       or not l_api_updating)
1200       and p_sbj_to_dpnt_lf_ins_mx_flag is not null then
1201     --
1202     -- check if value of lookup falls within lookup type.
1203     --
1204     if hr_api.not_exists_in_hr_lookups
1205           (p_lookup_type    => 'YES_NO',
1206            p_lookup_code    => p_sbj_to_dpnt_lf_ins_mx_flag,
1207            p_effective_date => p_effective_date) then
1208       --
1209       -- raise error as does not exist as lookup
1210       --
1211       fnd_message.set_name('BEN','BEN_91628_LOOKUP_TYPE_GENERIC');
1212       fnd_message.set_token('FIELD', 'p_sbj_to_dpnt_lf_ins_mx_flag');
1213       fnd_message.set_token('TYPE', 'YES_NO');
1214       fnd_message.raise_error;
1215       --
1216     end if;
1217     --
1218   end if;
1219   --
1220   hr_utility.set_location('Leaving:'||l_proc,10);
1221   --
1222 end chk_sbj_to_dpnt_lf_ins_mx_flag;
1223 --
1224 -- ----------------------------------------------------------------------------
1225 -- |------< chk_use_to_sum_ee_lf_ins_flag >------|
1226 -- ----------------------------------------------------------------------------
1227 --
1228 -- Description
1229 --   This procedure is used to check that the lookup value is valid.
1230 --
1231 -- Pre Conditions
1232 --   None.
1233 --
1234 -- In Parameters
1235 --   ptip_id PK of record being inserted or updated.
1236 --   use_to_sum_ee_lf_ins_flag Value of lookup code.
1237 --   effective_date effective date
1238 --   object_version_number Object version number of record being
1239 --                         inserted or updated.
1240 --
1241 -- Post Success
1242 --   Processing continues
1243 --
1244 -- Post Failure
1245 --   Error handled by procedure
1246 --
1247 -- Access Status
1248 --   Internal table handler use only.
1249 --
1250 Procedure chk_use_to_sum_ee_lf_ins_flag(p_ptip_id                in number,
1251                             p_use_to_sum_ee_lf_ins_flag               in varchar2,
1252                             p_effective_date              in date,
1253                             p_object_version_number       in number) is
1254   --
1255   l_proc         varchar2(72) := g_package||'chk_use_to_sum_ee_lf_ins_flag';
1256   l_api_updating boolean;
1257   --
1258 Begin
1259   --
1260   hr_utility.set_location('Entering:'||l_proc, 5);
1261   --
1262   l_api_updating := ben_ctp_shd.api_updating
1263     (p_ptip_id                => p_ptip_id,
1264      p_effective_date              => p_effective_date,
1265      p_object_version_number       => p_object_version_number);
1266   --
1267   if (l_api_updating
1268       and p_use_to_sum_ee_lf_ins_flag
1269       <> nvl(ben_ctp_shd.g_old_rec.use_to_sum_ee_lf_ins_flag,hr_api.g_varchar2)
1270       or not l_api_updating)
1271       and p_use_to_sum_ee_lf_ins_flag is not null then
1272     --
1273     -- check if value of lookup falls within lookup type.
1274     --
1275     if hr_api.not_exists_in_hr_lookups
1276           (p_lookup_type    => 'YES_NO',
1277            p_lookup_code    => p_use_to_sum_ee_lf_ins_flag,
1278            p_effective_date => p_effective_date) then
1279       --
1280       -- raise error as does not exist as lookup
1281       --
1282       fnd_message.set_name('BEN','BEN_91628_LOOKUP_TYPE_GENERIC');
1283       fnd_message.set_token('FIELD', 'p_use_to_sum_ee_lf_ins_flag');
1284       fnd_message.set_token('TYPE', 'YES_NO');
1285       fnd_message.raise_error;
1286       --
1287     end if;
1288     --
1289   end if;
1290   --
1291   hr_utility.set_location('Leaving:'||l_proc,10);
1292   --
1293 end chk_use_to_sum_ee_lf_ins_flag;
1294 --
1295 -- ----------------------------------------------------------------------------
1296 -- |------< chk_drvd_fctr_dpnt_cvg_flag >------|
1297 -- ----------------------------------------------------------------------------
1298 --
1299 -- Description
1300 --   This procedure is used to check that the lookup value is valid.
1301 --
1302 -- Pre Conditions
1303 --   None.
1304 --
1305 -- In Parameters
1306 --   ptip_id PK of record being inserted or updated.
1307 --   drvd_fctr_dpnt_cvg_flag Value of lookup code.
1308 --   effective_date effective date
1309 --   object_version_number Object version number of record being
1310 --                         inserted or updated.
1311 --
1312 -- Post Success
1313 --   Processing continues
1314 --
1315 -- Post Failure
1316 --   Error handled by procedure
1317 --
1318 -- Access Status
1319 --   Internal table handler use only.
1320 --
1321 Procedure chk_drvd_fctr_dpnt_cvg_flag(p_ptip_id                in number,
1322                             p_drvd_fctr_dpnt_cvg_flag               in varchar2,
1323                             p_effective_date              in date,
1324                             p_object_version_number       in number) is
1325   --
1326   l_proc         varchar2(72) := g_package||'chk_drvd_fctr_dpnt_cvg_flag';
1327   l_api_updating boolean;
1328   --
1329 Begin
1330   --
1331   hr_utility.set_location('Entering:'||l_proc, 5);
1332   --
1333   l_api_updating := ben_ctp_shd.api_updating
1334     (p_ptip_id                => p_ptip_id,
1335      p_effective_date              => p_effective_date,
1336      p_object_version_number       => p_object_version_number);
1337   --
1338   if (l_api_updating
1339       and p_drvd_fctr_dpnt_cvg_flag
1340       <> nvl(ben_ctp_shd.g_old_rec.drvd_fctr_dpnt_cvg_flag,hr_api.g_varchar2)
1341       or not l_api_updating)
1342       and p_drvd_fctr_dpnt_cvg_flag is not null then
1343     --
1344     -- check if value of lookup falls within lookup type.
1345     --
1346     if hr_api.not_exists_in_hr_lookups
1347           (p_lookup_type    => 'YES_NO',
1348            p_lookup_code    => p_drvd_fctr_dpnt_cvg_flag,
1349            p_effective_date => p_effective_date) then
1350       --
1351       -- raise error as does not exist as lookup
1352       --
1353       fnd_message.set_name('BEN','BEN_91228_INV_DRV_FCT_DPNT_FLG');
1354       fnd_message.raise_error;
1355       --
1356     end if;
1357     --
1358   end if;
1359   --
1360   hr_utility.set_location('Leaving:'||l_proc,10);
1361   --
1362 end chk_drvd_fctr_dpnt_cvg_flag;
1363 --
1364 -- ----------------------------------------------------------------------------
1365 -- |------< chk_dpnt_dob_rqd_flag >------|
1366 -- ----------------------------------------------------------------------------
1367 --
1368 -- Description
1369 --   This procedure is used to check that the lookup value is valid.
1370 --
1371 -- Pre Conditions
1372 --   None.
1373 --
1374 -- In Parameters
1375 --   ptip_id PK of record being inserted or updated.
1376 --   dpnt_dob_rqd_flag Value of lookup code.
1377 --   effective_date effective date
1378 --   object_version_number Object version number of record being
1379 --                         inserted or updated.
1380 --
1381 -- Post Success
1382 --   Processing continues
1383 --
1384 -- Post Failure
1385 --   Error handled by procedure
1386 --
1387 -- Access Status
1388 --   Internal table handler use only.
1389 --
1390 Procedure chk_dpnt_dob_rqd_flag(p_ptip_id                 in number,
1391                             p_dpnt_dob_rqd_flag           in varchar2,
1392                             p_effective_date              in date,
1393                             p_object_version_number       in number) is
1394   --
1395   l_proc         varchar2(72) := g_package||'chk_dpnt_dob_rqd_flag';
1396   l_api_updating boolean;
1397   --
1398 Begin
1399   --
1400   hr_utility.set_location('Entering:'||l_proc, 5);
1401   --
1402   l_api_updating := ben_ctp_shd.api_updating
1403     (p_ptip_id                => p_ptip_id,
1404      p_effective_date              => p_effective_date,
1405      p_object_version_number       => p_object_version_number);
1406   --
1407   if (l_api_updating
1408       and p_dpnt_dob_rqd_flag
1409       <> nvl(ben_ctp_shd.g_old_rec.dpnt_dob_rqd_flag,hr_api.g_varchar2)
1410       or not l_api_updating)
1411       and p_dpnt_dob_rqd_flag is not null then
1412     --
1413     -- check if value of lookup falls within lookup type.
1414     --
1415     if hr_api.not_exists_in_hr_lookups
1416           (p_lookup_type    => 'YES_NO',
1417            p_lookup_code    => p_dpnt_dob_rqd_flag,
1418            p_effective_date => p_effective_date) then
1419       --
1420       -- raise error as does not exist as lookup
1421       --
1422       fnd_message.set_name('BEN','BEN_91628_LOOKUP_TYPE_GENERIC');
1423       fnd_message.set_token('FIELD', 'p_dpnt_dob_rqd_flag');
1424       fnd_message.set_token('TYPE', 'YES_NO');
1425       fnd_message.raise_error;
1426       --
1427     end if;
1428     --
1429   end if;
1430   --
1431   hr_utility.set_location('Leaving:'||l_proc,10);
1432   --
1433 end chk_dpnt_dob_rqd_flag;
1434 --
1435 --
1436 -- ----------------------------------------------------------------------------
1437 -- |------< chk_dpnt_legv_id_rqd_flag >------|
1438 -- ----------------------------------------------------------------------------
1439 --
1440 -- Description
1441 --   This procedure is used to check that the lookup value is valid.
1442 --
1443 -- Pre Conditions
1444 --   None.
1445 --
1446 -- In Parameters
1447 --   ptip_id PK of record being inserted or updated.
1448 --   dpnt_legv_id_rqd_flag Value of lookup code.
1449 --   effective_date effective date
1450 --   object_version_number Object version number of record being
1451 --                         inserted or updated.
1452 --
1453 -- Post Success
1454 --   Processing continues
1455 --
1456 -- Post Failure
1457 --   Error handled by procedure
1458 --
1459 -- Access Status
1460 --   Internal table handler use only.
1461 --
1462 Procedure chk_dpnt_legv_id_rqd_flag(p_ptip_id             in number,
1463                             p_dpnt_legv_id_rqd_flag       in varchar2,
1464                             p_effective_date              in date,
1465                             p_object_version_number       in number) is
1466   --
1467   l_proc         varchar2(72) := g_package||'chk_dpnt_legv_id_rqd_flag';
1468   l_api_updating boolean;
1469   --
1470 Begin
1471   --
1472   hr_utility.set_location('Entering:'||l_proc, 5);
1473   --
1474   l_api_updating := ben_ctp_shd.api_updating
1475     (p_ptip_id                     => p_ptip_id,
1476      p_effective_date              => p_effective_date,
1477      p_object_version_number       => p_object_version_number);
1478   --
1479   if (l_api_updating
1480       and p_dpnt_legv_id_rqd_flag
1481       <> nvl(ben_ctp_shd.g_old_rec.dpnt_legv_id_rqd_flag,hr_api.g_varchar2)
1482       or not l_api_updating)
1483       and p_dpnt_legv_id_rqd_flag is not null then
1484     --
1485     -- check if value of lookup falls within lookup type.
1486     --
1487     if hr_api.not_exists_in_hr_lookups
1488           (p_lookup_type    => 'YES_NO',
1489            p_lookup_code    => p_dpnt_legv_id_rqd_flag,
1490            p_effective_date => p_effective_date) then
1491       --
1492       -- raise error as does not exist as lookup
1493       --
1494       fnd_message.set_name('BEN','BEN_91628_LOOKUP_TYPE_GENERIC');
1495       fnd_message.set_token('FIELD', 'p_dpnt_legv_id_rqd_flag');
1496       fnd_message.set_token('TYPE', 'YES_NO');
1497       fnd_message.raise_error;
1498       --
1499     end if;
1500     --
1501   end if;
1502   --
1503   hr_utility.set_location('Leaving:'||l_proc,10);
1504   --
1505 end chk_dpnt_legv_id_rqd_flag;
1506 --
1507 -- ----------------------------------------------------------------------------
1508 -- |------< chk_wvbl_flag >------|
1509 -- ----------------------------------------------------------------------------
1510 --
1511 -- Description
1512 --   This procedure is used to check that the lookup value is valid.
1513 --
1514 -- Pre Conditions
1515 --   None.
1516 --
1517 -- In Parameters
1518 --   ptip_id PK of record being inserted or updated.
1519 --   wvbl_flag Value of lookup code.
1520 --   effective_date effective date
1521 --   object_version_number Object version number of record being
1522 --                         inserted or updated.
1523 --
1524 -- Post Success
1525 --   Processing continues
1526 --
1527 -- Post Failure
1528 --   Error handled by procedure
1529 --
1530 -- Access Status
1531 --   Internal table handler use only.
1532 --
1533 Procedure chk_wvbl_flag(p_ptip_id                     in number,
1534                         p_wvbl_flag                   in varchar2,
1535                         p_effective_date              in date,
1536                         p_object_version_number       in number) is
1537   --
1538   l_proc         varchar2(72) := g_package||'chk_wvbl_flag';
1539   l_api_updating boolean;
1540   --
1541 Begin
1542   --
1543   hr_utility.set_location('Entering:'||l_proc, 5);
1544   --
1545   l_api_updating := ben_ctp_shd.api_updating
1546     (p_ptip_id                => p_ptip_id,
1547      p_effective_date              => p_effective_date,
1548      p_object_version_number       => p_object_version_number);
1549   --
1550   if (l_api_updating
1551       and p_wvbl_flag
1552       <> nvl(ben_ctp_shd.g_old_rec.wvbl_flag,hr_api.g_varchar2)
1553       or not l_api_updating)
1554       and p_wvbl_flag is not null then
1555     --
1556     -- check if value of lookup falls within lookup type.
1557     --
1558     if hr_api.not_exists_in_hr_lookups
1559           (p_lookup_type    => 'YES_NO',
1560            p_lookup_code    => p_wvbl_flag,
1561            p_effective_date => p_effective_date) then
1562       --
1563       -- raise error as does not exist as lookup
1564       --
1565       fnd_message.set_name('BEN','BEN_91229_INV_WVBL_FLAG');
1566       fnd_message.raise_error;
1567       --
1568     end if;
1569     --
1570   end if;
1571   --
1572   hr_utility.set_location('Leaving:'||l_proc,10);
1573   --
1574 end chk_wvbl_flag;
1575 --
1576 -- ----------------------------------------------------------------------------
1577 -- |------------------------< chk_dpnt_adrs_rqd_flag >------------------------|
1578 -- ----------------------------------------------------------------------------
1579 --
1580 -- Description
1581 --   This procedure is used to check that the lookup value is valid.
1582 --
1583 -- Pre Conditions
1584 --   None.
1585 --
1586 -- In Parameters
1587 --   ptip_id PK of record being inserted or updated.
1588 --   dpnt_adrs_rqd_flag Value of lookup code.
1589 --   effective_date effective date
1590 --   object_version_number Object version number of record being
1591 --                         inserted or updated.
1592 --
1593 -- Post Success
1594 --   Processing continues
1595 --
1596 -- Post Failure
1597 --   Error handled by procedure
1598 --
1599 -- Access Status
1600 --   Internal table handler use only.
1601 --
1602 Procedure chk_dpnt_adrs_rqd_flag(p_ptip_id                in number,
1603                             p_dpnt_adrs_rqd_flag          in varchar2,
1604                             p_effective_date              in date,
1605                             p_object_version_number       in number) is
1606   --
1607   l_proc         varchar2(72) := g_package||'chk_dpnt_adrs_rqd_flag';
1608   l_api_updating boolean;
1609   --
1610 Begin
1611   --
1612   hr_utility.set_location('Entering:'||l_proc, 5);
1613   --
1614   l_api_updating := ben_ctp_shd.api_updating
1615     (p_ptip_id                     => p_ptip_id,
1616      p_effective_date              => p_effective_date,
1617      p_object_version_number       => p_object_version_number);
1618   --
1619   if (l_api_updating
1620       and p_dpnt_adrs_rqd_flag
1621       <> nvl(ben_ctp_shd.g_old_rec.dpnt_adrs_rqd_flag,hr_api.g_varchar2)
1622       or not l_api_updating)
1623       and p_dpnt_adrs_rqd_flag is not null then
1624     --
1625     -- check if value of lookup falls within lookup type.
1626     --
1627     if hr_api.not_exists_in_hr_lookups
1628           (p_lookup_type    => 'YES_NO',
1629            p_lookup_code    => p_dpnt_adrs_rqd_flag,
1630            p_effective_date => p_effective_date) then
1631       --
1632       -- raise error as does not exist as lookup
1633       --
1634       fnd_message.set_name('BEN','BEN_91628_LOOKUP_TYPE_GENERIC');
1635       fnd_message.set_token('FIELD', 'p_dpnt_adrs_rqd_flag');
1636       fnd_message.set_token('TYPE', 'YES_NO');
1637       fnd_message.raise_error;
1638       --
1639     end if;
1640     --
1641   end if;
1642   --
1643   hr_utility.set_location('Leaving:'||l_proc,10);
1644   --
1645 end chk_dpnt_adrs_rqd_flag;
1646 --
1647 --
1648 -- ----------------------------------------------------------------------------
1649 -- |------------------------< chk_dpnt_cvg_no_ctfn_rqd_flag >------------------------|
1650 -- ----------------------------------------------------------------------------
1651 --
1652 -- Description
1653 --   This procedure is used to check that the lookup value is valid.
1654 --
1655 -- Pre Conditions
1656 --   None.
1657 --
1658 -- In Parameters
1659 --   ptip_id PK of record being inserted or updated.
1660 --   dpnt_cvg_no_ctfn_rqd_flag Value of lookup code.
1661 --   effective_date effective date
1662 --   object_version_number Object version number of record being
1663 --                         inserted or updated.
1664 --
1665 -- Post Success
1666 --   Processing continues
1667 --
1668 -- Post Failure
1669 --   Error handled by procedure
1670 --
1671 -- Access Status
1672 --   Internal table handler use only.
1673 --
1674 Procedure chk_dpnt_cvg_no_ctfn_rqd_flag(p_ptip_id         in number,
1675                             p_dpnt_cvg_no_ctfn_rqd_flag   in varchar2,
1676                             p_effective_date              in date,
1677                             p_object_version_number       in number) is
1678   --
1679   l_proc         varchar2(72) := g_package||'chk_dpnt_cvg_no_ctfn_rqd_flag';
1680   l_api_updating boolean;
1681   --
1682 Begin
1683   --
1684   hr_utility.set_location('Entering:'||l_proc, 5);
1685   --
1686   l_api_updating := ben_ctp_shd.api_updating
1687     (p_ptip_id                     => p_ptip_id,
1688      p_effective_date              => p_effective_date,
1689      p_object_version_number       => p_object_version_number);
1690   --
1691   if (l_api_updating
1692       and p_dpnt_cvg_no_ctfn_rqd_flag
1693       <> nvl(ben_ctp_shd.g_old_rec.dpnt_cvg_no_ctfn_rqd_flag,hr_api.g_varchar2)
1694       or not l_api_updating)
1695       and p_dpnt_cvg_no_ctfn_rqd_flag is not null then
1696     --
1697     -- check if value of lookup falls within lookup type.
1698     --
1699     if hr_api.not_exists_in_hr_lookups
1700           (p_lookup_type    => 'YES_NO',
1701            p_lookup_code    => p_dpnt_cvg_no_ctfn_rqd_flag,
1702            p_effective_date => p_effective_date) then
1703       --
1704       -- raise error as does not exist as lookup
1705       --
1706       fnd_message.set_name('BEN','BEN_91628_LOOKUP_TYPE_GENERIC');
1707       fnd_message.set_token('FIELD', 'p_dpnt_cvg_no_ctfn_rqd_flag');
1708       fnd_message.set_token('TYPE', 'YES_NO');
1709       fnd_message.raise_error;
1710       --
1711     end if;
1712     --
1713   end if;
1714   --
1715   hr_utility.set_location('Leaving:'||l_proc,10);
1716   --
1717 end chk_dpnt_cvg_no_ctfn_rqd_flag;
1718 --
1719 -- ----------------------------------------------------------------------------
1720 -- |------< chk_rqd_perd_enrt_nenrt_tm_uom >------|
1721 -- ----------------------------------------------------------------------------
1722 --
1723 -- Description
1724 --   This procedure is used to check that the lookup value is valid.
1725 --
1726 -- Pre Conditions
1727 --   None.
1728 --
1729 -- In Parameters
1730 --   ptip_id PK of record being inserted or updated.
1731 --   rqd_perd_enrt_nenrt_tm_uom Value of lookup code.
1732 --   effective_date effective date
1733 --   object_version_number Object version number of record being
1734 --                         inserted or updated.
1735 --
1736 -- Post Success
1737 --   Processing continues
1738 --
1739 -- Post Failure
1740 --   Error handled by procedure
1741 --
1742 -- Access Status
1743 --   Internal table handler use only.
1744 --
1745 Procedure chk_rqd_perd_enrt_nenrt_tm_uom(p_ptip_id        in number,
1746                             p_rqd_perd_enrt_nenrt_tm_uom  in varchar2,
1747                             p_effective_date              in date,
1748                             p_object_version_number       in number) is
1749   --
1750   l_proc         varchar2(72) := g_package||'chk_rqd_perd_enrt_nenrt_tm_uom';
1751   l_api_updating boolean;
1752   --
1753 Begin
1754   --
1755   hr_utility.set_location('Entering:'||l_proc, 5);
1756   --
1757   l_api_updating := ben_ctp_shd.api_updating
1758     (p_ptip_id                     => p_ptip_id,
1759      p_effective_date              => p_effective_date,
1760      p_object_version_number       => p_object_version_number);
1761   --
1762   if (l_api_updating
1763       and p_rqd_perd_enrt_nenrt_tm_uom
1764       <> nvl(ben_ctp_shd.g_old_rec.rqd_perd_enrt_nenrt_tm_uom,hr_api.g_varchar2)
1765       or not l_api_updating)
1766       and p_rqd_perd_enrt_nenrt_tm_uom is not null then
1767     --
1768     -- check if value of lookup falls within lookup type.
1769     --
1770     if hr_api.not_exists_in_hr_lookups
1771           (p_lookup_type    => 'BEN_RQD_PERD_ENRT_NENRT_TM_UOM',
1772            p_lookup_code    => p_rqd_perd_enrt_nenrt_tm_uom,
1773            p_effective_date => p_effective_date) then
1774       --
1775       -- raise error as does not exist as lookup
1776       --
1777       fnd_message.set_name('BEN','BEN_91230_INV_RQD_PRD_ENRT_UOM');
1778       fnd_message.raise_error;
1779       --
1780     end if;
1781     --
1782   end if;
1783   --
1784   hr_utility.set_location('Leaving:'||l_proc,10);
1785   --
1786 end chk_rqd_perd_enrt_nenrt_tm_uom;
1787 --
1788 -- ----------------------------------------------------------------------------
1789 -- |------< chk_prvds_cr_flag >------|
1790 -- ----------------------------------------------------------------------------
1791 --
1792 -- Description
1793 --   This procedure is used to check that the lookup value is valid.
1794 --
1795 -- Pre Conditions
1796 --   None.
1797 --
1798 -- In Parameters
1799 --   ptip_id PK of record being inserted or updated.
1800 --   prvds_cr_flag Value of lookup code.
1801 --   effective_date effective date
1802 --   object_version_number Object version number of record being
1803 --                         inserted or updated.
1804 --
1805 -- Post Success
1806 --   Processing continues
1807 --
1808 -- Post Failure
1809 --   Error handled by procedure
1810 --
1811 -- Access Status
1812 --   Internal table handler use only.
1813 --
1814 Procedure chk_prvds_cr_flag(p_ptip_id                     in number,
1815                             p_prvds_cr_flag               in varchar2,
1816                             p_effective_date              in date,
1817                             p_object_version_number       in number) is
1818   --
1819   l_proc         varchar2(72) := g_package||'chk_prvds_cr_flag';
1820   l_api_updating boolean;
1821   --
1822 Begin
1823   --
1824   hr_utility.set_location('Entering:'||l_proc, 5);
1825   --
1826   l_api_updating := ben_ctp_shd.api_updating
1827     (p_ptip_id                     => p_ptip_id,
1828      p_effective_date              => p_effective_date,
1829      p_object_version_number       => p_object_version_number);
1830   --
1831   if (l_api_updating
1832       and p_prvds_cr_flag
1833       <> nvl(ben_ctp_shd.g_old_rec.prvds_cr_flag,hr_api.g_varchar2)
1834       or not l_api_updating)
1835       and p_prvds_cr_flag is not null then
1836     --
1837     -- check if value of lookup falls within lookup type.
1838     --
1839     if hr_api.not_exists_in_hr_lookups
1840           (p_lookup_type    => 'YES_NO',
1841            p_lookup_code    => p_prvds_cr_flag,
1842            p_effective_date => p_effective_date) then
1843       --
1844       -- raise error as does not exist as lookup
1845       --
1846       fnd_message.set_name('BEN','BEN_91231_INV_PRVDS_CR_FLAG');
1847       fnd_message.raise_error;
1848       --
1849     end if;
1850     --
1851   end if;
1852   --
1853   hr_utility.set_location('Leaving:'||l_proc,10);
1854   --
1855 end chk_prvds_cr_flag;
1856 --
1857 -- ----------------------------------------------------------------------------
1858 -- |------< chk_no_mx_pl_typ_ovrid_flag >------|
1859 -- ----------------------------------------------------------------------------
1860 --
1861 -- Description
1862 --   This procedure is used to check that the lookup value is valid.
1863 --
1864 -- Pre Conditions
1865 --   None.
1866 --
1867 -- In Parameters
1868 --   ptip_id PK of record being inserted or updated.
1869 --   no_mx_pl_typ_ovrid_flag Value of lookup code.
1870 --   effective_date effective date
1871 --   object_version_number Object version number of record being
1872 --                         inserted or updated.
1873 --
1874 -- Post Success
1875 --   Processing continues
1876 --
1877 -- Post Failure
1878 --   Error handled by procedure
1879 --
1880 -- Access Status
1881 --   Internal table handler use only.
1882 --
1883 Procedure chk_no_mx_pl_typ_ovrid_flag(p_ptip_id           in number,
1884                             p_no_mx_pl_typ_ovrid_flag     in varchar2,
1885                             p_effective_date              in date,
1886                             p_object_version_number       in number) is
1887   --
1888   l_proc         varchar2(72) := g_package||'chk_no_mx_pl_typ_ovrid_flag';
1889   l_api_updating boolean;
1890   --
1891 Begin
1892   --
1893   hr_utility.set_location('Entering:'||l_proc, 5);
1894   --
1895   l_api_updating := ben_ctp_shd.api_updating
1896     (p_ptip_id                     => p_ptip_id,
1897      p_effective_date              => p_effective_date,
1898      p_object_version_number       => p_object_version_number);
1899   --
1900   if (l_api_updating
1901       and p_no_mx_pl_typ_ovrid_flag
1902       <> nvl(ben_ctp_shd.g_old_rec.no_mx_pl_typ_ovrid_flag,hr_api.g_varchar2)
1903       or not l_api_updating)
1904       and p_no_mx_pl_typ_ovrid_flag is not null then
1905     --
1906     -- check if value of lookup falls within lookup type.
1907     --
1908     if hr_api.not_exists_in_hr_lookups
1909           (p_lookup_type    => 'YES_NO',
1910            p_lookup_code    => p_no_mx_pl_typ_ovrid_flag,
1911            p_effective_date => p_effective_date) then
1912       --
1913       -- raise error as does not exist as lookup
1914       --
1915       fnd_message.set_name('BEN','BEN_91232_INV_NO_MAX_PT_OR_FLG');
1916       fnd_message.raise_error;
1917       --
1918     end if;
1919     --
1920   end if;
1921   --
1922   hr_utility.set_location('Leaving:'||l_proc,10);
1923   --
1924 end chk_no_mx_pl_typ_ovrid_flag;
1925 --
1926 -- ----------------------------------------------------------------------------
1927 -- |------< chk_ptip_stat_cd >------|
1928 -- ----------------------------------------------------------------------------
1929 --
1930 -- Description
1931 --   This procedure is used to check that the lookup value is valid.
1932 --
1933 -- Pre Conditions
1934 --   None.
1935 --
1936 -- In Parameters
1937 --   ptip_id PK of record being inserted or updated.
1938 --   ptip_stat_cd Value of lookup code.
1939 --   effective_date effective date
1940 --   object_version_number Object version number of record being
1941 --                         inserted or updated.
1942 --
1943 -- Post Success
1944 --   Processing continues
1945 --
1946 -- Post Failure
1947 --   Error handled by procedure
1948 --
1949 -- Access Status
1950 --   Internal table handler use only.
1951 --
1952 Procedure chk_ptip_stat_cd(p_ptip_id                     in number,
1953                            p_ptip_stat_cd                in varchar2,
1954                            p_effective_date              in date,
1955                            p_object_version_number       in number) is
1956   --
1957   l_proc         varchar2(72) := g_package||'chk_ptip_stat_cd';
1958   l_api_updating boolean;
1959   --
1960 Begin
1961   --
1962   hr_utility.set_location('Entering:'||l_proc, 5);
1963   --
1964   l_api_updating := ben_ctp_shd.api_updating
1965     (p_ptip_id                     => p_ptip_id,
1966      p_effective_date              => p_effective_date,
1967      p_object_version_number       => p_object_version_number);
1968   --
1969   if (l_api_updating
1970       and p_ptip_stat_cd
1971       <> nvl(ben_ctp_shd.g_old_rec.ptip_stat_cd,hr_api.g_varchar2)
1972       or not l_api_updating) then
1973     --
1974     -- check if value of lookup falls within lookup type.
1975     --
1976     --
1977     if hr_api.not_exists_in_hr_lookups
1978           (p_lookup_type    => 'BEN_STAT',
1979            p_lookup_code    => p_ptip_stat_cd,
1980            p_effective_date => p_effective_date) then
1981       --
1982       -- raise error as does not exist as lookup
1983       --
1984       fnd_message.set_name('BEN','BEN_91217_INVLD_STAT_CD');
1985       fnd_message.raise_error;
1986       --
1987     end if;
1988     --
1989   end if;
1990   --
1991   hr_utility.set_location('Leaving:'||l_proc,10);
1992   --
1993 end chk_ptip_stat_cd;
1994 --
1995 -- ----------------------------------------------------------------------------
1996 -- ----------------------------------------------------------------------------
1997 -- |------< chk_crs_this_pl_typ_only_flag >------|
1998 -- ----------------------------------------------------------------------------
1999 --
2000 -- Description
2001 --   This procedure is used to check that the lookup value is valid.
2002 --
2003 -- Pre Conditions
2004 --   None.
2005 --
2006 -- In Parameters
2007 --   ptip_id PK of record being inserted or updated.
2008 --   crs_this_pl_typ_only_flag Value of lookup code.
2009 --   effective_date effective date
2010 --   object_version_number Object version number of record being
2011 --                         inserted or updated.
2012 --
2013 -- Post Success
2014 --   Processing continues
2015 --
2016 -- Post Failure
2017 --   Error handled by procedure
2018 --
2019 -- Access Status
2020 --   Internal table handler use only.
2021 --
2022 Procedure chk_crs_this_pl_typ_only_flag(p_ptip_id         in number,
2023                             p_crs_this_pl_typ_only_flag   in varchar2,
2024                             p_effective_date              in date,
2025                             p_object_version_number       in number) is
2026   --
2027   l_proc         varchar2(72) := g_package||'chk_crs_this_pl_typ_only_flag';
2028   l_api_updating boolean;
2029   --
2030 Begin
2031   --
2032   hr_utility.set_location('Entering:'||l_proc, 5);
2033   --
2034   l_api_updating := ben_ctp_shd.api_updating
2035     (p_ptip_id                     => p_ptip_id,
2036      p_effective_date              => p_effective_date,
2037      p_object_version_number       => p_object_version_number);
2038   --
2039   if (l_api_updating
2040       and p_crs_this_pl_typ_only_flag
2041       <> nvl(ben_ctp_shd.g_old_rec.crs_this_pl_typ_only_flag,hr_api.g_varchar2)
2042       or not l_api_updating)
2043       and p_crs_this_pl_typ_only_flag is not null then
2044     --
2045     -- check if value of lookup falls within lookup type.
2046     --
2047     if hr_api.not_exists_in_hr_lookups
2048           (p_lookup_type    => 'YES_NO',
2049            p_lookup_code    => p_crs_this_pl_typ_only_flag,
2050            p_effective_date => p_effective_date) then
2051       --
2052       -- raise error as does not exist as lookup
2053       --
2054       fnd_message.set_name('BEN','BEN_91235_INV_CRS_THIS_PT_FLAG');
2055       fnd_message.raise_error;
2056       --
2057     end if;
2058     --
2059   end if;
2060   --
2061   hr_utility.set_location('Leaving:'||l_proc,10);
2062   --
2063 end chk_crs_this_pl_typ_only_flag;
2064 --
2065 --
2066 -- ----------------------------------------------------------------------------
2067 -- |------< chk_dpnt_dsgn_cd >------|
2068 -- ----------------------------------------------------------------------------
2069 --
2070 -- Description
2071 --   This procedure is used to check that the lookup value is valid.
2072 --
2073 -- Pre Conditions
2074 --   None.
2075 --
2076 -- In Parameters
2077 --   ptip_id PK of record being inserted or updated.
2078 --   dpnt_dsgn_cd Value of lookup code.
2079 --   dpnt_cvg_strt_dt_cd Value of lookup code.
2080 --   dpnt_cvg_end_dt_cd  Value of lookup code.
2081 --   effective_date effective date
2082 --   object_version_number Object version number of record being
2083 --                         inserted or updated.
2084 --
2085 -- Post Success
2086 --   Processing continues
2087 --
2088 -- Post Failure
2089 --   Error handled by procedure
2090 --
2091 -- Access Status
2092 --   Internal table handler use only.
2093 --
2094 Procedure chk_dpnt_dsgn_cd(p_ptip_id                    in number,
2095                            p_dpnt_dsgn_cd               in varchar2,
2096                            p_dpnt_cvg_strt_dt_cd        in varchar2,
2097                            p_dpnt_cvg_end_dt_cd         in varchar2,
2098                            p_effective_date             in date,
2099                            p_object_version_number      in number) is
2100   --
2101   l_proc         varchar2(72) := g_package||'chk_dpnt_dsgn_cd';
2102   l_api_updating boolean;
2103   --
2104 Begin
2105   --
2106   hr_utility.set_location('Entering:'||l_proc, 5);
2107   --
2108   l_api_updating := ben_ctp_shd.api_updating
2109     (p_ptip_id                     => p_ptip_id,
2110      p_effective_date              => p_effective_date,
2111      p_object_version_number       => p_object_version_number);
2112   --
2113   if (l_api_updating
2114       and p_dpnt_dsgn_cd
2115       <> nvl(ben_ctp_shd.g_old_rec.dpnt_dsgn_cd,hr_api.g_varchar2)
2116       or not l_api_updating) then
2117     --
2118     -- check if value of lookup falls within lookup type.
2119     --
2120     --
2121     if p_dpnt_dsgn_cd is not null then
2122     if hr_api.not_exists_in_hr_lookups
2123           (p_lookup_type    => 'BEN_DPNT_DSGN',
2124            p_lookup_code    => p_dpnt_dsgn_cd,
2125            p_effective_date => p_effective_date) then
2126       --
2127       -- raise error as does not exist as lookup
2128       --
2129       fnd_message.set_name('BEN','BEN_91236_INV_DPNT_DSGN_CD');
2130       fnd_message.raise_error;
2131       --
2132     end if;
2133     end if;
2134     --
2135   end if;
2136   --
2137 
2138   if ( p_dpnt_dsgn_cd is not null) and
2139      (p_dpnt_cvg_strt_dt_cd is null or p_dpnt_cvg_end_dt_cd is null) then
2140 
2141     fnd_message.set_name('BEN','BEN_92512_DPNDNT_CVRG_DT_RQD');
2142     fnd_message.raise_error;
2143   end if;
2144 
2145   --
2146   hr_utility.set_location('Leaving:'||l_proc,10);
2147   --
2148 end chk_dpnt_dsgn_cd;
2149 --
2150 -- ----------------------------------------------------------------------------
2151 -- |------< chk_postelcn_edit_rl >------|
2152 -- ----------------------------------------------------------------------------
2153 --
2154 -- Description
2155 --   This procedure is used to check that the Formula Rule is valid.
2156 --
2157 -- Pre Conditions
2158 --   None.
2159 --
2160 -- In Parameters
2161 --   ptip_id PK of record being inserted or updated.
2162 --   postelcn_edit_rl Value of formula rule id.
2163 --   effective_date effective date
2164 --   object_version_number Object version number of record being
2165 --                         inserted or updated.
2166 --
2167 -- Post Success
2168 --   Processing continues
2169 --
2170 -- Post Failure
2171 --   Error handled by procedure
2172 --
2173 -- Access Status
2174 --   Internal table handler use only.
2175 --
2176 Procedure chk_postelcn_edit_rl
2177               (p_ptip_id                in number,
2178                p_postelcn_edit_rl       in number,
2179                p_effective_date         in date,
2180                p_object_version_number  in number,
2181                p_business_group_id      in number) is
2182   --
2183   l_proc         varchar2(72) := g_package||'chk_postelcn_edit_rl';
2184   l_api_updating boolean;
2185   l_dummy        varchar2(1);
2186   --
2187   cursor c1 is
2188     select null
2189     from   ff_formulas_f ff ,
2190            per_business_groups pbg
2191     where  ff.formula_id = p_postelcn_edit_rl
2192     and    ff.formula_type_id = -215 /*default enrollment det */
2193     and    pbg.business_group_id = p_business_group_id
2194     and    nvl(ff.business_group_id, p_business_group_id) =
2195            p_business_group_id
2196     and    nvl(ff.legislation_code, pbg.legislation_code) =
2197            pbg.legislation_code
2198     and    p_effective_date
2199            between ff.effective_start_date
2200            and     ff.effective_end_date;
2201   --
2202 Begin
2203   --
2204   hr_utility.set_location('Entering:'||l_proc, 5);
2205   --
2206   l_api_updating := ben_ctp_shd.api_updating
2207     (p_ptip_id                     => p_ptip_id,
2208      p_effective_date              => p_effective_date,
2209      p_object_version_number       => p_object_version_number);
2210   --
2211   if (l_api_updating
2212       and nvl(p_postelcn_edit_rl,hr_api.g_number)
2213       <> ben_ctp_shd.g_old_rec.postelcn_edit_rl
2214       or not l_api_updating)
2215       and p_postelcn_edit_rl is not null then
2216     --
2217     -- check if value of formula rule is valid.
2218     --
2219     open c1;
2220       --
2221       -- fetch value from cursor if it returns a record then the
2222       -- formula is valid otherwise its invalid
2223       --
2224       fetch c1 into l_dummy;
2225       if c1%notfound then
2226         --
2227         close c1;
2228         --
2229         -- raise error
2230         --
2231         fnd_message.set_name('BEN','BEN_91471_FORMULA_NOT_FOUND');
2232         fnd_message.set_token('ID',p_postelcn_edit_rl);
2233         fnd_message.set_token('TYPE_ID',-215);
2234         fnd_message.raise_error;
2235         --
2236       end if;
2237       --
2238     close c1;
2239     --
2240   end if;
2241   --
2242   hr_utility.set_location('Leaving:'||l_proc,10);
2243   --
2244 end chk_postelcn_edit_rl;
2245 --
2246 -- ----------------------------------------------------------------------------
2247 -- |------< chk_rt_end_dt_rl >------|
2248 -- ----------------------------------------------------------------------------
2249 --
2250 -- Description
2251 --   This procedure is used to check that the Formula Rule is valid.
2252 --
2253 -- Pre Conditions
2254 --   None.
2255 --
2256 -- In Parameters
2257 --   ptip_id PK of record being inserted or updated.
2258 --   rt_end_dt_rl Value of formula rule id.
2259 --   effective_date effective date
2260 --   object_version_number Object version number of record being
2261 --                         inserted or updated.
2262 --
2263 -- Post Success
2264 --   Processing continues
2265 --
2266 -- Post Failure
2267 --   Error handled by procedure
2268 --
2269 -- Access Status
2270 --   Internal table handler use only.
2271 --
2272 Procedure chk_rt_end_dt_rl
2273               (p_ptip_id                in number,
2274                p_rt_end_dt_rl           in number,
2275                p_effective_date         in date,
2276                p_object_version_number  in number,
2277                p_business_group_id      in number) is
2278   --
2279   l_proc         varchar2(72) := g_package||'chk_rt_end_dt_rl';
2280   l_api_updating boolean;
2281   l_dummy        varchar2(1);
2282   --
2283   cursor c1 is
2284     select null
2285     from   ff_formulas_f ff ,
2286            per_business_groups pbg
2287     where  ff.formula_id = p_rt_end_dt_rl
2288     and    ff.formula_type_id = -67 /*rt_end */
2289     and    pbg.business_group_id = p_business_group_id
2290     and    nvl(ff.business_group_id, p_business_group_id) =
2291            p_business_group_id
2292     and    nvl(ff.legislation_code, pbg.legislation_code) =
2293            pbg.legislation_code
2294     and    p_effective_date
2295            between ff.effective_start_date
2296            and     ff.effective_end_date;
2297   --
2298 Begin
2299   --
2300   hr_utility.set_location('Entering:'||l_proc, 5);
2301   --
2302   l_api_updating := ben_ctp_shd.api_updating
2303     (p_ptip_id                     => p_ptip_id,
2304      p_effective_date              => p_effective_date,
2305      p_object_version_number       => p_object_version_number);
2306   --
2307   if (l_api_updating
2308       and nvl(p_rt_end_dt_rl,hr_api.g_number)
2309       <> ben_ctp_shd.g_old_rec.rt_end_dt_rl
2310       or not l_api_updating)
2311       and p_rt_end_dt_rl is not null then
2312     --
2313     -- check if value of formula rule is valid.
2314     --
2315     open c1;
2316       --
2317       -- fetch value from cursor if it returns a record then the
2318       -- formula is valid otherwise its invalid
2319       --
2320       fetch c1 into l_dummy;
2321       if c1%notfound then
2322         --
2323         close c1;
2324         --
2325         -- raise error
2326         --
2327         fnd_message.set_name('BEN','BEN_91471_FORMULA_NOT_FOUND');
2328         fnd_message.set_token('ID',p_rt_end_dt_rl);
2329         fnd_message.set_token('TYPE_ID',-67);
2330         fnd_message.raise_error;
2331         --
2332       end if;
2333       --
2334     close c1;
2335     --
2336   end if;
2337   --
2338   hr_utility.set_location('Leaving:'||l_proc,10);
2339   --
2340 end chk_rt_end_dt_rl;
2341 --
2342 --
2343 -- ----------------------------------------------------------------------------
2344 -- |------< chk_rt_strt_dt_rl >------|
2345 -- ----------------------------------------------------------------------------
2346 --
2347 -- Description
2348 --   This procedure is used to check that the Formula Rule is valid.
2349 --
2350 -- Pre Conditions
2351 --   None.
2352 --
2353 -- In Parameters
2354 --   ptip_id PK of record being inserted or updated.
2355 --   rt_strt_dt_rl Value of formula rule id.
2356 --   effective_date effective date
2357 --   object_version_number Object version number of record being
2358 --                         inserted or updated.
2359 --
2360 -- Post Success
2361 --   Processing continues
2362 --
2363 -- Post Failure
2364 --   Error handled by procedure
2365 --
2366 -- Access Status
2367 --   Internal table handler use only.
2368 --
2369 Procedure chk_rt_strt_dt_rl
2370               (p_ptip_id                in number,
2371                p_rt_strt_dt_rl          in number,
2372                p_effective_date         in date,
2373                p_object_version_number  in number,
2374                p_business_group_id      in number) is
2375   --
2376   l_proc         varchar2(72) := g_package||'chk_rt_strt_dt_rl';
2377   l_api_updating boolean;
2378   l_dummy        varchar2(1);
2379   --
2380   cursor c1 is
2381     select null
2382     from   ff_formulas_f ff ,
2383            per_business_groups pbg
2384     where  ff.formula_id = p_rt_strt_dt_rl
2385     and    ff.formula_type_id = -66 /*rt_strt */
2386     and    pbg.business_group_id = p_business_group_id
2387     and    nvl(ff.business_group_id, p_business_group_id) =
2388            p_business_group_id
2389     and    nvl(ff.legislation_code, pbg.legislation_code) =
2390            pbg.legislation_code
2391     and    p_effective_date
2392            between ff.effective_start_date
2393            and     ff.effective_end_date;
2394   --
2395 Begin
2396   --
2397   hr_utility.set_location('Entering:'||l_proc, 5);
2398   --
2399   l_api_updating := ben_ctp_shd.api_updating
2400     (p_ptip_id                     => p_ptip_id,
2401      p_effective_date              => p_effective_date,
2402      p_object_version_number       => p_object_version_number);
2403   --
2404   if (l_api_updating
2405       and nvl(p_rt_strt_dt_rl,hr_api.g_number)
2406       <> ben_ctp_shd.g_old_rec.rt_strt_dt_rl
2407       or not l_api_updating)
2408       and p_rt_strt_dt_rl is not null then
2409     --
2410     -- check if value of formula rule is valid.
2411     --
2412     open c1;
2413       --
2414       -- fetch value from cursor if it returns a record then the
2415       -- formula is valid otherwise its invalid
2416       --
2417       fetch c1 into l_dummy;
2418       if c1%notfound then
2419         --
2420         close c1;
2421         --
2422         -- raise error
2423         --
2424         fnd_message.set_name('BEN','BEN_91471_FORMULA_NOT_FOUND');
2425         fnd_message.set_token('ID',p_rt_strt_dt_rl);
2426         fnd_message.set_token('TYPE_ID',-66);
2427         fnd_message.raise_error;
2428         --
2429       end if;
2430       --
2431     close c1;
2432     --
2433   end if;
2434   --
2435   hr_utility.set_location('Leaving:'||l_proc,10);
2436   --
2437 end chk_rt_strt_dt_rl;
2438 --
2439 -- ----------------------------------------------------------------------------
2440 -- |------< chk_enrt_cvg_end_dt_rl >------|
2441 -- ----------------------------------------------------------------------------
2442 --
2443 -- Description
2444 --   This procedure is used to check that the Formula Rule is valid.
2445 --
2446 -- Pre Conditions
2447 --   None.
2448 --
2449 -- In Parameters
2450 --   ptip_id PK of record being inserted or updated.
2451 --   enrt_cvg_end_dt_rl Value of formula rule id.
2452 --   effective_date effective date
2453 --   object_version_number Object version number of record being
2454 --                         inserted or updated.
2455 --
2456 -- Post Success
2457 --   Processing continues
2458 --
2459 -- Post Failure
2460 --   Error handled by procedure
2461 --
2462 -- Access Status
2463 --   Internal table handler use only.
2464 --
2465 Procedure chk_enrt_cvg_end_dt_rl
2466               (p_ptip_id                in number,
2467                p_enrt_cvg_end_dt_rl     in number,
2468                p_effective_date         in date,
2469                p_object_version_number  in number,
2470                p_business_group_id      in number) is
2471   --
2472   l_proc         varchar2(72) := g_package||'chk_enrt_cvg_end_dt_rl';
2473   l_api_updating boolean;
2474   l_dummy        varchar2(1);
2475   --
2476   cursor c1 is
2477     select null
2478     from   ff_formulas_f ff ,
2479            per_business_groups pbg
2480     where  ff.formula_id = p_enrt_cvg_end_dt_rl
2481     and    ff.formula_type_id = -30 /*enrt_cvg_end */
2482     and    pbg.business_group_id = p_business_group_id
2483     and    nvl(ff.business_group_id, p_business_group_id) =
2484            p_business_group_id
2485     and    nvl(ff.legislation_code, pbg.legislation_code) =
2486            pbg.legislation_code
2487     and    p_effective_date
2488            between ff.effective_start_date
2489            and     ff.effective_end_date;
2490   --
2491 Begin
2492   --
2493   hr_utility.set_location('Entering:'||l_proc, 5);
2494   --
2495   l_api_updating := ben_ctp_shd.api_updating
2496     (p_ptip_id                     => p_ptip_id,
2497      p_effective_date              => p_effective_date,
2498      p_object_version_number       => p_object_version_number);
2499   --
2500   if (l_api_updating
2501       and nvl(p_enrt_cvg_end_dt_rl,hr_api.g_number)
2502       <> ben_ctp_shd.g_old_rec.enrt_cvg_end_dt_rl
2503       or not l_api_updating)
2504       and p_enrt_cvg_end_dt_rl is not null then
2505     --
2506     -- check if value of formula rule is valid.
2507     --
2508     open c1;
2509       --
2510       -- fetch value from cursor if it returns a record then the
2511       -- formula is valid otherwise its invalid
2512       --
2513       fetch c1 into l_dummy;
2514       if c1%notfound then
2515         --
2516         close c1;
2517         --
2518         -- raise error
2519         --
2520         fnd_message.set_name('BEN','BEN_91471_FORMULA_NOT_FOUND');
2521         fnd_message.set_token('ID',p_enrt_cvg_end_dt_rl);
2522         fnd_message.set_token('TYPE_ID',-30);
2523         fnd_message.raise_error;
2524         --
2525       end if;
2526       --
2527     close c1;
2528     --
2529   end if;
2530   --
2531   hr_utility.set_location('Leaving:'||l_proc,10);
2532   --
2533 end chk_enrt_cvg_end_dt_rl;
2534 --
2535 -- ----------------------------------------------------------------------------
2536 -- |------< chk_enrt_cvg_strt_dt_rl >------|
2537 -- ----------------------------------------------------------------------------
2538 --
2539 -- Description
2540 --   This procedure is used to check that the Formula Rule is valid.
2541 --
2542 -- Pre Conditions
2543 --   None.
2544 --
2545 -- In Parameters
2546 --   ptip_id PK of record being inserted or updated.
2547 --   enrt_cvg_strt_dt_rl Value of formula rule id.
2548 --   effective_date effective date
2549 --   object_version_number Object version number of record being
2550 --                         inserted or updated.
2551 --
2552 -- Post Success
2553 --   Processing continues
2554 --
2555 -- Post Failure
2556 --   Error handled by procedure
2557 --
2558 -- Access Status
2559 --   Internal table handler use only.
2560 --
2561 Procedure chk_enrt_cvg_strt_dt_rl
2562               (p_ptip_id                in number,
2563                p_enrt_cvg_strt_dt_rl    in number,
2564                p_effective_date         in date,
2565                p_object_version_number  in number,
2566                p_business_group_id      in number) is
2567   --
2568   l_proc         varchar2(72) := g_package||'chk_enrt_cvg_strt_dt_rl';
2569   l_api_updating boolean;
2570   l_dummy        varchar2(1);
2571   --
2572   cursor c1 is
2573     select null
2574     from   ff_formulas_f ff ,
2575            per_business_groups pbg
2576     where  ff.formula_id = p_enrt_cvg_strt_dt_rl
2577     and    ff.formula_type_id = -29 /*enrt_cvg_strt */
2578     and    pbg.business_group_id = p_business_group_id
2579     and    nvl(ff.business_group_id, p_business_group_id) =
2580            p_business_group_id
2581     and    nvl(ff.legislation_code, pbg.legislation_code) =
2582            pbg.legislation_code
2583     and    p_effective_date
2584            between ff.effective_start_date
2585            and     ff.effective_end_date;
2586   --
2587 Begin
2588   --
2589   hr_utility.set_location('Entering:'||l_proc, 5);
2590   --
2591   l_api_updating := ben_ctp_shd.api_updating
2592     (p_ptip_id                     => p_ptip_id,
2593      p_effective_date              => p_effective_date,
2594      p_object_version_number       => p_object_version_number);
2595   --
2596   if (l_api_updating
2597       and nvl(p_enrt_cvg_strt_dt_rl,hr_api.g_number)
2598       <> ben_ctp_shd.g_old_rec.enrt_cvg_strt_dt_rl
2599       or not l_api_updating)
2600       and p_enrt_cvg_strt_dt_rl is not null then
2601     --
2602     -- check if value of formula rule is valid.
2603     --
2604     open c1;
2605       --
2606       -- fetch value from cursor if it returns a record then the
2607       -- formula is valid otherwise its invalid
2608       --
2609       fetch c1 into l_dummy;
2610       if c1%notfound then
2611         --
2612         close c1;
2613         --
2614         -- raise error
2615         --
2616         fnd_message.set_name('BEN','BEN_91471_FORMULA_NOT_FOUND');
2617         fnd_message.set_token('ID',p_enrt_cvg_strt_dt_rl);
2618         fnd_message.set_token('TYPE_ID',-29);
2619         fnd_message.raise_error;
2620         --
2621       end if;
2622       --
2623     close c1;
2624     --
2625   end if;
2626   --
2627   hr_utility.set_location('Leaving:'||l_proc,10);
2628   --
2629 end chk_enrt_cvg_strt_dt_rl;
2630 --
2631 --
2632 -- ----------------------------------------------------------------------------
2633 -- |------< chk_rqd_perd_enrt_nenrt_rl >------|
2634 -- ----------------------------------------------------------------------------
2635 --
2636 -- Description
2637 --   This procedure is used to check that the Formula Rule is valid.
2638 --
2639 -- Pre Conditions
2640 --   None.
2641 --
2642 -- In Parameters
2643 --   ptip_id PK of record being inserted or updated.
2644 --   rqd_perd_enrt_nenrt_rl Value of formula rule id.
2645 --   effective_date effective date
2646 --   object_version_number Object version number of record being
2647 --                         inserted or updated.
2648 --
2649 -- Post Success
2650 --   Processing continues
2651 --
2652 -- Post Failure
2653 --   Error handled by procedure
2654 --
2655 -- Access Status
2656 --   Internal table handler use only.
2657 --
2658 Procedure chk_rqd_perd_enrt_nenrt_rl
2659               (p_ptip_id                in number,
2660                p_rqd_perd_enrt_nenrt_rl in number,
2661                p_effective_date         in date,
2662                p_object_version_number  in number,
2663                p_business_group_id      in number) is
2664   --
2665   l_proc         varchar2(72) := g_package||'chk_rqd_perd_enrt_nenrt_rl';
2666   l_api_updating boolean;
2667   l_dummy        varchar2(1);
2668   --
2669   cursor c1 is
2670     select null
2671     from   ff_formulas_f ff ,
2672            per_business_groups pbg
2673     where  ff.formula_id = p_rqd_perd_enrt_nenrt_rl
2674     and    ff.formula_type_id = -513
2675     and    pbg.business_group_id = p_business_group_id
2676     and    nvl(ff.business_group_id, p_business_group_id) =
2677            p_business_group_id
2678     and    nvl(ff.legislation_code, pbg.legislation_code) =
2679            pbg.legislation_code
2680     and    p_effective_date
2681            between ff.effective_start_date
2682            and     ff.effective_end_date;
2683   --
2684 Begin
2685   --
2686   hr_utility.set_location('Entering:'||l_proc, 5);
2687   --
2688   l_api_updating := ben_ctp_shd.api_updating
2689     (p_ptip_id                     => p_ptip_id,
2690      p_effective_date              => p_effective_date,
2691      p_object_version_number       => p_object_version_number);
2692   --
2693   if (l_api_updating
2694       and nvl(p_rqd_perd_enrt_nenrt_rl,hr_api.g_number)
2695       <> ben_ctp_shd.g_old_rec.rqd_perd_enrt_nenrt_rl
2696       or not l_api_updating)
2697       and p_rqd_perd_enrt_nenrt_rl is not null then
2698     --
2699     -- check if value of formula rule is valid.
2700     --
2701     open c1;
2702       --
2703       -- fetch value from cursor if it returns a record then the
2704       -- formula is valid otherwise its invalid
2705       --
2706       fetch c1 into l_dummy;
2707       if c1%notfound then
2708         --
2709         close c1;
2710         --
2711         -- raise error
2712         --
2713         fnd_message.set_name('BEN','BEN_91471_FORMULA_NOT_FOUND');
2714         fnd_message.set_token('ID',p_rqd_perd_enrt_nenrt_rl);
2715         fnd_message.set_token('TYPE_ID',-513);
2716         fnd_message.raise_error;
2717         --
2718       end if;
2719       --
2720     close c1;
2721     --
2722   end if;
2723   --
2724   hr_utility.set_location('Leaving:'||l_proc,10);
2725   --
2726 end chk_rqd_perd_enrt_nenrt_rl;
2727 --
2728 -- ----------------------------------------------------------------------------
2729 -- |-------------------< chk_auto_enrt_mthd_rl >------------------------------|
2730 -- ----------------------------------------------------------------------------
2731 --
2732 -- Description
2733 --   This procedure is used to check that the Formula Rule is valid.
2734 --
2735 -- Pre Conditions
2736 --   None.
2737 --
2738 -- In Parameters
2739 --   ptip_id PK of record being inserted or updated.
2740 --   auto_enrt_mthd_rl Value of formula rule id.
2741 --   effective_date effective date
2742 --   object_version_number Object version number of record being
2743 --                         inserted or updated.
2744 --
2745 -- Post Success
2746 --   Processing continues
2747 --
2748 -- Post Failure
2749 --   Error handled by procedure
2750 --
2751 -- Access Status
2752 --   Internal table handler use only.
2753 --
2754 Procedure chk_auto_enrt_mthd_rl
2755               (p_ptip_id                in number,
2756                p_auto_enrt_mthd_rl      in number,
2757                p_effective_date         in date,
2758                p_object_version_number  in number,
2759                p_business_group_id      in number) is
2760   --
2761   l_proc         varchar2(72) := g_package||'chk_auto_enrt_mthd_rl';
2762   l_api_updating boolean;
2763   l_dummy        varchar2(1);
2764   --
2765   cursor c1 is
2766     select null
2767     from   ff_formulas_f ff ,
2768            per_business_groups pbg
2769     where  ff.formula_id = p_auto_enrt_mthd_rl
2770     and    ff.formula_type_id = -146
2771     and    pbg.business_group_id = p_business_group_id
2772     and    nvl(ff.business_group_id, p_business_group_id) =
2773            p_business_group_id
2774     and    nvl(ff.legislation_code, pbg.legislation_code) =
2775            pbg.legislation_code
2776     and    p_effective_date
2777            between ff.effective_start_date
2778            and     ff.effective_end_date;
2779   --
2780 Begin
2781   --
2782   hr_utility.set_location('Entering:'||l_proc, 5);
2783   --
2784   l_api_updating := ben_ctp_shd.api_updating
2785     (p_ptip_id                     => p_ptip_id,
2786      p_effective_date              => p_effective_date,
2787      p_object_version_number       => p_object_version_number);
2788   --
2789   if (l_api_updating
2790       and nvl(p_auto_enrt_mthd_rl,hr_api.g_number)
2791       <> ben_ctp_shd.g_old_rec.auto_enrt_mthd_rl
2792       or not l_api_updating)
2793       and p_auto_enrt_mthd_rl is not null then
2794     --
2795     -- check if value of formula rule is valid.
2796     --
2797     open c1;
2798       --
2799       -- fetch value from cursor if it returns a record then the
2800       -- formula is valid otherwise its invalid
2801       --
2802       fetch c1 into l_dummy;
2803       if c1%notfound then
2804         --
2805         close c1;
2806         --
2807         -- raise error
2808         --
2809         fnd_message.set_name('BEN','BEN_91471_FORMULA_NOT_FOUND');
2810         fnd_message.set_token('ID',p_auto_enrt_mthd_rl);
2811         fnd_message.set_token('TYPE_ID',-146);
2812         fnd_message.raise_error;
2813         --
2814       end if;
2815       --
2816     close c1;
2817     --
2818   end if;
2819   --
2820   hr_utility.set_location('Leaving:'||l_proc,10);
2821   --
2822 end chk_auto_enrt_mthd_rl;
2823 --
2824 -- ----------------------------------------------------------------------------
2825 -- |-------------------< chk_enrt_rl >------------------------------|
2826 -- ----------------------------------------------------------------------------
2827 --
2828 -- Description
2829 --   This procedure is used to check that the Formula Rule is valid.
2830 --
2831 -- Pre Conditions
2832 --   None.
2833 --
2834 -- In Parameters
2835 --   ptip_id PK of record being inserted or updated.
2836 --   enrt_rl Value of formula rule id.
2837 --   effective_date effective date
2838 --   object_version_number Object version number of record being
2839 --                         inserted or updated.
2840 --
2841 -- Post Success
2842 --   Processing continues
2843 --
2844 -- Post Failure
2845 --   Error handled by procedure
2846 --
2847 -- Access Status
2848 --   Internal table handler use only.
2849 --
2850 Procedure chk_enrt_rl
2851               (p_ptip_id                in number,
2852                p_enrt_rl                in number,
2853                p_effective_date         in date,
2854                p_object_version_number  in number,
2855                p_business_group_id      in number) is
2856   --
2857   l_proc         varchar2(72) := g_package||'chk_enrt_rl';
2858   l_api_updating boolean;
2859   l_dummy        varchar2(1);
2860   --
2861   cursor c1 is
2862     select null
2863     from   ff_formulas_f ff ,
2864            per_business_groups pbg
2865     where  ff.formula_id = p_enrt_rl
2866     and    ff.formula_type_id = -393
2867     and    pbg.business_group_id = p_business_group_id
2868     and    nvl(ff.business_group_id, p_business_group_id) =
2869            p_business_group_id
2870     and    nvl(ff.legislation_code, pbg.legislation_code) =
2871            pbg.legislation_code
2872     and    p_effective_date
2873            between ff.effective_start_date
2874            and     ff.effective_end_date;
2875   --
2876 Begin
2877   --
2878   hr_utility.set_location('Entering:'||l_proc, 5);
2879   --
2880   l_api_updating := ben_ctp_shd.api_updating
2881     (p_ptip_id                     => p_ptip_id,
2882      p_effective_date              => p_effective_date,
2883      p_object_version_number       => p_object_version_number);
2884   --
2885   if (l_api_updating
2886       and nvl(p_enrt_rl,hr_api.g_number)
2887       <> ben_ctp_shd.g_old_rec.enrt_rl
2888       or not l_api_updating)
2889       and p_enrt_rl is not null then
2890     --
2891     -- check if value of formula rule is valid.
2892     --
2893     open c1;
2894       --
2895       -- fetch value from cursor if it returns a record then the
2896       -- formula is valid otherwise its invalid
2897       --
2898       fetch c1 into l_dummy;
2899       if c1%notfound then
2900         --
2901         close c1;
2902         --
2903         -- raise error
2904         --
2905         fnd_message.set_name('BEN','BEN_91471_FORMULA_NOT_FOUND');
2906         fnd_message.set_token('ID',p_enrt_rl);
2907         fnd_message.set_token('TYPE_ID',-393);
2908         fnd_message.raise_error;
2909         --
2910       end if;
2911       --
2912     close c1;
2913     --
2914   end if;
2915   --
2916   hr_utility.set_location('Leaving:'||l_proc,10);
2917   --
2918 end chk_enrt_rl;
2919 --
2920 -- ----------------------------------------------------------------------------
2921 -- |-------------------< chk_dflt_enrt_det_rl >--------------------------|
2922 -- ----------------------------------------------------------------------------
2923 --
2924 -- Description
2925 --   This procedure is used to check that the Formula Rule is valid.
2926 --
2927 -- Pre Conditions
2928 --   None.
2929 --
2930 -- In Parameters
2931 --   ptip_id PK of record being inserted or updated.
2932 --   dflt_enrt_det_rl Value of formula rule id.
2933 --   effective_date effective date
2934 --   object_version_number Object version number of record being
2935 --                         inserted or updated.
2936 --
2937 -- Post Success
2938 --   Processing continues
2939 --
2940 -- Post Failure
2941 --   Error handled by procedure
2942 --
2943 -- Access Status
2944 --   Internal table handler use only.
2945 --
2946 Procedure chk_dflt_enrt_det_rl
2947               (p_ptip_id                in number,
2948                p_dflt_enrt_det_rl       in number,
2949                p_effective_date         in date,
2950                p_object_version_number  in number,
2951                p_business_group_id      in number) is
2952   --
2953   l_proc         varchar2(72) := g_package||'chk_dflt_enrt_det_rl';
2954   l_api_updating boolean;
2955   l_dummy        varchar2(1);
2956   --
2957   cursor c1 is
2958     select null
2959     from   ff_formulas_f ff ,
2960            per_business_groups pbg
2961     where  ff.formula_id = p_dflt_enrt_det_rl
2962     and    ff.formula_type_id = -32
2963     and    pbg.business_group_id = p_business_group_id
2964     and    nvl(ff.business_group_id, p_business_group_id) =
2965            p_business_group_id
2966     and    nvl(ff.legislation_code, pbg.legislation_code) =
2967            pbg.legislation_code
2968     and    p_effective_date
2969            between ff.effective_start_date
2970            and     ff.effective_end_date;
2971   --
2972 Begin
2973   --
2974   hr_utility.set_location('Entering:'||l_proc, 5);
2975   --
2976   l_api_updating := ben_ctp_shd.api_updating
2977     (p_ptip_id                     => p_ptip_id,
2978      p_effective_date              => p_effective_date,
2979      p_object_version_number       => p_object_version_number);
2980   --
2981   if (l_api_updating
2982       and nvl(p_dflt_enrt_det_rl,hr_api.g_number)
2983       <> ben_ctp_shd.g_old_rec.dflt_enrt_det_rl
2984       or not l_api_updating)
2985       and p_dflt_enrt_det_rl is not null then
2986     --
2987     -- check if value of formula rule is valid.
2988     --
2989     open c1;
2990       --
2991       -- fetch value from cursor if it returns a record then the
2992       -- formula is valid otherwise its invalid
2993       --
2994       fetch c1 into l_dummy;
2995       if c1%notfound then
2996         --
2997         close c1;
2998         --
2999         -- raise error
3000         --
3001         fnd_message.set_name('BEN','BEN_91471_FORMULA_NOT_FOUND');
3002         fnd_message.set_token('ID',p_dflt_enrt_det_rl);
3003         fnd_message.set_token('TYPE_ID',-32);
3004         fnd_message.raise_error;
3005         --
3006       end if;
3007       --
3008     close c1;
3009     --
3010   end if;
3011   --
3012   hr_utility.set_location('Leaving:'||l_proc,10);
3013   --
3014 end chk_dflt_enrt_det_rl;
3015 --
3016 -- ----------------------------------------------------------------------------
3017 -- |------< chk_enrt_mthd_cd >------|
3018 -- ----------------------------------------------------------------------------
3019 --
3020 -- Description
3021 --   This procedure is used to check that the lookup value is valid.
3022 --
3023 -- Pre Conditions
3024 --   None.
3025 --
3026 -- In Parameters
3027 --   ptip_id PK of record being inserted or updated.
3028 --   enrt_mthd_cd Value of lookup code.
3029 --   effective_date effective date
3030 --   object_version_number Object version number of record being
3031 --                         inserted or updated.
3032 --
3033 -- Post Success
3034 --   Processing continues
3035 --
3036 -- Post Failure
3037 --   Error handled by procedure
3038 --
3039 -- Access Status
3040 --   Internal table handler use only.
3041 --
3042 Procedure chk_enrt_mthd_cd(p_ptip_id                    in number,
3043                             p_enrt_mthd_cd              in varchar2,
3044                             p_effective_date            in date,
3045                             p_object_version_number     in number) is
3046   --
3047   l_proc         varchar2(72) := g_package||'chk_enrt_mthd_cd';
3048   l_api_updating boolean;
3049   --
3050 Begin
3051   --
3052   hr_utility.set_location('Entering:'||l_proc, 5);
3053   --
3054   l_api_updating := ben_ctp_shd.api_updating
3055     (p_ptip_id                     => p_ptip_id,
3056      p_effective_date              => p_effective_date,
3057      p_object_version_number       => p_object_version_number);
3058   --
3059   if (l_api_updating
3060       and p_enrt_mthd_cd
3061       <> nvl(ben_ctp_shd.g_old_rec.enrt_mthd_cd,hr_api.g_varchar2)
3062       or not l_api_updating) then
3063     --
3064     -- check if value of lookup falls within lookup type.
3065     --
3066     --
3067     if p_enrt_mthd_cd is not null then
3068        if hr_api.not_exists_in_hr_lookups
3069           (p_lookup_type    => 'BEN_ENRT_MTHD',
3070            p_lookup_code    => p_enrt_mthd_cd,
3071            p_effective_date => p_effective_date) then
3072       --
3073       -- raise error as does not exist as lookup
3074       --
3075       fnd_message.set_name('BEN','BEN_91628_LOOKUP_TYPE_GENERIC');
3076       fnd_message.set_token('FIELD','p_enrt_mthd_cd');
3077       fnd_message.set_token('TYPE','BEN_ENRT_MTHD');
3078       fnd_message.raise_error;
3079       --
3080       end if;
3081     end if;
3082     --
3083     --
3084   end if;
3085   --
3086   hr_utility.set_location('Leaving:'||l_proc,10);
3087   --
3088 end chk_enrt_mthd_cd;
3089 --
3090 -- ----------------------------------------------------------------------------
3091 -- |------< chk_enrt_cd >------|
3092 -- ----------------------------------------------------------------------------
3093 --
3094 -- Description
3095 --   This procedure is used to check that the lookup value is valid.
3096 --
3097 -- Pre Conditions
3098 --   None.
3099 --
3100 -- In Parameters
3101 --   ptip_id PK of record being inserted or updated.
3102 --   enrt_cd Value of lookup code.
3103 --   effective_date effective date
3104 --   object_version_number Object version number of record being
3105 --                         inserted or updated.
3106 --
3107 -- Post Success
3108 --   Processing continues
3109 --
3110 -- Post Failure
3111 --   Error handled by procedure
3112 --
3113 -- Access Status
3114 --   Internal table handler use only.
3115 --
3116 Procedure chk_enrt_cd(p_ptip_id                   in number,
3117                       p_enrt_cd                   in varchar2,
3118                       p_effective_date            in date,
3119                       p_object_version_number     in number) is
3120   --
3121   l_proc         varchar2(72) := g_package||'chk_enrt_cd';
3122   l_api_updating boolean;
3123   --
3124 Begin
3125   --
3126   hr_utility.set_location('Entering:'||l_proc, 5);
3127   --
3128   l_api_updating := ben_ctp_shd.api_updating
3129     (p_ptip_id                     => p_ptip_id,
3130      p_effective_date              => p_effective_date,
3131      p_object_version_number       => p_object_version_number);
3132   --
3133   if (l_api_updating
3134       and p_enrt_cd
3135       <> nvl(ben_ctp_shd.g_old_rec.enrt_cd,hr_api.g_varchar2)
3136       or not l_api_updating) then
3137     --
3138     -- check if value of lookup falls within lookup type.
3139     --
3140     --
3141     if p_enrt_cd is not null then
3142        if hr_api.not_exists_in_hr_lookups
3143           (p_lookup_type    => 'BEN_ENRT',
3144            p_lookup_code    => p_enrt_cd,
3145            p_effective_date => p_effective_date) then
3146       --
3147       -- raise error as does not exist as lookup
3148       --
3149       fnd_message.set_name('BEN','BEN_91628_LOOKUP_TYPE_GENERIC');
3150       fnd_message.set_token('FIELD','p_enrt_cd');
3151       fnd_message.set_token('TYPE','BEN_ENRT');
3152       fnd_message.raise_error;
3153       --
3154       end if;
3155     end if;
3156     --
3157     --
3158   end if;
3159   --
3160   hr_utility.set_location('Leaving:'||l_proc,10);
3161   --
3162 end chk_enrt_cd;
3163 --
3164 -- ----------------------------------------------------------------------------
3165 -- |------< chk_dflt_enrt_cd >------|
3166 -- ----------------------------------------------------------------------------
3167 --
3168 -- Description
3169 --   This procedure is used to check that the lookup value is valid.
3170 --
3171 -- Pre Conditions
3172 --   None.
3173 --
3174 -- In Parameters
3175 --   ptip_id PK of record being inserted or updated.
3176 --   dflt_enrt_cd Value of lookup code.
3177 --   effective_date effective date
3178 --   object_version_number Object version number of record being
3179 --                         inserted or updated.
3180 --
3181 -- Post Success
3182 --   Processing continues
3183 --
3184 -- Post Failure
3185 --   Error handled by procedure
3186 --
3187 -- Access Status
3188 --   Internal table handler use only.
3189 --
3190 Procedure chk_dflt_enrt_cd(p_ptip_id                   in number,
3191                            p_dflt_enrt_cd              in varchar2,
3192                            p_effective_date            in date,
3193                            p_object_version_number     in number) is
3194   --
3195   l_proc         varchar2(72) := g_package||'chk_dflt_enrt_cd';
3196   l_api_updating boolean;
3197   --
3198 Begin
3199   --
3200   hr_utility.set_location('Entering:'||l_proc, 5);
3201   --
3202   l_api_updating := ben_ctp_shd.api_updating
3203     (p_ptip_id                     => p_ptip_id,
3204      p_effective_date              => p_effective_date,
3205      p_object_version_number       => p_object_version_number);
3206   --
3207   if (l_api_updating
3208       and p_dflt_enrt_cd
3209       <> nvl(ben_ctp_shd.g_old_rec.dflt_enrt_cd,hr_api.g_varchar2)
3210       or not l_api_updating) then
3211     --
3212     -- check if value of lookup falls within lookup type.
3213     --
3214     --
3215     if p_dflt_enrt_cd is not null then
3216        if hr_api.not_exists_in_hr_lookups
3217           (p_lookup_type    => 'BEN_DFLT_ENRT',
3218            p_lookup_code    => p_dflt_enrt_cd,
3219            p_effective_date => p_effective_date) then
3220       --
3221       -- raise error as does not exist as lookup
3222       --
3223       fnd_message.set_name('BEN','BEN_91628_LOOKUP_TYPE_GENERIC');
3224       fnd_message.set_token('FIELD','p_dflt_enrt_cd');
3225       fnd_message.set_token('TYPE','BEN_DFLT_ENRT');
3226       fnd_message.raise_error;
3227       --
3228       end if;
3229     end if;
3230     --
3231     --
3232   end if;
3233   --
3234   hr_utility.set_location('Leaving:'||l_proc,10);
3235   --
3236 end chk_dflt_enrt_cd;
3237 --
3238 -- ----------------------------------------------------------------------------
3239 -- |------< chk_dpnt_cvg_end_dt_rl >------|
3240 -- ----------------------------------------------------------------------------
3241 --
3242 -- Description
3243 --   This procedure is used to check that the Formula Rule is valid.
3244 --
3245 -- Pre Conditions
3246 --   None.
3247 --
3248 -- In Parameters
3249 --   ptip_id PK of record being inserted or updated.
3250 --   dpnt_cvg_end_dt_rl Value of formula rule id.
3251 --   effective_date effective date
3252 --   object_version_number Object version number of record being
3253 --                         inserted or updated.
3254 --
3255 -- Post Success
3256 --   Processing continues
3257 --
3258 -- Post Failure
3259 --   Error handled by procedure
3260 --
3261 -- Access Status
3262 --   Internal table handler use only.
3263 --
3264 Procedure chk_dpnt_cvg_end_dt_rl
3265               (p_ptip_id                in number,
3266                p_dpnt_cvg_end_dt_rl     in number,
3267                p_effective_date         in date,
3268                p_object_version_number  in number,
3269                p_business_group_id      in number) is
3270   --
3271   l_proc         varchar2(72) := g_package||'chk_dpnt_cvg_end_dt_rl';
3272   l_api_updating boolean;
3273   l_dummy        varchar2(1);
3274   --
3275   cursor c1 is
3276     select null
3277     from   ff_formulas_f ff ,
3278            per_business_groups pbg
3279     where  ff.formula_id = p_dpnt_cvg_end_dt_rl
3280     and    ff.formula_type_id = -28 /*default enrollment det */
3281     and    pbg.business_group_id = p_business_group_id
3282     and    nvl(ff.business_group_id, p_business_group_id) =
3283            p_business_group_id
3284     and    nvl(ff.legislation_code, pbg.legislation_code) =
3285            pbg.legislation_code
3286     and    p_effective_date
3287            between ff.effective_start_date
3288            and     ff.effective_end_date;
3289   --
3290 Begin
3291   --
3292   hr_utility.set_location('Entering:'||l_proc, 5);
3293   --
3294   l_api_updating := ben_ctp_shd.api_updating
3295     (p_ptip_id                => p_ptip_id,
3296      p_effective_date              => p_effective_date,
3297      p_object_version_number       => p_object_version_number);
3298   --
3299   if (l_api_updating
3300       and nvl(p_dpnt_cvg_end_dt_rl,hr_api.g_number)
3301       <> ben_ctp_shd.g_old_rec.dpnt_cvg_end_dt_rl
3302       or not l_api_updating)
3303       and p_dpnt_cvg_end_dt_rl is not null then
3304     --
3305     -- check if value of formula rule is valid.
3306     --
3307     open c1;
3308       --
3309       -- fetch value from cursor if it returns a record then the
3310       -- formula is valid otherwise its invalid
3311       --
3312       fetch c1 into l_dummy;
3313       if c1%notfound then
3314         --
3315         close c1;
3316         --
3317         -- raise error
3318         --
3319         fnd_message.set_name('BEN','BEN_91471_FORMULA_NOT_FOUND');
3320         fnd_message.set_token('ID',p_dpnt_cvg_end_dt_rl);
3321         fnd_message.set_token('TYPE_ID',-28);
3322         fnd_message.raise_error;
3323         --
3324       end if;
3325       --
3326     close c1;
3327     --
3328   end if;
3329   --
3330   hr_utility.set_location('Leaving:'||l_proc,10);
3331   --
3332 end chk_dpnt_cvg_end_dt_rl;
3333 --
3334 --
3335 -- ----------------------------------------------------------------------------
3336 -- |------< chk_dpnt_cvg_strt_dt_rl >------|
3337 -- ----------------------------------------------------------------------------
3338 --
3339 -- Description
3340 --   This procedure is used to check that the Formula Rule is valid.
3341 --
3342 -- Pre Conditions
3343 --   None.
3344 --
3345 -- In Parameters
3346 --   ptip_id PK of record being inserted or updated.
3347 --   dpnt_cvg_strt_dt_rl Value of formula rule id.
3348 --   effective_date effective date
3349 --   object_version_number Object version number of record being
3350 --                         inserted or updated.
3351 --
3352 -- Post Success
3353 --   Processing continues
3354 --
3355 -- Post Failure
3356 --   Error handled by procedure
3357 --
3358 -- Access Status
3359 --   Internal table handler use only.
3360 --
3361 Procedure chk_dpnt_cvg_strt_dt_rl
3362               (p_ptip_id                in number,
3363                p_dpnt_cvg_strt_dt_rl    in number,
3364                p_effective_date         in date,
3365                p_object_version_number  in number,
3366                p_business_group_id      in number) is
3367   --
3368   l_proc         varchar2(72) := g_package||'chk_dpnt_cvg_strt_dt_rl';
3369   l_api_updating boolean;
3370   l_dummy        varchar2(1);
3371   --
3372   cursor c1 is
3373     select null
3374     from   ff_formulas_f ff ,
3375            per_business_groups pbg
3376     where  ff.formula_id = p_dpnt_cvg_strt_dt_rl
3377     and    ff.formula_type_id = -27 /*default enrollment det */
3378     and    pbg.business_group_id = p_business_group_id
3379     and    nvl(ff.business_group_id, p_business_group_id) =
3380            p_business_group_id
3381     and    nvl(ff.legislation_code, pbg.legislation_code) =
3382            pbg.legislation_code
3383     and    p_effective_date
3384            between ff.effective_start_date
3385            and     ff.effective_end_date;
3386   --
3387 Begin
3388   --
3389   hr_utility.set_location('Entering:'||l_proc, 5);
3390   --
3391   l_api_updating := ben_ctp_shd.api_updating
3392     (p_ptip_id                     => p_ptip_id,
3393      p_effective_date              => p_effective_date,
3394      p_object_version_number       => p_object_version_number);
3395   --
3396   if (l_api_updating
3397       and nvl(p_dpnt_cvg_strt_dt_rl,hr_api.g_number)
3398       <> ben_ctp_shd.g_old_rec.dpnt_cvg_strt_dt_rl
3399       or not l_api_updating)
3400       and p_dpnt_cvg_strt_dt_rl is not null then
3401     --
3402     -- check if value of formula rule is valid.
3403     --
3404     open c1;
3405       --
3406       -- fetch value from cursor if it returns a record then the
3407       -- formula is valid otherwise its invalid
3408       --
3409       fetch c1 into l_dummy;
3410       if c1%notfound then
3411         --
3412         close c1;
3413         --
3414         -- raise error
3415         --
3416         fnd_message.set_name('BEN','BEN_91471_FORMULA_NOT_FOUND');
3417         fnd_message.set_token('ID',p_dpnt_cvg_strt_dt_rl);
3418         fnd_message.set_token('TYPE_ID',-27);
3419         fnd_message.raise_error;
3420         --
3421       end if;
3422       --
3423     close c1;
3424     --
3425   end if;
3426   --
3427   hr_utility.set_location('Leaving:'||l_proc,10);
3428   --
3429 end chk_dpnt_cvg_strt_dt_rl;
3430 --
3431 -- ----------------------------------------------------------------------------
3432 -- |------< chk_dpnt_strt_dt_cd >------|
3433 -- ----------------------------------------------------------------------------
3434 --
3435 -- Description
3436 --   This procedure is used to check that the lookup value is valid.
3437 --
3438 -- Pre Conditions
3439 --   None.
3440 --
3441 -- In Parameters
3442 --   ptip_id PK of record being inserted or updated.
3443 --   dpnt_strt_dt_cd Value of lookup code.
3444 --   effective_date effective date
3445 --   object_version_number Object version number of record being
3446 --                         inserted or updated.
3447 --
3448 -- Post Success
3449 --   Processing continues
3450 --
3451 -- Post Failure
3452 --   Error handled by procedure
3453 --
3454 -- Access Status
3455 --   Internal table handler use only.
3456 --
3457 Procedure chk_dpnt_cvg_strt_dt_cd(p_ptip_id               in number,
3458                             p_dpnt_cvg_strt_dt_cd         in varchar2,
3459                             p_effective_date              in date,
3460                             p_object_version_number       in number) is
3461   --
3462   l_proc         varchar2(72) := g_package||'chk_dpnt_cvg_strt_dt_cd';
3463   l_api_updating boolean;
3464   --
3465 Begin
3466   --
3467   hr_utility.set_location('Entering:'||l_proc, 5);
3468   --
3469   l_api_updating := ben_ctp_shd.api_updating
3470     (p_ptip_id                => p_ptip_id,
3471      p_effective_date              => p_effective_date,
3472      p_object_version_number       => p_object_version_number);
3473   --
3474   if (l_api_updating
3475       and p_dpnt_cvg_strt_dt_cd
3476       <> nvl(ben_ctp_shd.g_old_rec.dpnt_cvg_strt_dt_cd,hr_api.g_varchar2)
3477       or not l_api_updating) then
3478     --
3479     -- check if value of lookup falls within lookup type.
3480     --
3481     --
3482     if p_dpnt_cvg_strt_dt_cd is not null then
3483     if hr_api.not_exists_in_hr_lookups
3484           (p_lookup_type    => 'BEN_DPNT_CVG_STRT',
3485            p_lookup_code    => p_dpnt_cvg_strt_dt_cd,
3486            p_effective_date => p_effective_date) then
3487       --
3488       -- raise error as does not exist as lookup
3489       --
3490       fnd_message.set_name('BEN','BEN_91628_LOOKUP_TYPE_GENERIC');
3491       fnd_message.set_token('FIELD','p_dpnt_cvg_strt_dt_cd');
3492       fnd_message.set_token('TYPE','BEN_DPNT_CVG_STRT');
3493       fnd_message.raise_error;
3494       --
3495     end if;
3496     end if;
3497     --
3498   end if;
3499   --
3500   hr_utility.set_location('Leaving:'||l_proc,10);
3501   --
3502 end chk_dpnt_cvg_strt_dt_cd;
3503 --
3504 -- ----------------------------------------------------------------------------
3505 -- |------< chk_rt_strt_dt_cd >------|
3506 -- ----------------------------------------------------------------------------
3507 --
3508 -- Description
3509 --   This procedure is used to check that the lookup value is valid.
3510 --
3511 -- Pre Conditions
3512 --   None.
3513 --
3514 -- In Parameters
3515 --   ptip_id PK of record being inserted or updated.
3516 --   rt_strt_dt_cd Value of lookup code.
3517 --   effective_date effective date
3518 --   object_version_number Object version number of record being
3519 --                         inserted or updated.
3520 --
3521 -- Post Success
3522 --   Processing continues
3523 --
3524 -- Post Failure
3525 --   Error handled by procedure
3526 --
3527 -- Access Status
3528 --   Internal table handler use only.
3529 --
3530 Procedure chk_rt_strt_dt_cd(p_ptip_id                     in number,
3531                             p_rt_strt_dt_cd               in varchar2,
3532                             p_effective_date              in date,
3533                             p_object_version_number       in number) is
3534   --
3535   l_proc         varchar2(72) := g_package||'chk_rt_strt_dt_cd';
3536   l_api_updating boolean;
3537   --
3538 Begin
3539   --
3540   hr_utility.set_location('Entering:'||l_proc, 5);
3541   --
3542   l_api_updating := ben_ctp_shd.api_updating
3543     (p_ptip_id                     => p_ptip_id,
3544      p_effective_date              => p_effective_date,
3545      p_object_version_number       => p_object_version_number);
3546   --
3547   if (l_api_updating
3548       and p_rt_strt_dt_cd
3549       <> nvl(ben_ctp_shd.g_old_rec.rt_strt_dt_cd,hr_api.g_varchar2)
3550       or not l_api_updating) then
3551     --
3552     -- check if value of lookup falls within lookup type.
3553     --
3554     --
3555     if p_rt_strt_dt_cd is not null then
3556     if hr_api.not_exists_in_hr_lookups
3557           (p_lookup_type    => 'BEN_RT_STRT',
3558            p_lookup_code    => p_rt_strt_dt_cd,
3559            p_effective_date => p_effective_date) then
3560       --
3561       -- raise error as does not exist as lookup
3562       --
3563       fnd_message.set_name('BEN','BEN_91628_LOOKUP_TYPE_GENERIC');
3564       fnd_message.set_token('FIELD','p_rt_strt_dt_cd');
3565       fnd_message.set_token('TYPE','BEN_RT_STRT');
3566       fnd_message.raise_error;
3567       --
3568     end if;
3569     end if;
3570     --
3571   end if;
3572   --
3573   hr_utility.set_location('Leaving:'||l_proc,10);
3574   --
3575 end chk_rt_strt_dt_cd;
3576 --
3577 -- ----------------------------------------------------------------------------
3578 -- |------< chk_rt_end_dt_cd >------|
3579 -- ----------------------------------------------------------------------------
3580 --
3581 -- Description
3582 --   This procedure is used to check that the lookup value is valid.
3583 --
3584 -- Pre Conditions
3585 --   None.
3586 --
3587 -- In Parameters
3588 --   ptip_id PK of record being inserted or updated.
3589 --   rt_end_dt_cd Value of lookup code.
3590 --   effective_date effective date
3591 --   object_version_number Object version number of record being
3592 --                         inserted or updated.
3593 --
3594 -- Post Success
3595 --   Processing continues
3596 --
3597 -- Post Failure
3598 --   Error handled by procedure
3599 --
3600 -- Access Status
3601 --   Internal table handler use only.
3602 --
3603 Procedure chk_rt_end_dt_cd(p_ptip_id                     in number,
3604                             p_rt_end_dt_cd               in varchar2,
3605                             p_effective_date             in date,
3606                             p_object_version_number      in number) is
3607   --
3608   l_proc         varchar2(72) := g_package||'chk_rt_end_dt_cd';
3609   l_api_updating boolean;
3610   --
3611 Begin
3612   --
3613   hr_utility.set_location('Entering:'||l_proc, 5);
3614   --
3615   l_api_updating := ben_ctp_shd.api_updating
3616     (p_ptip_id                     => p_ptip_id,
3617      p_effective_date              => p_effective_date,
3618      p_object_version_number       => p_object_version_number);
3619   --
3620   if (l_api_updating
3621       and p_rt_end_dt_cd
3622       <> nvl(ben_ctp_shd.g_old_rec.rt_end_dt_cd,hr_api.g_varchar2)
3623       or not l_api_updating) then
3624     --
3625     -- check if value of lookup falls within lookup type.
3626     --
3627     --
3628     if p_rt_end_dt_cd is not null then
3629     if hr_api.not_exists_in_hr_lookups
3630           (p_lookup_type    => 'BEN_RT_END',
3631            p_lookup_code    => p_rt_end_dt_cd,
3632            p_effective_date => p_effective_date) then
3633       --
3634       -- raise error as does not exist as lookup
3635       --
3636       fnd_message.set_name('BEN','BEN_91628_LOOKUP_TYPE_GENERIC');
3637       fnd_message.set_token('FIELD','p_rt_end_dt_cd');
3638       fnd_message.set_token('TYPE','BEN_RT_END');
3639       fnd_message.raise_error;
3640       --
3641     end if;
3642     end if;
3643     --
3644   end if;
3645   --
3646   hr_utility.set_location('Leaving:'||l_proc,10);
3647   --
3648 end chk_rt_end_dt_cd;
3649 --
3650 -- ----------------------------------------------------------------------------
3651 -- |------< chk_enrt_strt_dt_cd >------|
3652 -- ----------------------------------------------------------------------------
3653 --
3654 -- Description
3655 --   This procedure is used to check that the lookup value is valid.
3656 --
3657 -- Pre Conditions
3658 --   None.
3659 --
3660 -- In Parameters
3661 --   ptip_id PK of record being inserted or updated.
3662 --   enrt_strt_dt_cd Value of lookup code.
3663 --   effective_date effective date
3664 --   object_version_number Object version number of record being
3665 --                         inserted or updated.
3666 --
3667 -- Post Success
3668 --   Processing continues
3669 --
3670 -- Post Failure
3671 --   Error handled by procedure
3672 --
3673 -- Access Status
3674 --   Internal table handler use only.
3675 --
3676 Procedure chk_enrt_cvg_end_dt_cd(p_ptip_id                in number,
3677                             p_enrt_cvg_end_dt_cd          in varchar2,
3678                             p_effective_date              in date,
3679                             p_object_version_number       in number) is
3680   --
3681   l_proc         varchar2(72) := g_package||'chk_enrt_cvg_end_dt_cd';
3682   l_api_updating boolean;
3683   --
3684 Begin
3685   --
3686   hr_utility.set_location('Entering:'||l_proc, 5);
3687   --
3688   l_api_updating := ben_ctp_shd.api_updating
3689     (p_ptip_id                     => p_ptip_id,
3690      p_effective_date              => p_effective_date,
3691      p_object_version_number       => p_object_version_number);
3692   --
3693   if (l_api_updating
3694       and p_enrt_cvg_end_dt_cd
3695       <> nvl(ben_ctp_shd.g_old_rec.enrt_cvg_end_dt_cd,hr_api.g_varchar2)
3696       or not l_api_updating) then
3697     --
3698     -- check if value of lookup falls within lookup type.
3699     --
3700     --
3701     if p_enrt_cvg_end_dt_cd is not null then
3702     if hr_api.not_exists_in_hr_lookups
3703           (p_lookup_type    => 'BEN_ENRT_CVG_END',
3704            p_lookup_code    => p_enrt_cvg_end_dt_cd,
3705            p_effective_date => p_effective_date) then
3706       --
3707       -- raise error as does not exist as lookup
3708       --
3709       fnd_message.set_name('BEN','BEN_91628_LOOKUP_TYPE_GENERIC');
3710       fnd_message.set_token('FIELD','p_enrt_cvg_end_dt_cd');
3711       fnd_message.set_token('TYPE','BEN_ENRT_CVG_END');
3712       fnd_message.raise_error;
3713       --
3714     end if;
3715     end if;
3716     --
3717   end if;
3718   --
3719   hr_utility.set_location('Leaving:'||l_proc,10);
3720   --
3721 end chk_enrt_cvg_end_dt_cd;
3722 --
3723 -- ----------------------------------------------------------------------------
3724 -- |------< chk_enrt_strt_dt_cd >------|
3725 -- ----------------------------------------------------------------------------
3726 --
3727 -- Description
3728 --   This procedure is used to check that the lookup value is valid.
3729 --
3730 -- Pre Conditions
3731 --   None.
3732 --
3733 -- In Parameters
3734 --   ptip_id PK of record being inserted or updated.
3735 --   enrt_strt_dt_cd Value of lookup code.
3736 --   effective_date effective date
3737 --   object_version_number Object version number of record being
3738 --                         inserted or updated.
3739 --
3740 -- Post Success
3741 --   Processing continues
3742 --
3743 -- Post Failure
3744 --   Error handled by procedure
3745 --
3746 -- Access Status
3747 --   Internal table handler use only.
3748 --
3749 Procedure chk_enrt_cvg_strt_dt_cd(p_ptip_id               in number,
3750                             p_enrt_cvg_strt_dt_cd         in varchar2,
3751                             p_effective_date              in date,
3752                             p_object_version_number       in number) is
3753   --
3754   l_proc         varchar2(72) := g_package||'chk_enrt_cvg_strt_dt_cd';
3755   l_api_updating boolean;
3756   --
3757 Begin
3758   --
3759   hr_utility.set_location('Entering:'||l_proc, 5);
3760   --
3761   l_api_updating := ben_ctp_shd.api_updating
3762     (p_ptip_id                     => p_ptip_id,
3763      p_effective_date              => p_effective_date,
3764      p_object_version_number       => p_object_version_number);
3765   --
3766   if (l_api_updating
3767       and p_enrt_cvg_strt_dt_cd
3768       <> nvl(ben_ctp_shd.g_old_rec.enrt_cvg_strt_dt_cd,hr_api.g_varchar2)
3769       or not l_api_updating) then
3770     --
3771     -- check if value of lookup falls within lookup type.
3772     --
3773     --
3774     if p_enrt_cvg_strt_dt_cd is not null then
3775     if hr_api.not_exists_in_hr_lookups
3776           (p_lookup_type    => 'BEN_ENRT_CVG_STRT',
3777            p_lookup_code    => p_enrt_cvg_strt_dt_cd,
3778            p_effective_date => p_effective_date) then
3779       --
3780       -- raise error as does not exist as lookup
3781       --
3782       fnd_message.set_name('BEN','BEN_91628_LOOKUP_TYPE_GENERIC');
3783       fnd_message.set_token('FIELD','p_enrt_cvg_strt_dt_cd');
3784       fnd_message.set_token('TYPE','BEN_ENRT_CVG_STRT');
3785       fnd_message.raise_error;
3786       --
3787     end if;
3788     end if;
3789     --
3790   end if;
3791   --
3792   hr_utility.set_location('Leaving:'||l_proc,10);
3793   --
3794 end chk_enrt_cvg_strt_dt_cd;
3795 --
3796 --
3797 -- ----------------------------------------------------------------------------
3798 -- |------< chk_dpnt_cvg_end_dt_cd >------|
3799 -- ----------------------------------------------------------------------------
3800 --
3801 -- Description
3802 --   This procedure is used to check that the lookup value is valid.
3803 --
3804 -- Pre Conditions
3805 --   None.
3806 --
3807 -- In Parameters
3808 --   ptip_id PK of record being inserted or updated.
3809 --   dpnt_cvg_end_dt_cd Value of lookup code.
3810 --   effective_date effective date
3811 --   object_version_number Object version number of record being
3812 --                         inserted or updated.
3813 --
3814 -- Post Success
3815 --   Processing continues
3816 --
3817 -- Post Failure
3818 --   Error handled by procedure
3819 --
3820 -- Access Status
3821 --   Internal table handler use only.
3822 --
3823 Procedure chk_dpnt_cvg_end_dt_cd(p_ptip_id                in number,
3824                             p_dpnt_cvg_end_dt_cd          in varchar2,
3825                             p_effective_date              in date,
3826                             p_object_version_number       in number) is
3827   --
3828   l_proc         varchar2(72) := g_package||'chk_dpnt_cvg_end_dt_cd';
3829   l_api_updating boolean;
3830   --
3831 Begin
3832   --
3833   hr_utility.set_location('Entering:'||l_proc, 5);
3834   --
3835   l_api_updating := ben_ctp_shd.api_updating
3836     (p_ptip_id                     => p_ptip_id,
3837      p_effective_date              => p_effective_date,
3838      p_object_version_number       => p_object_version_number);
3839   --
3840   if (l_api_updating
3841       and p_dpnt_cvg_end_dt_cd
3842       <> nvl(ben_ctp_shd.g_old_rec.dpnt_cvg_end_dt_cd,hr_api.g_varchar2)
3843       or not l_api_updating) then
3844     --
3845     -- check if value of lookup falls within lookup type.
3846     --
3847     --
3848     if p_dpnt_cvg_end_dt_cd is not null then
3849     if hr_api.not_exists_in_hr_lookups
3850           (p_lookup_type    => 'BEN_DPNT_CVG_END',
3851            p_lookup_code    => p_dpnt_cvg_end_dt_cd,
3852            p_effective_date => p_effective_date) then
3853       --
3854       -- raise error as does not exist as lookup
3855       --
3856       fnd_message.set_name('BEN','BEN_91628_LOOKUP_TYPE_GENERIC');
3857       fnd_message.set_token('FIELD','p_dpnt_cvg_end_dt_cd');
3858       fnd_message.set_token('TYPE','BEN_DPNT_CVG_END');
3859       fnd_message.raise_error;
3860       --
3861     end if;
3862     end if;
3863     --
3864   end if;
3865   --
3866   hr_utility.set_location('Leaving:'||l_proc,10);
3867   --
3868 end chk_dpnt_cvg_end_dt_cd;
3869 --
3870 -- ----------------------------------------------------------------------------
3871 -- |------< chk_coord_cvg_for_all_pls_flag >------|
3872 -- ----------------------------------------------------------------------------
3873 --
3874 -- Description
3875 --   This procedure is used to check that the lookup value is valid.
3876 --
3877 -- Pre Conditions
3878 --   None.
3879 --
3880 -- In Parameters
3881 --   ptip_id PK of record being inserted or updated.
3882 --   coord_cvg_for_all_pls_flag Value of lookup code.
3883 --   effective_date effective date
3884 --   object_version_number Object version number of record being
3885 --                         inserted or updated.
3886 --
3887 -- Post Success
3888 --   Processing continues
3889 --
3890 -- Post Failure
3891 --   Error handled by procedure
3892 --
3893 -- Access Status
3894 --   Internal table handler use only.
3895 --
3896 Procedure chk_coord_cvg_for_all_pls_flag(p_ptip_id        in number,
3897                             p_coord_cvg_for_all_pls_flag  in varchar2,
3898                             p_effective_date              in date,
3899                             p_object_version_number       in number) is
3900   --
3901   l_proc         varchar2(72) := g_package||'chk_coord_cvg_for_all_pls_flag';
3902   l_api_updating boolean;
3903   --
3904 Begin
3905   --
3906   hr_utility.set_location('Entering:'||l_proc, 5);
3907   --
3908   l_api_updating := ben_ctp_shd.api_updating
3909     (p_ptip_id                     => p_ptip_id,
3910      p_effective_date              => p_effective_date,
3911      p_object_version_number       => p_object_version_number);
3912   --
3913   if (l_api_updating
3914       and p_coord_cvg_for_all_pls_flag
3915       <> nvl(ben_ctp_shd.g_old_rec.coord_cvg_for_all_pls_flag,hr_api.g_varchar2)
3916       or not l_api_updating)
3917       and p_coord_cvg_for_all_pls_flag is not null then
3918     --
3919     -- check if value of lookup falls within lookup type.
3920     --
3921     if hr_api.not_exists_in_hr_lookups
3922           (p_lookup_type    => 'YES_NO',
3923            p_lookup_code    => p_coord_cvg_for_all_pls_flag,
3924            p_effective_date => p_effective_date) then
3925       --
3926       -- raise error as does not exist as lookup
3927       --
3928       fnd_message.set_name('BEN','BEN_91237_INV_COORD_CVG_FLAG');
3929       fnd_message.raise_error;
3930       --
3931     end if;
3932     --
3933   end if;
3934   --
3935   hr_utility.set_location('Leaving:'||l_proc,10);
3936   --
3937 end chk_coord_cvg_for_all_pls_flag;
3938 --
3939 -- ----------------------------------------------------------------------------
3940 -- |------< chk_rqd_perd_enrt_nenrt_dpndcy >------|
3941 -- ----------------------------------------------------------------------------
3942 --
3943 -- Description
3944 --   When there is a value for Required Period of Enrollment Non Enrollment, there
3945 --   must be a value for Required Period of Enrollment Non Enrollment Unit of Measure.
3946 --
3947 -- Pre Conditions
3948 --   None.
3949 --
3950 -- In Parameters
3951 --   ptip_id PK of record being inserted or updated.
3952 --	rqd_perd_enrt_nenrt_val
3953 --    rqd_perd_enrt_nenrt_tm_uom
3954 --   effective_date effective date
3955 --   object_version_number Object version number of record being
3956 --                         inserted or updated.
3957 --
3958 -- Post Success
3959 --   Processing continues
3960 --
3961 -- Post Failure
3962 --   Error handled by procedure
3963 --
3964 -- Access Status
3965 --   Internal table handler use only.
3966 --
3967 Procedure chk_rqd_perd_enrt_nenrt_dpndcy(p_ptip_id              in number,
3968 	                      p_rqd_perd_enrt_nenrt_val         in number,
3969 	                      p_rqd_perd_enrt_nenrt_tm_uom      in varchar2,
3970                               p_effective_date                  in date,
3971                               p_object_version_number           in number) is
3972   --
3973   l_proc         varchar2(72) := g_package||'chk_rqd_perd_enrt_nenrt_dpndcy';
3974   l_api_updating boolean;
3975   --
3976 Begin
3977   --
3978   hr_utility.set_location('Entering:'||l_proc, 5);
3979   --
3980   l_api_updating := ben_ctp_shd.api_updating
3981     (p_ptip_id                     => p_ptip_id,
3982      p_effective_date              => p_effective_date,
3983      p_object_version_number       => p_object_version_number);
3984   --
3985   if (l_api_updating
3986       and
3987          (nvl(p_rqd_perd_enrt_nenrt_val,hr_api.g_number)
3988                <> nvl(ben_ctp_shd.g_old_rec.rqd_perd_enrt_nenrt_val,hr_api.g_number) or
3989           nvl(p_rqd_perd_enrt_nenrt_tm_uom,hr_api.g_varchar2)
3990                <> nvl(ben_ctp_shd.g_old_rec.rqd_perd_enrt_nenrt_tm_uom,hr_api.g_varchar2))
3991       or not l_api_updating) then
3992     --
3993     -- check dependency.
3994     --
3995     if (p_rqd_perd_enrt_nenrt_val is null and p_rqd_perd_enrt_nenrt_tm_uom is not null) or
3996        (p_rqd_perd_enrt_nenrt_val is not null and p_rqd_perd_enrt_nenrt_tm_uom is null) then
3997       --
3998       fnd_message.set_name('BEN','BEN_91238_RQD_PERD_ENRT_DPCY');
3999       fnd_message.raise_error;
4000       --
4001     end if;
4002     --
4003   end if;
4004   --
4005   hr_utility.set_location('Leaving:'||l_proc,10);
4006   --
4007 end chk_rqd_perd_enrt_nenrt_dpndcy;
4008 --
4009 --
4010 -- ----------------------------------------------------------------------------
4011 -- |------< chk_max_num_ovrd_flg_dpndcy >------|
4012 -- ----------------------------------------------------------------------------
4013 --
4014 -- Description
4015 --   If No Maximum Number of Plan Type Override Flag = 'YES' then
4016 --   Maximum Enrolled Allowed Override Number must be blank.  At least
4017 --   one of the two are required.
4018 --
4019 -- Pre Conditions
4020 --   None.
4021 --
4022 -- In Parameters
4023 --   ptip_id PK of record being inserted or updated.
4024 --	no_mx_pl_typ_ovrid_flag
4025 --    mx_enrd_alwd_ovrid_num
4026 --   effective_date effective date
4027 --   object_version_number Object version number of record being
4028 --                         inserted or updated.
4029 --
4030 -- Post Success
4031 --   Processing continues
4032 --
4033 -- Post Failure
4034 --   Error handled by procedure
4035 --
4036 -- Access Status
4037 --   Internal table handler use only.
4038 --
4039 Procedure chk_max_num_ovrd_flg_dpndcy(p_ptip_id                in number,
4040   				 p_mx_enrd_alwd_ovrid_num      in number,
4041 				 p_no_mx_pl_typ_ovrid_flag     in varchar2,
4042                                  p_effective_date              in date,
4043                                  p_object_version_number       in number) is
4044   --
4045   l_proc         varchar2(72) := g_package||'chk_max_num_ovrd_flg_dpndcy';
4046   l_api_updating boolean;
4047   --
4048 Begin
4049   --
4050   hr_utility.set_location('Entering:'||l_proc, 5);
4051   --
4052   l_api_updating := ben_ctp_shd.api_updating
4053     (p_ptip_id                     => p_ptip_id,
4054      p_effective_date              => p_effective_date,
4055      p_object_version_number       => p_object_version_number);
4056   --
4057   if (l_api_updating
4058       and
4059          (nvl(p_mx_enrd_alwd_ovrid_num,hr_api.g_number)
4060                <> nvl(ben_ctp_shd.g_old_rec.mx_enrd_alwd_ovrid_num,hr_api.g_number) or
4061           nvl(p_no_mx_pl_typ_ovrid_flag,hr_api.g_varchar2)
4062                <> nvl(ben_ctp_shd.g_old_rec.no_mx_pl_typ_ovrid_flag,hr_api.g_varchar2))
4063       or not l_api_updating) then
4064     --
4065     -- If flag = 'Y' then num must be null.
4066     --
4067     if p_no_mx_pl_typ_ovrid_flag = 'Y' and p_mx_enrd_alwd_ovrid_num is not null then
4068       --
4069       fnd_message.set_name('BEN','BEN_91240_MX_OVRD_FLG_DPCY');
4070       fnd_message.raise_error;
4071       --
4072     end if;
4073     --
4074   end if;
4075   --
4076   hr_utility.set_location('Leaving:'||l_proc,10);
4077   --
4078 end chk_max_num_ovrd_flg_dpndcy;
4079 -- ----------------------------------------------------------------------------
4080 -- |------< chk_min_num_ovrd_flg_dpndcy >------|
4081 -- ----------------------------------------------------------------------------
4082 --
4083 -- Description
4084 --   If No Minimum Number of Plan Type Override Flag = 'YES' then
4085 --   Minimum Enrolled Allowed Override Number must be blank.  At least
4086 --   One of the two are required.
4087 --
4088 -- Pre Conditions
4089 --   None.
4090 --
4091 -- In Parameters
4092 --   ptip_id PK of record being inserted or updated.
4093 --	no_mn_pl_typ_overid_flag
4094 --    mn_enrd_rqd_ovrid_num
4095 --   effective_date effective date
4096 --   object_version_number Object version number of record being
4097 --                         inserted or updated.
4098 --
4099 -- Post Success
4100 --   Processing continues
4101 --
4102 -- Post Failure
4103 --   Error handled by procedure
4104 --
4105 -- Access Status
4106 --   Internal table handler use only.
4107 --
4108 Procedure chk_min_num_ovrd_flg_dpndcy(p_ptip_id                in number,
4109   				 p_mn_enrd_rqd_ovrid_num       in number,
4110 				 p_no_mn_pl_typ_overid_flag    in varchar2,
4111                                  p_effective_date              in date,
4112                                  p_object_version_number       in number) is
4113   --
4114   l_proc         varchar2(72) := g_package||'chk_min_num_ovrd_flg_dpndcy';
4115   l_api_updating boolean;
4116   --
4117 Begin
4118   --
4119   hr_utility.set_location('Entering:'||l_proc, 5);
4120   --
4121   l_api_updating := ben_ctp_shd.api_updating
4122     (p_ptip_id                     => p_ptip_id,
4123      p_effective_date              => p_effective_date,
4124      p_object_version_number       => p_object_version_number);
4125   --
4126   if (l_api_updating
4127       and
4128          (nvl(p_mn_enrd_rqd_ovrid_num,hr_api.g_number)
4129                <> nvl(ben_ctp_shd.g_old_rec.mn_enrd_rqd_ovrid_num,hr_api.g_number) or
4130           nvl(p_no_mn_pl_typ_overid_flag,hr_api.g_varchar2)
4131                <> nvl(ben_ctp_shd.g_old_rec.no_mn_pl_typ_overid_flag,hr_api.g_varchar2))
4132       or not l_api_updating) then
4133     --
4134     -- If flag = 'Y' then num must be null.
4135     --
4136     if p_no_mn_pl_typ_overid_flag = 'Y' and p_mn_enrd_rqd_ovrid_num is not null then
4137       --
4138       fnd_message.set_name('BEN','BEN_91241_MN_OVRD_FLG_DPCY');
4139       fnd_message.raise_error;
4140       --
4141     end if;
4142     --
4143   end if;
4144   --
4145   hr_utility.set_location('Leaving:'||l_proc,10);
4146   --
4147 end chk_min_num_ovrd_flg_dpndcy;
4148 --
4149 -- ----------------------------------------------------------------------------
4150 -- |------< chk_mx_enrd_alwd_ovrid_num >------|
4151 -- ----------------------------------------------------------------------------
4152 --
4153 -- Description
4154 --   Maximum Enrolled Allowed Override Number must be greater than BEN_PL_TYP_F
4155 --   Maximum enrolled Allowed Number.
4156 --
4157 -- Pre Conditions
4158 --   None.
4159 --
4160 -- In Parameters
4161 --   ptip_id PK of record being inserted or updated.
4162 --    mx_enrd_alwd_ovrid_num
4163 --   effective_date effective date
4164 --   object_version_number Object version number of record being
4165 --                         inserted or updated.
4166 --
4167 -- Post Success
4168 --   Processing continues
4169 --
4170 -- Post Failure
4171 --   Error handled by procedure
4172 --
4173 -- Access Status
4174 --   Internal table handler use only.
4175 --
4176 Procedure chk_mx_enrd_alwd_ovrid_num(p_ptip_id                 in number,
4177                                  p_pl_typ_id                   in number,
4178   			         p_mx_enrd_alwd_ovrid_num      in number,
4179                                  p_effective_date              in date,
4180                                  p_business_group_id           in number,
4181                                  p_object_version_number       in number) is
4182   --
4183   l_proc         varchar2(72) := g_package||'chk_mx_enrd_alwd_ovrid_num';
4184   l_api_updating boolean;
4185   l_value number;
4186   --
4187    cursor c1 is select mx_enrl_alwd_num
4188                   from ben_pl_typ_f pt
4189                   where pt.pl_typ_id = p_pl_typ_id
4190                     and pt.business_group_id +0 = p_business_group_id
4191                     and p_effective_date between pt.effective_start_date
4192                                              and pt.effective_end_date;
4193   --
4194 Begin
4195   --
4196   hr_utility.set_location('Entering:'||l_proc, 5);
4197   --
4198   l_api_updating := ben_ctp_shd.api_updating
4199     (p_ptip_id                     => p_ptip_id,
4200      p_effective_date              => p_effective_date,
4201      p_object_version_number       => p_object_version_number);
4202   --
4203   if (l_api_updating
4204       and nvl(p_mx_enrd_alwd_ovrid_num,hr_api.g_number)
4205                <> nvl(ben_ctp_shd.g_old_rec.mx_enrd_alwd_ovrid_num,hr_api.g_number)
4206       or not l_api_updating) then
4207     --
4208     -- Max enrolled allowed override number must be greater than that of plan type
4209     -- Bypass this edit if either is null   - Verify this.
4210     --
4211     if p_mx_enrd_alwd_ovrid_num is not null then
4212       open c1;
4213       fetch c1 into l_value;
4214       if c1%found then
4215         --
4216         if p_mx_enrd_alwd_ovrid_num < nvl(l_value,p_mx_enrd_alwd_ovrid_num) then
4217           --
4218           close c1;
4219           fnd_message.set_name('BEN','BEN_91243_INV_MX_ENRT_OVRD_NUM');
4220           fnd_message.raise_error;
4221           --
4222         end if;
4223       end if;
4224       close c1;
4225     end if;
4226     --
4227   end if;
4228   --
4229   hr_utility.set_location('Leaving:'||l_proc,10);
4230   --
4231 end chk_mx_enrd_alwd_ovrid_num;
4232 --
4233 -- ----------------------------------------------------------------------------
4234 -- |------< chk_mn_enrd_rqd_ovrid_num >------|
4235 -- ----------------------------------------------------------------------------
4236 --
4237 -- Description
4238 --   Minimum Enrolled Required Override Number must be greater than BEN_PL_TYP_F
4239 --   Minimum enrolled Required Number.
4240 --
4241 -- Pre Conditions
4242 --   None.
4243 --
4244 -- In Parameters
4245 --   ptip_id PK of record being inserted or updated.
4246 --    mn_enrd_rqd_ovrid_num
4247 --   effective_date effective date
4248 --   object_version_number Object version number of record being
4249 --                         inserted or updated.
4250 --
4251 -- Post Success
4252 --   Processing continues
4253 --
4254 -- Post Failure
4255 --   Error handled by procedure
4256 --
4257 -- Access Status
4258 --   Internal table handler use only.
4259 --
4260 Procedure chk_mn_enrd_rqd_ovrid_num(p_ptip_id                  in number,
4261                                  p_pl_typ_id                   in number,
4262   				 p_mn_enrd_rqd_ovrid_num       in number,
4263                                  p_effective_date              in date,
4264                                  p_business_group_id           in number,
4265                                  p_object_version_number       in number) is
4266   --
4267   l_proc         varchar2(72) := g_package||'chk_mn_enrd_rqd_ovrid_num';
4268   l_api_updating boolean;
4269   l_value number;
4270   --
4271    cursor c1 is select mn_enrl_rqd_num
4272                   from ben_pl_typ_f pt
4273                   where pt.pl_typ_id = p_pl_typ_id
4274                     and pt.business_group_id +0 = p_business_group_id
4275                     and p_effective_date between pt.effective_start_date
4276                                              and pt.effective_end_date;
4277   --
4278 Begin
4279   --
4280   hr_utility.set_location('Entering:'||l_proc, 5);
4281   --
4282   l_api_updating := ben_ctp_shd.api_updating
4283     (p_ptip_id                     => p_ptip_id,
4284      p_effective_date              => p_effective_date,
4285      p_object_version_number       => p_object_version_number);
4286   --
4287   if (l_api_updating
4288       and nvl(p_mn_enrd_rqd_ovrid_num,hr_api.g_number)
4289                <> nvl(ben_ctp_shd.g_old_rec.mn_enrd_rqd_ovrid_num,hr_api.g_number)
4290       or not l_api_updating) then
4291     --
4292     -- Min enrolled allowed override number must be greater than that of plan type
4293     -- Bypass this edit if either is null   - Verify this.
4294     --
4295     if p_mn_enrd_rqd_ovrid_num is not null then
4296       open c1;
4297       fetch c1 into l_value;
4298       if c1%found then
4299         --
4300         if p_mn_enrd_rqd_ovrid_num < nvl(l_value,p_mn_enrd_rqd_ovrid_num) then
4301           --
4302           close c1;
4303           fnd_message.set_name('BEN','BEN_91244_INV_MN_ENRT_OVRD_NUM');
4304           fnd_message.raise_error;
4305           --
4306         end if;
4307       end if;
4308       close c1;
4309     end if;
4310   end if;
4311   --
4312   hr_utility.set_location('Leaving:'||l_proc,10);
4313   --
4314 end chk_mn_enrd_rqd_ovrid_num;
4315 --
4316 -- ----------------------------------------------------------------------------
4317 -- |------< chk_min_num_ovrd_dpndcy >------|
4318 -- ----------------------------------------------------------------------------
4319 --
4320 -- Description
4321 --   NOTE:  because of two prior chk procedures, this will never happen.
4322 --   So I have commented out the calls to it!  tvh.
4323 --
4324 --   If minimum enrolled required override number is not null, then
4325 --   maximum enrolled overide allowed number cannot be null OR the
4326 --   no maximum number of plan type override flag must be 'YES'.
4327 --
4328 --
4329 -- Pre Conditions
4330 --   None.
4331 --
4332 -- In Parameters
4333 --   ptip_id PK of record being inserted or updated.
4334 --	no_mx_pl_typ_ovrid_flag
4335 --    mx_enrd_alwd_ovrid_num
4336 --    mn_enrd_rqd_ovrid_num
4337 --   effective_date effective date
4338 --   object_version_number Object version number of record being
4339 --                         inserted or updated.
4340 --
4341 -- Post Success
4342 --   Processing continues
4343 --
4344 -- Post Failure
4345 --   Error handled by procedure
4346 --
4347 -- Access Status
4348 --   Internal table handler use only.
4349 --
4350 Procedure chk_min_num_ovrd_dpndcy(p_ptip_id                    in number,
4351   			         p_mx_enrd_alwd_ovrid_num      in number,
4352   			         p_mn_enrd_rqd_ovrid_num       in number,
4353 	         	         p_no_mx_pl_typ_ovrid_flag     in varchar2,
4354                                  p_effective_date              in date,
4355                                  p_object_version_number       in number) is
4356   --
4357   l_proc         varchar2(72) := g_package||'chk_min_num_ovrd_dpndcy';
4358   l_api_updating boolean;
4359   --
4360 Begin
4361   --
4362   hr_utility.set_location('Entering:'||l_proc, 5);
4363   --
4364   l_api_updating := ben_ctp_shd.api_updating
4365     (p_ptip_id                     => p_ptip_id,
4366      p_effective_date              => p_effective_date,
4367      p_object_version_number       => p_object_version_number);
4368   --
4369   if (l_api_updating
4370       and
4371          (nvl(p_mx_enrd_alwd_ovrid_num,hr_api.g_number)
4372                <> nvl(ben_ctp_shd.g_old_rec.mx_enrd_alwd_ovrid_num,hr_api.g_number) or
4373           nvl(p_no_mx_pl_typ_ovrid_flag,hr_api.g_varchar2)
4374                <> nvl(ben_ctp_shd.g_old_rec.no_mx_pl_typ_ovrid_flag,hr_api.g_varchar2) or
4375           nvl(p_mn_enrd_rqd_ovrid_num,hr_api.g_number)
4376                <> nvl(ben_ctp_shd.g_old_rec.mn_enrd_rqd_ovrid_num,hr_api.g_number))
4377       or not l_api_updating) then
4378     --
4379     -- If min amount has value then max amount must have value or flag must be 'Y'.
4380     --
4381     if p_mn_enrd_rqd_ovrid_num is not null and p_mx_enrd_alwd_ovrid_num is null and
4382         p_no_mx_pl_typ_ovrid_flag <> 'Y' then
4383       --
4384       fnd_message.set_name('BEN','mn_num_dpndcy_err');
4385       fnd_message.raise_error;
4386       --
4387     end if;
4388     --
4389   end if;
4390   --
4391   hr_utility.set_location('Leaving:'||l_proc,10);
4392   --
4393 end chk_min_num_ovrd_dpndcy;
4394 --
4395 -- ----------------------------------------------------------------------------
4396 -- |------< chk_dpnt_dsgn_cd_dpndcy >------|
4397 -- ----------------------------------------------------------------------------
4398 --
4399 -- Description
4400 --   If dependent designation code is not 'Required' or 'Optional', then the
4401 --   following must be null:  Cert Req Flag and Derivable Factors Apply Flag.
4402 --
4403 --
4404 -- Pre Conditions
4405 --   None.
4406 --
4407 -- In Parameters
4408 --   ptip_id PK of record being inserted or updated.
4409 --   dpnt_dsgn_cd Value of lookup code.
4410 --   drvd_fctr_dpnt_cvg_flag
4411 --   effective_date effective date
4412 --   object_version_number Object version number of record being
4413 --                         inserted or updated.
4414 --
4415 -- Post Success
4416 --   Processing continues
4417 --
4418 -- Post Failure
4419 --   Error handled by procedure
4420 --
4421 -- Access Status
4422 --   Internal table handler use only.
4423 --
4424 Procedure chk_dpnt_dsgn_cd_dpndcy(p_ptip_id                     in number,
4425                                   p_dpnt_dsgn_cd                in varchar2,
4426   				  p_drvd_fctr_dpnt_cvg_flag     in varchar2,
4427                                   p_effective_date              in date,
4428                                   p_object_version_number       in number) is
4429   --
4430   l_proc         varchar2(72) := g_package||'chk_dpnt_dsgn_cd_dpndcy';
4431   l_api_updating boolean;
4432   --
4433 Begin
4434   --
4435   hr_utility.set_location('Entering:'||l_proc, 5);
4436   --
4437   l_api_updating := ben_ctp_shd.api_updating
4438     (p_ptip_id                     => p_ptip_id,
4439      p_effective_date              => p_effective_date,
4440      p_object_version_number       => p_object_version_number);
4441   --
4442   if (l_api_updating
4443       and
4444          (nvl(p_dpnt_dsgn_cd,hr_api.g_varchar2)
4445                <> nvl(ben_ctp_shd.g_old_rec.dpnt_dsgn_cd,hr_api.g_varchar2) or
4446           nvl(p_drvd_fctr_dpnt_cvg_flag,hr_api.g_varchar2)
4447                <> nvl(ben_ctp_shd.g_old_rec.drvd_fctr_dpnt_cvg_flag,hr_api.g_varchar2))
4448       or not l_api_updating) then
4449     --
4450  if nvl(p_dpnt_dsgn_cd,'X') not in ('R','O') and
4451            (p_drvd_fctr_dpnt_cvg_flag = 'Y' ) then
4452              --
4453              hr_utility.set_message('BEN','BEN_91247_PT_DPNT_DSGN_RQD');
4454              hr_utility.raise_error;
4455              --
4456     end if;
4457     --
4458   end if;
4459   --
4460   hr_utility.set_location('Leaving:'||l_proc,10);
4461   --
4462 end chk_dpnt_dsgn_cd_dpndcy;
4463 --
4464 --
4465 -- ----------------------------------------------------------------------------
4466 -- |------< chk_dpnt_dsgn_cd_detail >------|
4467 -- ----------------------------------------------------------------------------
4468 --
4469 -- Description
4470 --   If dependent designation level is null then the following tables must
4471 --   contain no records for that program:  BEN_LER_CHG_DPNT_CVG_F,
4472 --   BEN_APLD_DPNT_CVG_ELIG_PRFL_F, BEN_PGM_DPNT_CVG_CTFN_F.
4473 --
4474 -- Pre Conditions
4475 --   None.
4476 --
4477 -- In Parameters
4478 --   pgm_id PK of record being inserted or updated.
4479 --   dpnt_dsgn_cd Value of lookup code.
4480 --    pgm_id
4481 --    business_group_id
4482 --   effective_date effective date
4483 --   object_version_number Object version number of record being
4484 --                         inserted or updated.
4485 --
4486 -- Post Success
4487 --   Processing continues
4488 --
4489 -- Post Failure
4490 --   Error handled by procedure
4491 --
4492 -- Access Status
4493 --   Internal table handler use only.
4494 --
4495 Procedure chk_dpnt_dsgn_cd_detail(p_ptip_id                    in number,
4496                                  p_dpnt_dsgn_cd                in varchar2,
4497                                  p_business_group_id           in number,
4498                                  p_effective_date              in date,
4499                                  p_object_version_number       in number) is
4500   --
4501   l_proc         varchar2(72) := g_package || 'chk_dpnt_dsgn_cd_detail';
4502   l_api_updating boolean;
4503   l_dummy varchar2(1);
4504   --
4505   cursor c1 is select 'x'
4506                   from ben_ler_chg_dpnt_cvg_f ldc
4507                   where ldc.ptip_id = p_ptip_id
4508                     and ldc.business_group_id + 0 = p_business_group_id
4509                     and p_effective_date between ldc.effective_start_date
4510                                              and ldc.effective_end_date;
4511   --
4512   cursor c2 is select 'x'
4513                   from ben_apld_dpnt_cvg_elig_prfl_f ade
4514                   where ade.ptip_id = p_ptip_id
4515                     and ade.business_group_id + 0 = p_business_group_id
4516                     and p_effective_date between ade.effective_start_date
4517                                              and ade.effective_end_date;
4518   --
4519   cursor c3 is select 'x'
4520                   from ben_ptip_dpnt_cvg_ctfn_f pgc
4521                   where pgc.ptip_id = p_ptip_id
4522                     and pgc.business_group_id + 0 = p_business_group_id
4523                     and p_effective_date between pgc.effective_start_date
4524                                              and pgc.effective_end_date;
4525   --
4526 Begin
4527   --
4528   hr_utility.set_location('Entering:'||l_proc, 5);
4529   --
4530   l_api_updating := ben_ctp_shd.api_updating
4531     (p_ptip_id                    => p_ptip_id,
4532      p_effective_date             => p_effective_date,
4533      p_object_version_number      => p_object_version_number);
4534   --
4535 
4536  if (l_api_updating
4537       and nvl(p_dpnt_dsgn_cd,hr_api.g_varchar2)
4538                <> nvl(ben_ctp_shd.g_old_rec.dpnt_dsgn_cd,hr_api.g_varchar2)
4539       or not l_api_updating) then
4540     null;
4541     --
4542     -- If ldc records exists and designation is null then error
4543     --
4544     if (p_dpnt_dsgn_cd is null) then
4545       open c1;
4546       fetch c1 into l_dummy;
4547       if c1%found then
4548          --
4549          close c1;
4550          fnd_message.set_name('BEN','BEN_92518_DELETE_LDC');
4551          fnd_message.raise_error;
4552          --
4553       else
4554          close c1;
4555       end if;
4556           --
4557     end if;
4558     --
4559     -- If ade records exists and designation is null then error
4560     --
4561     if (p_dpnt_dsgn_cd is null) then
4562       open c2;
4563       fetch c2 into l_dummy;
4564       if c2%found then
4565          --
4566          close c2;
4567          fnd_message.set_name('BEN','BEN_92517_DELETE_ADE');
4568          fnd_message.raise_error;
4569          --
4570       else
4571          close c2;
4572       end if;
4573        --
4574     end if;
4575     --
4576     -- If pyd records exists and designation is null then error
4577     --
4578     if (p_dpnt_dsgn_cd is null) then
4579       open c3;
4580       fetch c3 into l_dummy;
4581       if c3%found then
4582          --
4583          close c3;
4584          fnd_message.set_name('BEN','BEN_92516_DELETE_PYD');
4585          fnd_message.raise_error;
4586          --
4587       else
4588          close c3;
4589       end if;
4590       --
4591     end if;
4592     --
4593   --
4594   end if;
4595   --
4596   hr_utility.set_location('Leaving:'||l_proc,10);
4597   --
4598 end chk_dpnt_dsgn_cd_detail;
4599 --
4600 --
4601 -- ----------------------------------------------------------------------------
4602 -- |------< chk_dpnt_dsgn_cd_lvl_dpndcy >------|
4603 -- ----------------------------------------------------------------------------
4604 --
4605 -- Description
4606 --   If dependent designation level from ben_pgm_f is not = 'Plan Type', then the
4607 --   following must be null:  Dpnt Dsgn Cd, Cert Req Flag and Derivable Factors Apply Flag.
4608 --
4609 --
4610 -- Pre Conditions
4611 --   None.
4612 --
4613 -- In Parameters
4614 --   ptip_id PK of record being inserted or updated.
4615 --   pgm_id
4616 --   dpnt_dsgn_cd Value of lookup code.
4617 --   drvd_fctr_dpnt_cvg_flag
4618 --   effective_date effective date
4619 --   object_version_number Object version number of record being
4620 --                         inserted or updated.
4621 --
4622 -- Post Success
4623 --   Processing continues
4624 --
4625 -- Post Failure
4626 --   Error handled by procedure
4627 --
4628 -- Access Status
4629 --   Internal table handler use only.
4630 --
4631 Procedure chk_dpnt_dsgn_cd_lvl_dpndcy(p_ptip_id                in number,
4632                                  p_pgm_id                      in number,
4633                                  p_dpnt_dsgn_cd                in varchar2,
4634   			         p_drvd_fctr_dpnt_cvg_flag     in varchar2,
4635                                  p_effective_date              in date,
4636                                  p_business_group_id           in number,
4637                                  p_object_version_number       in number) is
4638   --
4639   l_proc         varchar2(72) := g_package||'chk_dpnt_dsgn_cd_lvl_dpndcy';
4640   l_api_updating boolean;
4641   l_value varchar2(30);
4642   --
4643    cursor c1 is select pgm.dpnt_dsgn_lvl_cd
4644                   from ben_pgm_f pgm
4645                   where pgm.pgm_id = p_pgm_id
4646                     and pgm.business_group_id + 0 = p_business_group_id
4647                     and p_effective_date between pgm.effective_start_date
4648                                              and pgm.effective_end_date;
4649   --
4650 Begin
4651   --
4652   hr_utility.set_location('Entering:'||l_proc, 5);
4653   --
4654   l_api_updating := ben_ctp_shd.api_updating
4655     (p_ptip_id                     => p_ptip_id,
4656      p_effective_date              => p_effective_date,
4657      p_object_version_number       => p_object_version_number);
4658   --
4659   if (l_api_updating
4660       and
4661          (nvl(p_dpnt_dsgn_cd,hr_api.g_varchar2)
4662                <> nvl(ben_ctp_shd.g_old_rec.dpnt_dsgn_cd,hr_api.g_varchar2) or
4663           nvl(p_drvd_fctr_dpnt_cvg_flag,hr_api.g_varchar2)
4664                <> nvl(ben_ctp_shd.g_old_rec.drvd_fctr_dpnt_cvg_flag,hr_api.g_varchar2))
4665       or not l_api_updating) then
4666     --
4667       open c1;
4668       fetch c1 into l_value;
4669       if c1%found then
4670         if nvl(l_value,'X') not in ('PTIP') and
4671           (p_dpnt_dsgn_cd is not null or
4672            p_drvd_fctr_dpnt_cvg_flag = 'Y' ) then
4673             --
4674             close c1;
4675             if l_value is null then
4676               fnd_message.set_name('BEN','BEN_91248_PT_DSGN_LVL_RQD');
4677               fnd_message.raise_error;
4678             else
4679               fnd_message.set_name('BEN','BEN_91249_INV_DSGN_LVL_PT');
4680               fnd_message.raise_error;
4681             end if;
4682             --
4683         end if;
4684       end if;
4685       close c1;
4686     --
4687   end if;
4688   --
4689   hr_utility.set_location('Leaving:'||l_proc,10);
4690   --
4691 end chk_dpnt_dsgn_cd_lvl_dpndcy;
4692 --
4693 -- ----------------------------------------------------------------------------
4694 -- |--------------------------< dt_update_validate >--------------------------|
4695 -- ----------------------------------------------------------------------------
4696 -- {Start Of Comments}
4697 --
4698 -- Description:
4699 --   This procedure is used for referential integrity of datetracked
4700 --   parent entities when a datetrack update operation is taking place
4701 --   and where there is no cascading of update defined for this entity.
4702 --
4703 -- Prerequisites:
4704 --   This procedure is called from the update_validate.
4705 --
4706 -- In Parameters:
4707 --
4708 -- Post Success:
4709 --   Processing continues.
4710 --
4711 -- Post Failure:
4712 --
4713 -- Developer Implementation Notes:
4714 --   This procedure should not need maintenance unless the HR Schema model
4715 --   changes.
4716 --
4717 -- Access Status:
4718 --   Internal Row Handler Use Only.
4719 --
4720 -- {End Of Comments}
4721 -- ----------------------------------------------------------------------------
4722 Procedure dt_update_validate
4723             (p_pgm_id                        in number default hr_api.g_number,
4724              p_cmbn_ptip_id                  in number default hr_api.g_number,
4725              p_cmbn_ptip_opt_id              in number default hr_api.g_number,
4726              p_acrs_ptip_cvg_id              in number default hr_api.g_number,
4727              p_pl_typ_id                     in number default hr_api.g_number,
4728 	     p_datetrack_mode		     in varchar2,
4729              p_validation_start_date	     in date,
4730 	     p_validation_end_date	     in date) Is
4731 --
4732   l_proc	    varchar2(72) := g_package||'dt_update_validate';
4733   l_integrity_error Exception;
4734   l_table_name	    all_tables.table_name%TYPE;
4735 --
4736 Begin
4737   hr_utility.set_location('Entering:'||l_proc, 5);
4738   --
4739   -- Ensure that the p_datetrack_mode argument is not null
4740   --
4741   hr_api.mandatory_arg_error
4742     (p_api_name       => l_proc,
4743      p_argument       => 'datetrack_mode',
4744      p_argument_value => p_datetrack_mode);
4745   --
4746   -- Only perform the validation if the datetrack update mode is valid
4747   --
4748   If (dt_api.validate_dt_upd_mode(p_datetrack_mode => p_datetrack_mode)) then
4749     --
4750     --
4751     -- Ensure the arguments are not null
4752     --
4753     hr_api.mandatory_arg_error
4754       (p_api_name       => l_proc,
4755        p_argument       => 'validation_start_date',
4756        p_argument_value => p_validation_start_date);
4757     --
4758     hr_api.mandatory_arg_error
4759       (p_api_name       => l_proc,
4760        p_argument       => 'validation_end_date',
4761        p_argument_value => p_validation_end_date);
4762     --
4763     If ((nvl(p_pgm_id, hr_api.g_number) <> hr_api.g_number) and
4764       NOT (dt_api.check_min_max_dates
4765             (p_base_table_name => 'ben_pgm_f',
4766              p_base_key_column => 'pgm_id',
4767              p_base_key_value  => p_pgm_id,
4768              p_from_date       => p_validation_start_date,
4769              p_to_date         => p_validation_end_date)))  Then
4770       l_table_name := 'ben_pgm_f';
4771       Raise l_integrity_error;
4772     End If;
4773     If ((nvl(p_cmbn_ptip_id, hr_api.g_number) <> hr_api.g_number) and
4774       NOT (dt_api.check_min_max_dates
4775             (p_base_table_name => 'ben_cmbn_ptip_f',
4776              p_base_key_column => 'cmbn_ptip_id',
4777              p_base_key_value  => p_cmbn_ptip_id,
4778              p_from_date       => p_validation_start_date,
4779              p_to_date         => p_validation_end_date)))  Then
4780       l_table_name := 'ben_cmbn_ptip_f';
4781       Raise l_integrity_error;
4782     End If;
4783     If ((nvl(p_cmbn_ptip_opt_id, hr_api.g_number) <> hr_api.g_number) and
4784       NOT (dt_api.check_min_max_dates
4785             (p_base_table_name => 'ben_cmbn_ptip_opt_f',
4786              p_base_key_column => 'cmbn_ptip_opt_id',
4787              p_base_key_value  => p_cmbn_ptip_opt_id,
4788              p_from_date       => p_validation_start_date,
4789              p_to_date         => p_validation_end_date)))  Then
4790       l_table_name := 'ben_cmbn_ptip_f';
4791       Raise l_integrity_error;
4792     End If;
4793     If ((nvl(p_acrs_ptip_cvg_id, hr_api.g_number) <> hr_api.g_number) and
4794       NOT (dt_api.check_min_max_dates
4795             (p_base_table_name => 'ben_acrs_ptip_cvg_f',
4796              p_base_key_column => 'acrs_ptip_cvg_id',
4797              p_base_key_value  => p_acrs_ptip_cvg_id,
4798              p_from_date       => p_validation_start_date,
4799              p_to_date         => p_validation_end_date)))  Then
4800       l_table_name := 'ben_cmbn_ptip_f';
4801       Raise l_integrity_error;
4802     End If;
4803     If ((nvl(p_pl_typ_id, hr_api.g_number) <> hr_api.g_number) and
4804       NOT (dt_api.check_min_max_dates
4805             (p_base_table_name => 'ben_pl_typ_f',
4806              p_base_key_column => 'pl_typ_id',
4807              p_base_key_value  => p_pl_typ_id,
4808              p_from_date       => p_validation_start_date,
4809              p_to_date         => p_validation_end_date)))  Then
4810       l_table_name := 'ben_pl_typ_f';
4811       Raise l_integrity_error;
4812     End If;
4813     --
4814   End If;
4815   --
4816   hr_utility.set_location(' Leaving:'||l_proc, 10);
4817 Exception
4818   When l_integrity_error Then
4819     --
4820     -- A referential integrity check was violated therefore
4821     -- we must error
4822     --
4823     ben_utility.parent_integrity_error(p_table_name => l_table_name);
4824   When Others Then
4825     --
4826     -- An unhandled or unexpected error has occurred which
4827     -- we must report
4828     --
4829     fnd_message.set_name('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
4830     fnd_message.set_token('PROCEDURE', l_proc);
4831     fnd_message.set_token('STEP','15');
4832     fnd_message.raise_error;
4833 End dt_update_validate;
4834 --
4835 -- ----------------------------------------------------------------------------
4836 -- |--------------------------< dt_delete_validate >--------------------------|
4837 -- ----------------------------------------------------------------------------
4838 -- {Start Of Comments}
4839 --
4840 -- Description:
4841 --   This procedure is used for referential integrity of datetracked
4842 --   child entities when either a datetrack DELETE or ZAP is in operation
4843 --   and where there is no cascading of delete defined for this entity.
4844 --   For the datetrack mode of DELETE or ZAP we must ensure that no
4845 --   datetracked child rows exist between the validation start and end
4846 --   dates.
4847 --
4848 -- Prerequisites:
4849 --   This procedure is called from the delete_validate.
4850 --
4851 -- In Parameters:
4852 --
4853 -- Post Success:
4854 --   Processing continues.
4855 --
4856 -- Post Failure:
4857 --   If a row exists by determining the returning Boolean value from the
4858 --   generic dt_api.rows_exist function then we must supply an error via
4859 --   the use of the local exception handler l_rows_exist.
4860 --
4861 -- Developer Implementation Notes:
4862 --   This procedure should not need maintenance unless the HR Schema model
4863 --   changes.
4864 --
4865 -- Access Status:
4866 --   Internal Row Handler Use Only.
4867 --
4868 -- {End Of Comments}
4869 -- ----------------------------------------------------------------------------
4870 Procedure dt_delete_validate
4871             (p_ptip_id		in number,
4872              p_datetrack_mode		in varchar2,
4873 	     p_validation_start_date	in date,
4874 	     p_validation_end_date	in date) Is
4875 --
4876   l_proc	varchar2(72) 	:= g_package||'dt_delete_validate';
4877   l_rows_exist	Exception;
4878   l_table_name	all_tables.table_name%TYPE;
4879 --
4880 Begin
4881   hr_utility.set_location('Entering:'||l_proc, 5);
4882   --
4883   -- Ensure that the p_datetrack_mode argument is not null
4884   --
4885   hr_api.mandatory_arg_error
4886     (p_api_name       => l_proc,
4887      p_argument       => 'datetrack_mode',
4888      p_argument_value => p_datetrack_mode);
4889   --
4890   -- Only perform the validation if the datetrack mode is either
4891   -- DELETE or ZAP
4892   --
4893   If (p_datetrack_mode = 'DELETE' or
4894       p_datetrack_mode = 'ZAP') then
4895     --
4896     --
4897     -- Ensure the arguments are not null
4898     --
4899     hr_api.mandatory_arg_error
4900       (p_api_name       => l_proc,
4901        p_argument       => 'validation_start_date',
4902        p_argument_value => p_validation_start_date);
4903     --
4904     hr_api.mandatory_arg_error
4905       (p_api_name       => l_proc,
4906        p_argument       => 'validation_end_date',
4907        p_argument_value => p_validation_end_date);
4908     --
4909     hr_api.mandatory_arg_error
4910       (p_api_name       => l_proc,
4911        p_argument       => 'ptip_id',
4912        p_argument_value => p_ptip_id);
4913     --
4914     If (dt_api.rows_exist
4915           (p_base_table_name => 'ben_elig_per_f',
4916            p_base_key_column => 'ptip_id',
4917            p_base_key_value  => p_ptip_id,
4918            p_from_date       => p_validation_start_date,
4919            p_to_date         => p_validation_end_date)) Then
4920       l_table_name := 'ben_elig_per_f';
4921       Raise l_rows_exist;
4922     End If;
4923     If (dt_api.rows_exist
4924           (p_base_table_name => 'ben_wv_prtn_rsn_ptip_f',
4925            p_base_key_column => 'ptip_id',
4926            p_base_key_value  => p_ptip_id,
4927            p_from_date       => p_validation_start_date,
4928            p_to_date         => p_validation_end_date)) Then
4929       l_table_name := 'ben_wv_prtn_rsn_ptip_f';
4930       Raise l_rows_exist;
4931     End If;
4932     If (dt_api.rows_exist
4933           (p_base_table_name => 'ben_ler_chg_dpnt_cvg_f',
4934            p_base_key_column => 'ptip_id',
4935            p_base_key_value  => p_ptip_id,
4936            p_from_date       => p_validation_start_date,
4937            p_to_date         => p_validation_end_date)) Then
4938       l_table_name := 'ben_ler_chg_dpnt_cvg_f';
4939       Raise l_rows_exist;
4940     End If;
4941     If (dt_api.rows_exist
4942           (p_base_table_name => 'ben_acty_base_rt_f',
4943            p_base_key_column => 'ptip_id',
4944            p_base_key_value  => p_ptip_id,
4945            p_from_date       => p_validation_start_date,
4946            p_to_date         => p_validation_end_date)) Then
4947       l_table_name := 'ben_acty_base_rt_f';
4948       Raise l_rows_exist;
4949     End If;
4950     If (dt_api.rows_exist
4951           (p_base_table_name => 'ben_apld_dpnt_cvg_elig_prfl_f',
4952            p_base_key_column => 'ptip_id',
4953            p_base_key_value  => p_ptip_id,
4954            p_from_date       => p_validation_start_date,
4955            p_to_date         => p_validation_end_date)) Then
4956       l_table_name := 'ben_apld_dpnt_cvg_elig_prfl_f';
4957       Raise l_rows_exist;
4958     End If;
4959     If (dt_api.rows_exist
4960           (p_base_table_name => 'ben_ptip_dpnt_cvg_ctfn_f',
4961            p_base_key_column => 'ptip_id',
4962            p_base_key_value  => p_ptip_id,
4963            p_from_date       => p_validation_start_date,
4964            p_to_date         => p_validation_end_date)) Then
4965       l_table_name := 'ben_ptip_dpnt_cvg_ctfn_f';
4966       Raise l_rows_exist;
4967     End If;
4968     --
4969   End If;
4970   --
4971   hr_utility.set_location(' Leaving:'||l_proc, 10);
4972 Exception
4973   When l_rows_exist Then
4974     --
4975     -- A referential integrity check was violated therefore
4976     -- we must error
4977     --
4978     ben_utility.child_exists_error(p_table_name => l_table_name);
4979   When Others Then
4980     --
4981     -- An unhandled or unexpected error has occurred which
4982     -- we must report
4983     --
4984     fnd_message.set_name('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
4985     fnd_message.set_token('PROCEDURE', l_proc);
4986     fnd_message.set_token('STEP','15');
4987     fnd_message.raise_error;
4988 End dt_delete_validate;
4989 --
4990 -- ----------------------------------------------------------------------------
4991 -- |---------------------------< insert_validate >----------------------------|
4992 -- ----------------------------------------------------------------------------
4993 Procedure insert_validate
4994 	(p_rec 			 in ben_ctp_shd.g_rec_type,
4995 	 p_effective_date	 in date,
4996 	 p_datetrack_mode	 in varchar2,
4997 	 p_validation_start_date in date,
4998 	 p_validation_end_date	 in date) is
4999 --
5000   l_proc	varchar2(72) := g_package||'insert_validate';
5001 --
5002 Begin
5003   hr_utility.set_location('Entering:'||l_proc, 5);
5004   --
5005   -- Call all supporting business operations
5006   --
5007   --
5008   if p_rec.business_group_id is not null and p_rec.legislation_code is null then
5009   hr_api.validate_bus_grp_id(p_rec.business_group_id);  -- Validate Bus Grp
5010   end if;
5011   --
5012   chk_ptip_id
5013   (p_ptip_id          => p_rec.ptip_id,
5014    p_effective_date        => p_effective_date,
5015    p_object_version_number => p_rec.object_version_number);
5016   --
5017   chk_rqd_enrt_perd_tco_cd
5018   (p_ptip_id          => p_rec.ptip_id,
5019    p_rqd_enrt_perd_tco_cd         => p_rec.rqd_enrt_perd_tco_cd,
5020    p_effective_date        => p_effective_date,
5021    p_object_version_number => p_rec.object_version_number);
5022   --
5023   chk_no_mn_pl_typ_overid_flag
5024   (p_ptip_id          => p_rec.ptip_id,
5025    p_no_mn_pl_typ_overid_flag         => p_rec.no_mn_pl_typ_overid_flag,
5026    p_effective_date        => p_effective_date,
5027    p_object_version_number => p_rec.object_version_number);
5028   --
5029   chk_drvbl_fctr_apls_rts_flag
5030   (p_ptip_id                   => p_rec.ptip_id,
5031    p_drvbl_fctr_apls_rts_flag  => p_rec.drvbl_fctr_apls_rts_flag,
5032    p_effective_date            => p_effective_date,
5033    p_object_version_number     => p_rec.object_version_number);
5034   --
5035   chk_drvbl_fctr_prtn_elig_flag
5036   (p_ptip_id                   => p_rec.ptip_id,
5037    p_drvbl_fctr_prtn_elig_flag => p_rec.drvbl_fctr_prtn_elig_flag,
5038    p_effective_date            => p_effective_date,
5039    p_object_version_number     => p_rec.object_version_number);
5040   --
5041   chk_elig_apls_flag
5042   (p_ptip_id                   => p_rec.ptip_id,
5043    p_elig_apls_flag            => p_rec.elig_apls_flag,
5044    p_effective_date            => p_effective_date,
5045    p_object_version_number     => p_rec.object_version_number);
5046   --
5047   chk_prtn_elig_ovrid_alwd_flag
5048   (p_ptip_id                   => p_rec.ptip_id,
5049    p_prtn_elig_ovrid_alwd_flag => p_rec.prtn_elig_ovrid_alwd_flag,
5050    p_effective_date            => p_effective_date,
5051    p_object_version_number     => p_rec.object_version_number);
5052   --
5053   chk_trk_inelig_per_flag
5054   (p_ptip_id                   => p_rec.ptip_id,
5055    p_trk_inelig_per_flag       => p_rec.trk_inelig_per_flag,
5056    p_effective_date            => p_effective_date,
5057    p_object_version_number     => p_rec.object_version_number);
5058   --
5059   chk_sbj_to_sps_lf_ins_mx_flag
5060   (p_ptip_id          => p_rec.ptip_id,
5061    p_sbj_to_sps_lf_ins_mx_flag => p_rec.sbj_to_sps_lf_ins_mx_flag,
5062    p_effective_date        => p_effective_date,
5063    p_object_version_number => p_rec.object_version_number);
5064   --
5065   chk_sbj_to_dpnt_lf_ins_mx_flag
5066   (p_ptip_id          => p_rec.ptip_id,
5067    p_sbj_to_dpnt_lf_ins_mx_flag => p_rec.sbj_to_dpnt_lf_ins_mx_flag,
5068    p_effective_date        => p_effective_date,
5069    p_object_version_number => p_rec.object_version_number);
5070   --
5071   chk_use_to_sum_ee_lf_ins_flag
5072   (p_ptip_id          => p_rec.ptip_id,
5073    p_use_to_sum_ee_lf_ins_flag  => p_rec.use_to_sum_ee_lf_ins_flag,
5074    p_effective_date        => p_effective_date,
5075    p_object_version_number => p_rec.object_version_number);
5076   --
5077   chk_drvd_fctr_dpnt_cvg_flag
5078   (p_ptip_id          => p_rec.ptip_id,
5079    p_drvd_fctr_dpnt_cvg_flag         => p_rec.drvd_fctr_dpnt_cvg_flag,
5080    p_effective_date        => p_effective_date,
5081    p_object_version_number => p_rec.object_version_number);
5082   --
5083   chk_wvbl_flag
5084   (p_ptip_id          => p_rec.ptip_id,
5085    p_wvbl_flag         => p_rec.wvbl_flag,
5086    p_effective_date        => p_effective_date,
5087    p_object_version_number => p_rec.object_version_number);
5088   --
5089 
5090 chk_cd_rl_combination
5091   (p_vrfy_fmly_mmbr_cd        => p_rec.vrfy_fmly_mmbr_cd,
5092    p_vrfy_fmly_mmbr_rl        => p_rec.vrfy_fmly_mmbr_rl);
5093 --
5094 
5095   chk_dpnt_adrs_rqd_flag
5096   (p_ptip_id          => p_rec.ptip_id,
5097    p_dpnt_adrs_rqd_flag         => p_rec.dpnt_adrs_rqd_flag,
5098    p_effective_date        => p_effective_date,
5099    p_object_version_number => p_rec.object_version_number);
5100   --
5101   chk_dpnt_cvg_no_ctfn_rqd_flag
5102   (p_ptip_id          => p_rec.ptip_id,
5103    p_dpnt_cvg_no_ctfn_rqd_flag         => p_rec.dpnt_cvg_no_ctfn_rqd_flag,
5104    p_effective_date        => p_effective_date,
5105    p_object_version_number => p_rec.object_version_number);
5106   --
5107   chk_dpnt_dob_rqd_flag
5108   (p_ptip_id          => p_rec.ptip_id,
5109    p_dpnt_dob_rqd_flag         => p_rec.dpnt_dob_rqd_flag,
5110    p_effective_date        => p_effective_date,
5111    p_object_version_number => p_rec.object_version_number);
5112   --
5113   chk_dpnt_legv_id_rqd_flag
5114   (p_ptip_id          => p_rec.ptip_id,
5115    p_dpnt_legv_id_rqd_flag         => p_rec.dpnt_legv_id_rqd_flag,
5116    p_effective_date        => p_effective_date,
5117    p_object_version_number => p_rec.object_version_number);
5118   --
5119   chk_rqd_perd_enrt_nenrt_tm_uom
5120   (p_ptip_id          => p_rec.ptip_id,
5121    p_rqd_perd_enrt_nenrt_tm_uom         => p_rec.rqd_perd_enrt_nenrt_tm_uom,
5122    p_effective_date        => p_effective_date,
5123    p_object_version_number => p_rec.object_version_number);
5124   --
5125   chk_prvds_cr_flag
5126   (p_ptip_id          => p_rec.ptip_id,
5127    p_prvds_cr_flag         => p_rec.prvds_cr_flag,
5128    p_effective_date        => p_effective_date,
5129    p_object_version_number => p_rec.object_version_number);
5130   --
5131   chk_no_mx_pl_typ_ovrid_flag
5132   (p_ptip_id          => p_rec.ptip_id,
5133    p_no_mx_pl_typ_ovrid_flag         => p_rec.no_mx_pl_typ_ovrid_flag,
5134    p_effective_date        => p_effective_date,
5135    p_object_version_number => p_rec.object_version_number);
5136   --
5137  --
5138   --
5139   chk_vrfy_fmly_mmbr_cd
5140   (p_ptip_id               => p_rec.ptip_id,
5141    p_vrfy_fmly_mmbr_cd     => p_rec.vrfy_fmly_mmbr_cd,
5142    p_effective_date        => p_effective_date,
5143    p_object_version_number => p_rec.object_version_number);
5144   --
5145   chk_vrfy_fmly_mmbr_rl
5146   (p_ptip_id               => p_rec.ptip_id,
5147    p_vrfy_fmly_mmbr_rl     => p_rec.vrfy_fmly_mmbr_rl,
5148    p_business_group_id     => p_rec.business_group_id,
5149    p_effective_date        => p_effective_date,
5150    p_object_version_number => p_rec.object_version_number);
5151   --
5152 
5153   chk_ptip_stat_cd
5154   (p_ptip_id          => p_rec.ptip_id,
5155    p_ptip_stat_cd         => p_rec.ptip_stat_cd,
5156    p_effective_date        => p_effective_date,
5157    p_object_version_number => p_rec.object_version_number);
5158   --
5159    chk_crs_this_pl_typ_only_flag
5160   (p_ptip_id          => p_rec.ptip_id,
5161    p_crs_this_pl_typ_only_flag         => p_rec.crs_this_pl_typ_only_flag,
5162    p_effective_date        => p_effective_date,
5163    p_object_version_number => p_rec.object_version_number);
5164   --
5165   chk_dpnt_dsgn_cd
5166   (p_ptip_id          => p_rec.ptip_id,
5167    p_dpnt_dsgn_cd         =>  p_rec.dpnt_dsgn_cd,
5168    p_dpnt_cvg_strt_dt_cd  =>  p_rec.dpnt_cvg_strt_dt_cd,
5169    p_dpnt_cvg_end_dt_cd   =>  p_rec.dpnt_cvg_end_dt_cd,
5170    p_effective_date       =>  p_effective_date,
5171    p_object_version_number => p_rec.object_version_number);
5172   --
5173   chk_dpnt_cvg_strt_dt_rl
5174   (p_ptip_id               => p_rec.ptip_id,
5175    p_dpnt_cvg_strt_dt_rl      => p_rec.dpnt_cvg_strt_dt_rl,
5176    p_effective_date        => p_effective_date,
5177    p_object_version_number => p_rec.object_version_number,
5178    p_business_group_id     => p_rec.business_group_id);
5179   --
5180   chk_dpnt_cvg_end_dt_rl
5181   (p_ptip_id               => p_rec.ptip_id,
5182    p_dpnt_cvg_end_dt_rl      => p_rec.dpnt_cvg_end_dt_rl,
5183    p_effective_date        => p_effective_date,
5184    p_object_version_number => p_rec.object_version_number,
5185    p_business_group_id     => p_rec.business_group_id);
5186   --
5187   chk_postelcn_edit_rl
5188   (p_ptip_id               => p_rec.ptip_id,
5189    p_postelcn_edit_rl      => p_rec.postelcn_edit_rl,
5190    p_effective_date        => p_effective_date,
5191    p_object_version_number => p_rec.object_version_number,
5192    p_business_group_id     => p_rec.business_group_id);
5193   --
5194   chk_rt_end_dt_rl
5195   (p_ptip_id               => p_rec.ptip_id,
5196    p_rt_end_dt_rl      => p_rec.rt_end_dt_rl,
5197    p_effective_date        => p_effective_date,
5198    p_object_version_number => p_rec.object_version_number,
5199    p_business_group_id     => p_rec.business_group_id);
5200   --
5201   chk_rt_strt_dt_rl
5202   (p_ptip_id               => p_rec.ptip_id,
5203    p_rt_strt_dt_rl      => p_rec.rt_strt_dt_rl,
5204    p_effective_date        => p_effective_date,
5205    p_object_version_number => p_rec.object_version_number,
5206    p_business_group_id     => p_rec.business_group_id);
5207   --
5208   chk_enrt_cvg_end_dt_rl
5209   (p_ptip_id               => p_rec.ptip_id,
5210    p_enrt_cvg_end_dt_rl      => p_rec.enrt_cvg_end_dt_rl,
5211    p_effective_date        => p_effective_date,
5212    p_object_version_number => p_rec.object_version_number,
5213    p_business_group_id     => p_rec.business_group_id);
5214   --
5215   chk_enrt_cvg_strt_dt_rl
5216   (p_ptip_id               => p_rec.ptip_id,
5217    p_enrt_cvg_strt_dt_rl      => p_rec.enrt_cvg_strt_dt_rl,
5218    p_effective_date        => p_effective_date,
5219    p_object_version_number => p_rec.object_version_number,
5220    p_business_group_id     => p_rec.business_group_id);
5221   --
5222   chk_rqd_perd_enrt_nenrt_rl
5223   (p_ptip_id               => p_rec.ptip_id,
5224    p_rqd_perd_enrt_nenrt_rl      => p_rec.rqd_perd_enrt_nenrt_rl,
5225    p_effective_date        => p_effective_date,
5226    p_object_version_number => p_rec.object_version_number,
5227    p_business_group_id     => p_rec.business_group_id);
5228   --
5229   chk_auto_enrt_mthd_rl
5230   (p_ptip_id               => p_rec.ptip_id,
5231    p_auto_enrt_mthd_rl     => p_rec.auto_enrt_mthd_rl,
5232    p_effective_date        => p_effective_date,
5233    p_object_version_number => p_rec.object_version_number,
5234    p_business_group_id     => p_rec.business_group_id);
5235   --
5236   chk_enrt_rl
5237   (p_ptip_id               => p_rec.ptip_id,
5238    p_enrt_rl               => p_rec.enrt_rl,
5239    p_effective_date        => p_effective_date,
5240    p_object_version_number => p_rec.object_version_number,
5241    p_business_group_id     => p_rec.business_group_id);
5242   --
5243   chk_dflt_enrt_det_rl
5244   (p_ptip_id               => p_rec.ptip_id,
5245    p_dflt_enrt_det_rl      => p_rec.dflt_enrt_det_rl,
5246    p_effective_date        => p_effective_date,
5247    p_object_version_number => p_rec.object_version_number,
5248    p_business_group_id     => p_rec.business_group_id);
5249   --
5250   chk_enrt_mthd_cd
5251   (p_ptip_id               => p_rec.ptip_id,
5252    p_enrt_mthd_cd          => p_rec.enrt_mthd_cd,
5253    p_effective_date        => p_effective_date,
5254    p_object_version_number => p_rec.object_version_number);
5255   --
5256   chk_enrt_cd
5257   (p_ptip_id               => p_rec.ptip_id,
5258    p_enrt_cd               => p_rec.enrt_cd,
5259    p_effective_date        => p_effective_date,
5260    p_object_version_number => p_rec.object_version_number);
5261   --
5262   chk_dflt_enrt_cd
5263   (p_ptip_id               => p_rec.ptip_id,
5264    p_dflt_enrt_cd          => p_rec.dflt_enrt_cd,
5265    p_effective_date        => p_effective_date,
5266    p_object_version_number => p_rec.object_version_number);
5267   --
5268   chk_dpnt_cvg_strt_dt_cd
5269   (p_ptip_id          => p_rec.ptip_id,
5270    p_dpnt_cvg_strt_dt_cd         => p_rec.dpnt_cvg_strt_dt_cd,
5271    p_effective_date        => p_effective_date,
5272    p_object_version_number => p_rec.object_version_number);
5273   --
5274   chk_rt_end_dt_cd
5275   (p_ptip_id          => p_rec.ptip_id,
5276    p_rt_end_dt_cd         => p_rec.rt_end_dt_cd,
5277    p_effective_date        => p_effective_date,
5278    p_object_version_number => p_rec.object_version_number);
5279   --
5280   chk_rt_strt_dt_cd
5281   (p_ptip_id          => p_rec.ptip_id,
5282    p_rt_strt_dt_cd         => p_rec.rt_strt_dt_cd,
5283    p_effective_date        => p_effective_date,
5284    p_object_version_number => p_rec.object_version_number);
5285   --
5286   chk_enrt_cvg_end_dt_cd
5287   (p_ptip_id          => p_rec.ptip_id,
5288    p_enrt_cvg_end_dt_cd         => p_rec.enrt_cvg_end_dt_cd,
5289    p_effective_date        => p_effective_date,
5290    p_object_version_number => p_rec.object_version_number);
5291   --
5292   chk_enrt_cvg_strt_dt_cd
5293   (p_ptip_id          => p_rec.ptip_id,
5294    p_enrt_cvg_strt_dt_cd         => p_rec.enrt_cvg_strt_dt_cd,
5295    p_effective_date        => p_effective_date,
5296    p_object_version_number => p_rec.object_version_number);
5297   --
5298   chk_dpnt_cvg_end_dt_cd
5299   (p_ptip_id          => p_rec.ptip_id,
5300    p_dpnt_cvg_end_dt_cd         => p_rec.dpnt_cvg_end_dt_cd,
5301    p_effective_date        => p_effective_date,
5302    p_object_version_number => p_rec.object_version_number);
5303   --
5304   chk_coord_cvg_for_all_pls_flag
5305   (p_ptip_id          => p_rec.ptip_id,
5306    p_coord_cvg_for_all_pls_flag         => p_rec.coord_cvg_for_all_pls_flag,
5307    p_effective_date        => p_effective_date,
5308    p_object_version_number => p_rec.object_version_number);
5309   --
5310   chk_duplicate_ordr_num
5311   (p_ptip_id           => p_rec.ptip_id
5312   ,p_pgm_id            => p_rec.pgm_id
5313   ,p_ordr_num          => p_rec.ordr_num
5314   ,p_business_group_id => p_rec.business_group_id
5315   ,p_effective_date    => p_effective_date
5316   ,p_validation_start_date  => p_validation_start_date
5317   ,p_validation_end_date    => p_validation_end_date) ;
5318 
5319   --
5320   chk_pl_typ_waivable
5321   (p_rec.ptip_id
5322   ,p_rec.wvbl_flag
5323   ,p_rec.pgm_id
5324   ,p_rec.business_group_id
5325   ,p_effective_date
5326   ,p_rec.object_version_number);
5327   --
5328   chk_date_dpndcy
5329   (p_ptip_id                  => p_rec.ptip_id,
5330    p_dt_cd                    => p_rec.dpnt_cvg_strt_dt_cd,
5331    p_old_dt_cd                => ben_ctp_shd.g_old_rec.dpnt_cvg_strt_dt_cd,
5332    p_dt_rl                    => p_rec.dpnt_cvg_strt_dt_rl,
5333    p_old_dt_rl                => ben_ctp_shd.g_old_rec.dpnt_cvg_strt_dt_rl,
5334    p_effective_date           => p_effective_date,
5335    p_object_version_number    => p_rec.object_version_number);
5336   --
5337   chk_date_dpndcy
5338   (p_ptip_id                  => p_rec.ptip_id,
5339    p_dt_cd                    => p_rec.rt_end_dt_cd,
5340    p_old_dt_cd                => ben_ctp_shd.g_old_rec.rt_end_dt_cd,
5341    p_dt_rl                    => p_rec.rt_end_dt_rl,
5342    p_old_dt_rl                => ben_ctp_shd.g_old_rec.rt_end_dt_rl,
5343    p_effective_date           => p_effective_date,
5344    p_object_version_number    => p_rec.object_version_number);
5345   --
5346   chk_date_dpndcy
5347   (p_ptip_id                  => p_rec.ptip_id,
5348    p_dt_cd                    => p_rec.rt_strt_dt_cd,
5349    p_old_dt_cd                => ben_ctp_shd.g_old_rec.rt_strt_dt_cd,
5350    p_dt_rl                    => p_rec.rt_strt_dt_rl,
5351    p_old_dt_rl                => ben_ctp_shd.g_old_rec.rt_strt_dt_rl,
5352    p_effective_date           => p_effective_date,
5353    p_object_version_number    => p_rec.object_version_number);
5354   --
5355   chk_date_dpndcy
5356   (p_ptip_id                  => p_rec.ptip_id,
5357    p_dt_cd                    => p_rec.enrt_cvg_end_dt_cd,
5358    p_old_dt_cd                => ben_ctp_shd.g_old_rec.enrt_cvg_end_dt_cd,
5359    p_dt_rl                    => p_rec.enrt_cvg_end_dt_rl,
5360    p_old_dt_rl                => ben_ctp_shd.g_old_rec.enrt_cvg_end_dt_rl,
5361    p_effective_date           => p_effective_date,
5362    p_object_version_number    => p_rec.object_version_number);
5363   --
5364   chk_date_dpndcy
5365   (p_ptip_id                  => p_rec.ptip_id,
5366    p_dt_cd                    => p_rec.enrt_cvg_strt_dt_cd,
5367    p_old_dt_cd                => ben_ctp_shd.g_old_rec.enrt_cvg_strt_dt_cd,
5368    p_dt_rl                    => p_rec.enrt_cvg_strt_dt_rl,
5369    p_old_dt_rl                => ben_ctp_shd.g_old_rec.enrt_cvg_strt_dt_rl,
5370    p_effective_date           => p_effective_date,
5371    p_object_version_number    => p_rec.object_version_number);
5372   --
5373   chk_date_dpndcy
5374   (p_ptip_id                  => p_rec.ptip_id,
5375    p_dt_cd                    => p_rec.dpnt_cvg_end_dt_cd,
5376    p_old_dt_cd                => ben_ctp_shd.g_old_rec.dpnt_cvg_end_dt_cd,
5377    p_dt_rl                    => p_rec.dpnt_cvg_end_dt_rl,
5378    p_old_dt_rl                => ben_ctp_shd.g_old_rec.dpnt_cvg_end_dt_rl,
5379    p_effective_date           => p_effective_date,
5380    p_object_version_number    => p_rec.object_version_number);
5381   --
5382 /*chk_plan_typ_temporal
5383   (p_rec.pl_typ_id
5384   ,p_effective_date
5385   ,p_rec.business_group_id
5386   ,p_rec.pgm_id );
5387 */
5388   --
5389   chk_rqd_perd_enrt_nenrt_dpndcy
5390   (p_ptip_id          => p_rec.ptip_id,
5391    p_rqd_perd_enrt_nenrt_val  => p_rec.rqd_perd_enrt_nenrt_val,
5392    p_rqd_perd_enrt_nenrt_tm_uom  => p_rec.rqd_perd_enrt_nenrt_tm_uom,
5393    p_effective_date        => p_effective_date,
5394    p_object_version_number => p_rec.object_version_number);
5395   --
5396   chk_max_num_ovrd_flg_dpndcy
5397   (p_ptip_id          => p_rec.ptip_id,
5398    p_mx_enrd_alwd_ovrid_num    =>  p_rec.mx_enrd_alwd_ovrid_num,
5399    p_no_mx_pl_typ_ovrid_flag   =>  p_rec.no_mx_pl_typ_ovrid_flag,
5400    p_effective_date        => p_effective_date,
5401    p_object_version_number => p_rec.object_version_number);
5402   --
5403   chk_min_num_ovrd_flg_dpndcy
5404   (p_ptip_id          => p_rec.ptip_id,
5405    p_mn_enrd_rqd_ovrid_num    =>  p_rec.mn_enrd_rqd_ovrid_num,
5406    p_no_mn_pl_typ_overid_flag   =>  p_rec.no_mn_pl_typ_overid_flag,
5407    p_effective_date        => p_effective_date,
5408    p_object_version_number => p_rec.object_version_number);
5409   --
5410   chk_mx_enrd_alwd_ovrid_num
5411   (p_ptip_id          => p_rec.ptip_id,
5412    p_pl_typ_id            => p_rec.pl_typ_id,
5413    p_mx_enrd_alwd_ovrid_num  => p_rec.mx_enrd_alwd_ovrid_num,
5414    p_effective_date        => p_effective_date,
5415    p_business_group_id => p_rec.business_group_id,
5416    p_object_version_number => p_rec.object_version_number);
5417   --
5418   chk_mn_enrd_rqd_ovrid_num
5419   (p_ptip_id          => p_rec.ptip_id,
5420    p_pl_typ_id            => p_rec.pl_typ_id,
5421    p_mn_enrd_rqd_ovrid_num  => p_rec.mn_enrd_rqd_ovrid_num,
5422    p_effective_date        => p_effective_date,
5423    p_business_group_id => p_rec.business_group_id,
5424    p_object_version_number => p_rec.object_version_number);
5425   --
5426 -- this will never occur, prior chks prevent it!
5427 /*  chk_min_num_ovrd_dpndcy
5428   (p_ptip_id          => p_rec.ptip_id,
5429    p_mx_enrd_alwd_ovrid_num  => p_rec.mx_enrd_alwd_ovrid_num,
5430    p_mn_enrd_rqd_ovrid_num  => p_rec.mn_enrd_rqd_ovrid_num,
5431    p_no_mx_pl_typ_ovrid_flag   =>  p_rec.no_mx_pl_typ_ovrid_flag,
5432    p_effective_date        => p_effective_date,
5433    p_object_version_number => p_rec.object_version_number); */
5434   --
5435   chk_dpnt_dsgn_cd_dpndcy
5436   (p_ptip_id          => p_rec.ptip_id,
5437    p_dpnt_dsgn_cd         => p_rec.dpnt_dsgn_cd,
5438    p_drvd_fctr_dpnt_cvg_flag         => p_rec.drvd_fctr_dpnt_cvg_flag,
5439    p_effective_date        => p_effective_date,
5440    p_object_version_number => p_rec.object_version_number);
5441   --
5442   chk_dpnt_dsgn_cd_detail
5443      (p_ptip_id            => p_rec.ptip_id,
5444       p_dpnt_dsgn_cd       => p_rec.dpnt_dsgn_cd,
5445       p_business_group_id  => p_rec.business_group_id,
5446       p_effective_date     => p_effective_date,
5447       p_object_version_number => p_rec.object_version_number);
5448   --
5449   chk_dpnt_dsgn_cd_lvl_dpndcy
5450   (p_ptip_id          => p_rec.ptip_id,
5451    p_pgm_id          => p_rec.pgm_id,
5452    p_dpnt_dsgn_cd         => p_rec.dpnt_dsgn_cd,
5453    p_drvd_fctr_dpnt_cvg_flag         => p_rec.drvd_fctr_dpnt_cvg_flag,
5454    p_effective_date        => p_effective_date,
5455    p_business_group_id => p_rec.business_group_id,
5456    p_object_version_number => p_rec.object_version_number);
5457   --
5458    chk_dup_pl_typ_id_in_pgm(p_pl_typ_id  => p_rec.pl_typ_id
5459                                ,p_effective_date => p_effective_date
5460                                ,p_business_group_id => p_rec.business_group_id
5461                                ,p_pgm_id => p_rec.pgm_id
5462                                ,p_ptip_id => p_rec.ptip_id
5463                                ,p_validation_start_date  => p_validation_start_date
5464                                ,p_validation_end_date    => p_validation_end_date) ;
5465 
5466   --
5467   hr_utility.set_location(' Leaving:'||l_proc, 10);
5468 End insert_validate;
5469 --
5470 -- ----------------------------------------------------------------------------
5471 -- |---------------------------< update_validate >----------------------------|
5472 -- ----------------------------------------------------------------------------
5473 Procedure update_validate
5474 	(p_rec 			 in ben_ctp_shd.g_rec_type,
5475 	 p_effective_date	 in date,
5476 	 p_datetrack_mode	 in varchar2,
5477 	 p_validation_start_date in date,
5478 	 p_validation_end_date	 in date) is
5479 --
5480   l_proc	varchar2(72) := g_package||'update_validate';
5481 --
5482 Begin
5483   hr_utility.set_location('Entering:'||l_proc, 5);
5484   --
5485   -- Call all supporting business operations
5486   --
5487   --
5488   if p_rec.business_group_id is not null and p_rec.legislation_code is null then
5489   hr_api.validate_bus_grp_id(p_rec.business_group_id);  -- Validate Bus Grp
5490   end if;
5491   --
5492   chk_ptip_id
5493   (p_ptip_id          => p_rec.ptip_id,
5494    p_effective_date        => p_effective_date,
5495    p_object_version_number => p_rec.object_version_number);
5496   --
5497   chk_rqd_enrt_perd_tco_cd
5498   (p_ptip_id          => p_rec.ptip_id,
5499    p_rqd_enrt_perd_tco_cd         => p_rec.rqd_enrt_perd_tco_cd,
5500    p_effective_date        => p_effective_date,
5501    p_object_version_number => p_rec.object_version_number);
5502   --
5503   chk_no_mn_pl_typ_overid_flag
5504   (p_ptip_id          => p_rec.ptip_id,
5505    p_no_mn_pl_typ_overid_flag         => p_rec.no_mn_pl_typ_overid_flag,
5506    p_effective_date        => p_effective_date,
5507    p_object_version_number => p_rec.object_version_number);
5508   --
5509   chk_drvbl_fctr_apls_rts_flag
5510   (p_ptip_id                   => p_rec.ptip_id,
5511    p_drvbl_fctr_apls_rts_flag  => p_rec.drvbl_fctr_apls_rts_flag,
5512    p_effective_date            => p_effective_date,
5513    p_object_version_number     => p_rec.object_version_number);
5514   --
5515   chk_drvbl_fctr_prtn_elig_flag
5516   (p_ptip_id                   => p_rec.ptip_id,
5517    p_drvbl_fctr_prtn_elig_flag => p_rec.drvbl_fctr_prtn_elig_flag,
5518    p_effective_date            => p_effective_date,
5519    p_object_version_number     => p_rec.object_version_number);
5520   --
5521   chk_elig_apls_flag
5522   (p_ptip_id                   => p_rec.ptip_id,
5523    p_elig_apls_flag            => p_rec.elig_apls_flag,
5524    p_effective_date            => p_effective_date,
5525    p_object_version_number     => p_rec.object_version_number);
5526   --
5527   chk_prtn_elig_ovrid_alwd_flag
5528   (p_ptip_id                   => p_rec.ptip_id,
5529    p_prtn_elig_ovrid_alwd_flag => p_rec.prtn_elig_ovrid_alwd_flag,
5530    p_effective_date            => p_effective_date,
5531    p_object_version_number     => p_rec.object_version_number);
5532   --
5533   chk_trk_inelig_per_flag
5534   (p_ptip_id                   => p_rec.ptip_id,
5535    p_trk_inelig_per_flag       => p_rec.trk_inelig_per_flag,
5536    p_effective_date            => p_effective_date,
5537    p_object_version_number     => p_rec.object_version_number);
5538   --
5539   chk_sbj_to_sps_lf_ins_mx_flag
5540   (p_ptip_id          => p_rec.ptip_id,
5541    p_sbj_to_sps_lf_ins_mx_flag => p_rec.sbj_to_sps_lf_ins_mx_flag,
5542    p_effective_date        => p_effective_date,
5543    p_object_version_number => p_rec.object_version_number);
5544   --
5545   chk_sbj_to_dpnt_lf_ins_mx_flag
5546   (p_ptip_id          => p_rec.ptip_id,
5547    p_sbj_to_dpnt_lf_ins_mx_flag => p_rec.sbj_to_dpnt_lf_ins_mx_flag,
5548    p_effective_date        => p_effective_date,
5549    p_object_version_number => p_rec.object_version_number);
5550   --
5551   chk_use_to_sum_ee_lf_ins_flag
5552   (p_ptip_id          => p_rec.ptip_id,
5553    p_use_to_sum_ee_lf_ins_flag  => p_rec.use_to_sum_ee_lf_ins_flag,
5554    p_effective_date        => p_effective_date,
5555    p_object_version_number => p_rec.object_version_number);
5556   --
5557   chk_drvd_fctr_dpnt_cvg_flag
5558   (p_ptip_id          => p_rec.ptip_id,
5559    p_drvd_fctr_dpnt_cvg_flag         => p_rec.drvd_fctr_dpnt_cvg_flag,
5560    p_effective_date        => p_effective_date,
5561    p_object_version_number => p_rec.object_version_number);
5562   --
5563   chk_wvbl_flag
5564   (p_ptip_id          => p_rec.ptip_id,
5565    p_wvbl_flag         => p_rec.wvbl_flag,
5566    p_effective_date        => p_effective_date,
5567    p_object_version_number => p_rec.object_version_number);
5568   --
5569   --
5570   chk_dpnt_adrs_rqd_flag
5571   (p_ptip_id          => p_rec.ptip_id,
5572    p_dpnt_adrs_rqd_flag         => p_rec.dpnt_adrs_rqd_flag,
5573    p_effective_date        => p_effective_date,
5574    p_object_version_number => p_rec.object_version_number);
5575   --
5576   chk_dpnt_cvg_no_ctfn_rqd_flag
5577   (p_ptip_id          => p_rec.ptip_id,
5578    p_dpnt_cvg_no_ctfn_rqd_flag         => p_rec.dpnt_cvg_no_ctfn_rqd_flag,
5579    p_effective_date        => p_effective_date,
5580    p_object_version_number => p_rec.object_version_number);
5581   --
5582   chk_dpnt_dob_rqd_flag
5583   (p_ptip_id          => p_rec.ptip_id,
5584    p_dpnt_dob_rqd_flag         => p_rec.dpnt_dob_rqd_flag,
5585    p_effective_date        => p_effective_date,
5586    p_object_version_number => p_rec.object_version_number);
5587   --
5588   chk_dpnt_legv_id_rqd_flag
5589   (p_ptip_id          => p_rec.ptip_id,
5590    p_dpnt_legv_id_rqd_flag         => p_rec.dpnt_legv_id_rqd_flag,
5591    p_effective_date        => p_effective_date,
5592    p_object_version_number => p_rec.object_version_number);
5593   --
5594   chk_rqd_perd_enrt_nenrt_tm_uom
5595   (p_ptip_id          => p_rec.ptip_id,
5596    p_rqd_perd_enrt_nenrt_tm_uom         => p_rec.rqd_perd_enrt_nenrt_tm_uom,
5597    p_effective_date        => p_effective_date,
5598    p_object_version_number => p_rec.object_version_number);
5599   --
5600   chk_prvds_cr_flag
5601   (p_ptip_id          => p_rec.ptip_id,
5602    p_prvds_cr_flag         => p_rec.prvds_cr_flag,
5603    p_effective_date        => p_effective_date,
5604    p_object_version_number => p_rec.object_version_number);
5605   --
5606   chk_no_mx_pl_typ_ovrid_flag
5607   (p_ptip_id          => p_rec.ptip_id,
5608    p_no_mx_pl_typ_ovrid_flag         => p_rec.no_mx_pl_typ_ovrid_flag,
5609    p_effective_date        => p_effective_date,
5610    p_object_version_number => p_rec.object_version_number);
5611   --
5612   chk_ptip_stat_cd
5613   (p_ptip_id          => p_rec.ptip_id,
5614    p_ptip_stat_cd         => p_rec.ptip_stat_cd,
5615    p_effective_date        => p_effective_date,
5616    p_object_version_number => p_rec.object_version_number);
5617   --
5618  --
5619   --
5620   chk_vrfy_fmly_mmbr_cd
5621   (p_ptip_id               => p_rec.ptip_id,
5622    p_vrfy_fmly_mmbr_cd     => p_rec.vrfy_fmly_mmbr_cd,
5623    p_effective_date        => p_effective_date,
5624    p_object_version_number => p_rec.object_version_number);
5625   --
5626   chk_vrfy_fmly_mmbr_rl
5627   (p_ptip_id               => p_rec.ptip_id,
5628    p_vrfy_fmly_mmbr_rl     => p_rec.vrfy_fmly_mmbr_rl,
5629    p_business_group_id     => p_rec.business_group_id,
5630    p_effective_date        => p_effective_date,
5631    p_object_version_number => p_rec.object_version_number);
5632   --
5633 
5634   chk_crs_this_pl_typ_only_flag
5635   (p_ptip_id          => p_rec.ptip_id,
5636    p_crs_this_pl_typ_only_flag         => p_rec.crs_this_pl_typ_only_flag,
5637    p_effective_date        => p_effective_date,
5638    p_object_version_number => p_rec.object_version_number);
5639   --
5640   chk_dpnt_dsgn_cd
5641   (p_ptip_id          => p_rec.ptip_id,
5642    p_dpnt_dsgn_cd         => p_rec.dpnt_dsgn_cd,
5643    p_dpnt_cvg_strt_dt_cd  =>  p_rec.dpnt_cvg_strt_dt_cd,
5644    p_dpnt_cvg_end_dt_cd   =>  p_rec.dpnt_cvg_end_dt_cd,
5645    p_effective_date        => p_effective_date,
5646    p_object_version_number => p_rec.object_version_number);
5647   --
5648   chk_dpnt_cvg_strt_dt_rl
5649   (p_ptip_id               => p_rec.ptip_id,
5650    p_dpnt_cvg_strt_dt_rl      => p_rec.dpnt_cvg_strt_dt_rl,
5651    p_effective_date        => p_effective_date,
5652    p_object_version_number => p_rec.object_version_number,
5653    p_business_group_id     => p_rec.business_group_id);
5654   --
5655   chk_postelcn_edit_rl
5656   (p_ptip_id               => p_rec.ptip_id,
5657    p_postelcn_edit_rl      => p_rec.postelcn_edit_rl,
5658    p_effective_date        => p_effective_date,
5659    p_object_version_number => p_rec.object_version_number,
5660    p_business_group_id     => p_rec.business_group_id);
5661   --
5662   chk_rt_end_dt_rl
5663   (p_ptip_id               => p_rec.ptip_id,
5664    p_rt_end_dt_rl      => p_rec.rt_end_dt_rl,
5665    p_effective_date        => p_effective_date,
5666    p_object_version_number => p_rec.object_version_number,
5667    p_business_group_id     => p_rec.business_group_id);
5668   --
5669   chk_rt_strt_dt_rl
5670   (p_ptip_id               => p_rec.ptip_id,
5671    p_rt_strt_dt_rl      => p_rec.rt_strt_dt_rl,
5672    p_effective_date        => p_effective_date,
5673    p_object_version_number => p_rec.object_version_number,
5674    p_business_group_id     => p_rec.business_group_id);
5675   --
5676   chk_enrt_cvg_end_dt_rl
5677   (p_ptip_id               => p_rec.ptip_id,
5678    p_enrt_cvg_end_dt_rl      => p_rec.enrt_cvg_end_dt_rl,
5679    p_effective_date        => p_effective_date,
5680    p_object_version_number => p_rec.object_version_number,
5681    p_business_group_id     => p_rec.business_group_id);
5682   --
5683   chk_enrt_cvg_strt_dt_rl
5684   (p_ptip_id               => p_rec.ptip_id,
5685    p_enrt_cvg_strt_dt_rl      => p_rec.enrt_cvg_strt_dt_rl,
5686    p_effective_date        => p_effective_date,
5687    p_object_version_number => p_rec.object_version_number,
5688    p_business_group_id     => p_rec.business_group_id);
5689   --
5690   chk_rqd_perd_enrt_nenrt_rl
5691   (p_ptip_id               => p_rec.ptip_id,
5692    p_rqd_perd_enrt_nenrt_rl      => p_rec.rqd_perd_enrt_nenrt_rl,
5693    p_effective_date        => p_effective_date,
5694    p_object_version_number => p_rec.object_version_number,
5695    p_business_group_id     => p_rec.business_group_id);
5696   --
5697   chk_auto_enrt_mthd_rl
5698   (p_ptip_id               => p_rec.ptip_id,
5699    p_auto_enrt_mthd_rl     => p_rec.auto_enrt_mthd_rl,
5700    p_effective_date        => p_effective_date,
5701    p_object_version_number => p_rec.object_version_number,
5702    p_business_group_id     => p_rec.business_group_id);
5703   --
5704   chk_enrt_rl
5705   (p_ptip_id               => p_rec.ptip_id,
5706    p_enrt_rl               => p_rec.enrt_rl,
5707    p_effective_date        => p_effective_date,
5708    p_object_version_number => p_rec.object_version_number,
5709    p_business_group_id     => p_rec.business_group_id);
5710   --
5711   chk_dflt_enrt_det_rl
5712   (p_ptip_id               => p_rec.ptip_id,
5713    p_dflt_enrt_det_rl      => p_rec.dflt_enrt_det_rl,
5714    p_effective_date        => p_effective_date,
5715    p_object_version_number => p_rec.object_version_number,
5716    p_business_group_id     => p_rec.business_group_id);
5717   --
5718   chk_enrt_mthd_cd
5719   (p_ptip_id               => p_rec.ptip_id,
5720    p_enrt_mthd_cd          => p_rec.enrt_mthd_cd,
5721    p_effective_date        => p_effective_date,
5722    p_object_version_number => p_rec.object_version_number);
5723   --
5724   chk_enrt_cd
5725   (p_ptip_id               => p_rec.ptip_id,
5726    p_enrt_cd               => p_rec.enrt_cd,
5727    p_effective_date        => p_effective_date,
5728    p_object_version_number => p_rec.object_version_number);
5729   --
5730   chk_dflt_enrt_cd
5731   (p_ptip_id               => p_rec.ptip_id,
5732    p_dflt_enrt_cd          => p_rec.dflt_enrt_cd,
5733    p_effective_date        => p_effective_date,
5734    p_object_version_number => p_rec.object_version_number);
5735   --
5736   chk_dpnt_cvg_end_dt_rl
5737   (p_ptip_id               => p_rec.ptip_id,
5738    p_dpnt_cvg_end_dt_rl      => p_rec.dpnt_cvg_end_dt_rl,
5739    p_effective_date        => p_effective_date,
5740    p_object_version_number => p_rec.object_version_number,
5741    p_business_group_id     => p_rec.business_group_id);
5742   --
5743   chk_dpnt_cvg_strt_dt_cd
5744   (p_ptip_id          => p_rec.ptip_id,
5745    p_dpnt_cvg_strt_dt_cd         => p_rec.dpnt_cvg_strt_dt_cd,
5746    p_effective_date        => p_effective_date,
5747    p_object_version_number => p_rec.object_version_number);
5748   --
5749   chk_rt_strt_dt_cd
5750   (p_ptip_id          => p_rec.ptip_id,
5751    p_rt_strt_dt_cd         => p_rec.rt_strt_dt_cd,
5752    p_effective_date        => p_effective_date,
5753    p_object_version_number => p_rec.object_version_number);
5754   --
5755   chk_rt_end_dt_cd
5756   (p_ptip_id          => p_rec.ptip_id,
5757    p_rt_end_dt_cd         => p_rec.rt_end_dt_cd,
5758    p_effective_date        => p_effective_date,
5759    p_object_version_number => p_rec.object_version_number);
5760   --
5761   chk_enrt_cvg_end_dt_cd
5762   (p_ptip_id          => p_rec.ptip_id,
5763    p_enrt_cvg_end_dt_cd         => p_rec.enrt_cvg_end_dt_cd,
5764    p_effective_date        => p_effective_date,
5765    p_object_version_number => p_rec.object_version_number);
5766   --
5767   chk_enrt_cvg_strt_dt_cd
5768   (p_ptip_id          => p_rec.ptip_id,
5769    p_enrt_cvg_strt_dt_cd         => p_rec.enrt_cvg_strt_dt_cd,
5770    p_effective_date        => p_effective_date,
5771    p_object_version_number => p_rec.object_version_number);
5772   --
5773   chk_dpnt_cvg_end_dt_cd
5774   (p_ptip_id          => p_rec.ptip_id,
5775    p_dpnt_cvg_end_dt_cd         => p_rec.dpnt_cvg_end_dt_cd,
5776    p_effective_date        => p_effective_date,
5777    p_object_version_number => p_rec.object_version_number);
5778   --
5779   chk_coord_cvg_for_all_pls_flag
5780   (p_ptip_id          => p_rec.ptip_id,
5781    p_coord_cvg_for_all_pls_flag         => p_rec.coord_cvg_for_all_pls_flag,
5782    p_effective_date        => p_effective_date,
5783    p_object_version_number => p_rec.object_version_number);
5784   --
5785   chk_duplicate_ordr_num
5786   (p_ptip_id           => p_rec.ptip_id
5787   ,p_pgm_id            => p_rec.pgm_id
5788   ,p_ordr_num          => p_rec.ordr_num
5789   ,p_business_group_id => p_rec.business_group_id
5790   ,p_effective_date    => p_effective_date
5791   ,p_validation_start_date  => p_validation_start_date
5792   ,p_validation_end_date    => p_validation_end_date) ;
5793 
5794   --
5795   chk_pl_typ_waivable
5796   (p_rec.ptip_id
5797   ,p_rec.wvbl_flag
5798   ,p_rec.pgm_id
5799   ,p_rec.business_group_id
5800   ,p_effective_date
5801   ,p_rec.object_version_number);
5802   --
5803   chk_date_dpndcy
5804   (p_ptip_id                  => p_rec.ptip_id,
5805    p_dt_cd                    => p_rec.dpnt_cvg_strt_dt_cd,
5806    p_old_dt_cd                => ben_ctp_shd.g_old_rec.dpnt_cvg_strt_dt_cd,
5807    p_dt_rl                    => p_rec.dpnt_cvg_strt_dt_rl,
5808    p_old_dt_rl                => ben_ctp_shd.g_old_rec.dpnt_cvg_strt_dt_rl,
5809    p_effective_date           => p_effective_date,
5810    p_object_version_number    => p_rec.object_version_number);
5811   --
5812   chk_date_dpndcy
5813   (p_ptip_id                  => p_rec.ptip_id,
5814    p_dt_cd                    => p_rec.rt_end_dt_cd,
5815    p_old_dt_cd                => ben_ctp_shd.g_old_rec.rt_end_dt_cd,
5816    p_dt_rl                    => p_rec.rt_end_dt_rl,
5817    p_old_dt_rl                => ben_ctp_shd.g_old_rec.rt_end_dt_rl,
5818    p_effective_date           => p_effective_date,
5819    p_object_version_number    => p_rec.object_version_number);
5820   --
5821   chk_date_dpndcy
5822   (p_ptip_id                  => p_rec.ptip_id,
5823    p_dt_cd                    => p_rec.rt_strt_dt_cd,
5824    p_old_dt_cd                => ben_ctp_shd.g_old_rec.rt_strt_dt_cd,
5825    p_dt_rl                    => p_rec.rt_strt_dt_rl,
5826    p_old_dt_rl                => ben_ctp_shd.g_old_rec.rt_strt_dt_rl,
5827    p_effective_date           => p_effective_date,
5828    p_object_version_number    => p_rec.object_version_number);
5829   --
5830   chk_date_dpndcy
5831   (p_ptip_id                  => p_rec.ptip_id,
5832    p_dt_cd                    => p_rec.enrt_cvg_end_dt_cd,
5833    p_old_dt_cd                => ben_ctp_shd.g_old_rec.enrt_cvg_end_dt_cd,
5834    p_dt_rl                    => p_rec.enrt_cvg_end_dt_rl,
5835    p_old_dt_rl                => ben_ctp_shd.g_old_rec.enrt_cvg_end_dt_rl,
5836    p_effective_date           => p_effective_date,
5837    p_object_version_number    => p_rec.object_version_number);
5838   --
5839   chk_date_dpndcy
5840   (p_ptip_id                  => p_rec.ptip_id,
5841    p_dt_cd                    => p_rec.enrt_cvg_strt_dt_cd,
5842    p_old_dt_cd                => ben_ctp_shd.g_old_rec.enrt_cvg_strt_dt_cd,
5843    p_dt_rl                    => p_rec.enrt_cvg_strt_dt_rl,
5844    p_old_dt_rl                => ben_ctp_shd.g_old_rec.enrt_cvg_strt_dt_rl,
5845    p_effective_date           => p_effective_date,
5846    p_object_version_number    => p_rec.object_version_number);
5847   --
5848   chk_date_dpndcy
5849   (p_ptip_id                  => p_rec.ptip_id,
5850    p_dt_cd                    => p_rec.dpnt_cvg_end_dt_cd,
5851    p_old_dt_cd                => ben_ctp_shd.g_old_rec.dpnt_cvg_end_dt_cd,
5852    p_dt_rl                    => p_rec.dpnt_cvg_end_dt_rl,
5853    p_old_dt_rl                => ben_ctp_shd.g_old_rec.dpnt_cvg_end_dt_rl,
5854    p_effective_date           => p_effective_date,
5855    p_object_version_number    => p_rec.object_version_number);
5856   --
5857 /*chk_plan_typ_temporal
5858   (p_rec.pl_typ_id
5859   ,p_effective_date
5860   ,p_rec.business_group_id
5861   ,p_rec.pgm_id );
5862 */
5863   --
5864   chk_rqd_perd_enrt_nenrt_dpndcy
5865   (p_ptip_id          => p_rec.ptip_id,
5866    p_rqd_perd_enrt_nenrt_val  => p_rec.rqd_perd_enrt_nenrt_val,
5867    p_rqd_perd_enrt_nenrt_tm_uom  => p_rec.rqd_perd_enrt_nenrt_tm_uom,
5868    p_effective_date        => p_effective_date,
5869    p_object_version_number => p_rec.object_version_number);
5870   --
5871   chk_max_num_ovrd_flg_dpndcy
5872   (p_ptip_id          => p_rec.ptip_id,
5873    p_mx_enrd_alwd_ovrid_num    =>  p_rec.mx_enrd_alwd_ovrid_num,
5874    p_no_mx_pl_typ_ovrid_flag   =>  p_rec.no_mx_pl_typ_ovrid_flag,
5875    p_effective_date        => p_effective_date,
5876    p_object_version_number => p_rec.object_version_number);
5877   --
5878 
5879 chk_cd_rl_combination
5880   (p_vrfy_fmly_mmbr_cd        => p_rec.vrfy_fmly_mmbr_cd,
5881    p_vrfy_fmly_mmbr_rl        => p_rec.vrfy_fmly_mmbr_rl);
5882 --
5883   chk_min_num_ovrd_flg_dpndcy
5884   (p_ptip_id          => p_rec.ptip_id,
5885    p_mn_enrd_rqd_ovrid_num    =>  p_rec.mn_enrd_rqd_ovrid_num,
5886    p_no_mn_pl_typ_overid_flag   =>  p_rec.no_mn_pl_typ_overid_flag,
5887    p_effective_date        => p_effective_date,
5888    p_object_version_number => p_rec.object_version_number);
5889   --
5890   chk_mx_enrd_alwd_ovrid_num
5891   (p_ptip_id          => p_rec.ptip_id,
5892    p_pl_typ_id            => p_rec.pl_typ_id,
5893    p_mx_enrd_alwd_ovrid_num  => p_rec.mx_enrd_alwd_ovrid_num,
5894    p_effective_date        => p_effective_date,
5895    p_business_group_id => p_rec.business_group_id,
5896    p_object_version_number => p_rec.object_version_number);
5897   --
5898   chk_mn_enrd_rqd_ovrid_num
5899   (p_ptip_id          => p_rec.ptip_id,
5900    p_pl_typ_id            => p_rec.pl_typ_id,
5901    p_mn_enrd_rqd_ovrid_num  => p_rec.mn_enrd_rqd_ovrid_num,
5902    p_effective_date        => p_effective_date,
5903    p_business_group_id => p_rec.business_group_id,
5904    p_object_version_number => p_rec.object_version_number);
5905   --
5906 -- this will never occur, prior chks prevent it!
5907 /*  chk_min_num_ovrd_dpndcy
5908   (p_ptip_id          => p_rec.ptip_id,
5909    p_mx_enrd_alwd_ovrid_num  => p_rec.mx_enrd_alwd_ovrid_num,
5910    p_mn_enrd_rqd_ovrid_num  => p_rec.mn_enrd_rqd_ovrid_num,
5911    p_no_mx_pl_typ_ovrid_flag   =>  p_rec.no_mx_pl_typ_ovrid_flag,
5912    p_effective_date        => p_effective_date,
5913    p_object_version_number => p_rec.object_version_number); */
5914   --
5915   chk_dpnt_dsgn_cd_dpndcy
5916   (p_ptip_id          => p_rec.ptip_id,
5917    p_dpnt_dsgn_cd         => p_rec.dpnt_dsgn_cd,
5918    p_drvd_fctr_dpnt_cvg_flag         => p_rec.drvd_fctr_dpnt_cvg_flag,
5919    p_effective_date        => p_effective_date,
5920    p_object_version_number => p_rec.object_version_number);
5921   --
5922   chk_dpnt_dsgn_cd_detail
5923      (p_ptip_id            => p_rec.ptip_id,
5924       p_dpnt_dsgn_cd       => p_rec.dpnt_dsgn_cd,
5925       p_business_group_id  => p_rec.business_group_id,
5926       p_effective_date     => p_effective_date,
5927       p_object_version_number => p_rec.object_version_number);
5928   --
5929   chk_dpnt_dsgn_cd_lvl_dpndcy
5930   (p_ptip_id          => p_rec.ptip_id,
5931    p_pgm_id          => p_rec.pgm_id,
5932    p_dpnt_dsgn_cd         => p_rec.dpnt_dsgn_cd,
5933    p_drvd_fctr_dpnt_cvg_flag         => p_rec.drvd_fctr_dpnt_cvg_flag,
5934    p_effective_date        => p_effective_date,
5935    p_business_group_id => p_rec.business_group_id,
5936    p_object_version_number => p_rec.object_version_number);
5937   --
5938    chk_dup_pl_typ_id_in_pgm(p_pl_typ_id  => p_rec.pl_typ_id
5939                                ,p_effective_date => p_effective_date
5940                                ,p_business_group_id => p_rec.business_group_id
5941                                ,p_pgm_id => p_rec.pgm_id
5942                                ,p_ptip_id => p_rec.ptip_id
5943                                ,p_validation_start_date  => p_validation_start_date
5944                                ,p_validation_end_date    => p_validation_end_date) ;
5945 
5946   --
5947   -- Call the datetrack update integrity operation
5948   --
5949   dt_update_validate
5950     (p_pgm_id                        => p_rec.pgm_id,
5951      p_pl_typ_id                     => p_rec.pl_typ_id,
5952      p_datetrack_mode                => p_datetrack_mode,
5953      p_validation_start_date	     => p_validation_start_date,
5954      p_validation_end_date	     => p_validation_end_date);
5955   --
5956   hr_utility.set_location(' Leaving:'||l_proc, 10);
5957 End update_validate;
5958 --
5959 -- ----------------------------------------------------------------------------
5960 -- |---------------------------< delete_validate >----------------------------|
5961 -- ----------------------------------------------------------------------------
5962 Procedure delete_validate
5963 	(p_rec 			 in ben_ctp_shd.g_rec_type,
5964 	 p_effective_date	 in date,
5965 	 p_datetrack_mode	 in varchar2,
5966 	 p_validation_start_date in date,
5967 	 p_validation_end_date	 in date) is
5968 --
5969   l_proc	varchar2(72) := g_package||'delete_validate';
5970 --
5971 Begin
5972   hr_utility.set_location('Entering:'||l_proc, 5);
5973   --
5974   -- Call all supporting business operations
5975   --
5976   dt_delete_validate
5977     (p_datetrack_mode		=> p_datetrack_mode,
5978      p_validation_start_date	=> p_validation_start_date,
5979      p_validation_end_date	=> p_validation_end_date,
5980      p_ptip_id		=> p_rec.ptip_id);
5981   --
5982   hr_utility.set_location(' Leaving:'||l_proc, 10);
5983 End delete_validate;
5984 --
5985 --
5986 --  ---------------------------------------------------------------------------
5987 --  |---------------------< return_legislation_code >-------------------------|
5988 
5989 --  ---------------------------------------------------------------------------
5990 --
5991 function return_legislation_code
5992   (p_ptip_id in number) return varchar2 is
5993   --
5994   -- Declare cursor
5995   --
5996   cursor csr_leg_code is
5997     select a.legislation_code
5998     from   per_business_groups a,
5999            ben_ptip_f b
6000     where b.ptip_id      = p_ptip_id
6001     and   a.business_group_id = b.business_group_id;
6002   --
6003   -- Declare local variables
6004   --
6005   l_legislation_code  varchar2(150);
6006   l_proc              varchar2(72)  :=  g_package||'return_legislation_code';
6007   --
6008 begin
6009   --
6010   hr_utility.set_location('Entering:'|| l_proc, 10);
6011   --
6012   -- Ensure that all the mandatory parameter are not null
6013   --
6014   hr_api.mandatory_arg_error(p_api_name       => l_proc,
6015                              p_argument       => 'ptip_id',
6016                              p_argument_value => p_ptip_id);
6017   --
6018   open csr_leg_code;
6019     --
6020     fetch csr_leg_code into l_legislation_code;
6021 
6022     --
6023     if csr_leg_code%notfound then
6024       --
6025       close csr_leg_code;
6026       --
6027       -- The primary key is invalid therefore we must error
6028       --
6029       fnd_message.set_name('PAY','HR_7220_INVALID_PRIMARY_KEY');
6030       fnd_message.raise_error;
6031       --
6032     end if;
6033     --
6034   close csr_leg_code;
6035   --
6036   hr_utility.set_location(' Leaving:'|| l_proc, 20);
6037   --
6038   return l_legislation_code;
6039 
6040   --
6041 end return_legislation_code;
6042 
6043 --
6044 
6045 end ben_ctp_bus;