DBA Data[Home] [Help]

PACKAGE BODY: APPS.BEN_LBR_BUS

Source


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