DBA Data[Home] [Help]

PACKAGE BODY: APPS.BEN_EPO_BUS

Source


1 Package Body ben_epo_bus as
2 /* $Header: beeporhi.pkb 120.0 2005/05/28 02:42:27 appldev noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33)    := '  ben_epo_bus.';  -- Global package name
9 --
10 -- ----------------------------------------------------------------------------
11 -- |-----------------------------< chk_elig_per_opt_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 --   elig_per_opt_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_elig_per_opt_id(p_elig_per_opt_id         in number,
38                               p_elig_per_id             in number,
39                               p_opt_id                  in number,
40                               p_effective_date          in date,
41                               p_object_version_number   in number) is
42   --
43   l_proc         varchar2(72) := g_package||'chk_elig_per_opt_id';
44   l_api_updating boolean;
45   l_dummy        varchar2(1);
46   --
47   cursor c1 is
48     select null
49     from   ben_elig_per_f e,
50            ben_oipl_f o
51     where  e.elig_per_id = p_elig_per_id
52     and    p_opt_id = o.opt_id
53     and    p_effective_date
54            between e.effective_start_date
55            and     e.effective_end_date
56     and    o.pl_id = e.pl_id
57     and    p_effective_date
58            between o.effective_start_date
59            and     o.effective_end_date;
60   --
61 Begin
62   --
63   hr_utility.set_location('Entering:'||l_proc, 5);
64   --
65   l_api_updating := ben_epo_shd.api_updating
66     (p_effective_date              => p_effective_date,
67      p_elig_per_opt_id             => p_elig_per_opt_id,
68      p_object_version_number       => p_object_version_number);
69   --
70   if (l_api_updating
71      and nvl(p_elig_per_opt_id,hr_api.g_number)
72      <>  ben_epo_shd.g_old_rec.elig_per_opt_id) then
73     --
74     -- raise error as PK has changed
75     --
76     ben_epo_shd.constraint_error('BEN_ELIG_PER_F_PK');
77     --
78   elsif not l_api_updating then
79     --
80     -- check if PK is null
81     --
82     if p_elig_per_opt_id is not null then
83       --
84       -- raise error as PK is not null
85       --
86       ben_epo_shd.constraint_error('BEN_ELIG_PER_F_PK');
87       --
88     end if;
89     --
90   end if;
91 
92   hr_utility.set_location('In:'||l_proc, 7);
93 
94   if (l_api_updating
95       and p_elig_per_opt_id
96       <> nvl(ben_epo_shd.g_old_rec.elig_per_opt_id,hr_api.g_number)
97       or not l_api_updating) then
98     --
99     open c1;
100       --
101       fetch c1 into l_dummy;
102       if c1%notfound then
103         --
104         close c1;
105         --
106         fnd_message.set_name('BEN','BEN_91275_ELIG_PER_OPT_ONP');
107         fnd_message.raise_error;
108         --
109       end if;
110       --
111     close c1;
112     --
113   end if;
114   --
115   hr_utility.set_location('Leaving:'||l_proc, 10);
116   --
117 End chk_elig_per_opt_id;
118 --
119 -- ---------------------------------------------------------------------------
120 -- |--------------------------<chk_comp_ref_uom>------------------------------|
121 -- ---------------------------------------------------------------------------
122 --
123 -- Description:
124 --  This procedure checks that a referenced foreign key actually exists
125 --  in the referenced table.
126 --
127 -- Pre Conditions
128 --  None.
129 --
130 -- In Parameters
131 --  p_elig_per_opt_id PK
132 --  p_comp_ref_uom ID of FK column
133 --  p_effective_date Session Date of record
134 --  p_object_version_number object version number
135 --
136 -- Post Success
137 --  Processing continues
138 --
139 -- Post Failure
140 --  Error raised
141 --
142 -- Access Status
143 --  Internal table handler use only.
144 --
145 Procedure chk_comp_ref_uom (p_elig_per_opt_id       in number,
146                             p_comp_ref_val          in number,
147                             p_comp_ref_uom          in varchar2,
148                             p_rt_comp_ref_val       in number,
149                             p_rt_comp_ref_uom       in varchar2,
150                             p_effective_date        in date,
151                             p_object_version_number in number) is
152   --
153   l_proc                varchar2(72) := g_package||'chk_comp_ref_uom';
154   l_api_updating        boolean;
155   l_dummy               varchar2(1);
156   --
157   cursor c1 is
158     select null
159     from   fnd_currencies_vl a
160     where  a.currency_code = p_comp_ref_uom;
161   --
162   cursor c2 is
163     select null
164     from   fnd_currencies_vl a
165     where  a.currency_code = p_rt_comp_ref_uom;
166   --
167 begin
168   --
169   hr_utility.set_location('Entering :'||l_proc,5);
170   --
171   if (p_comp_ref_val is null and p_comp_ref_uom is not null) or
172      (p_comp_ref_uom is null and p_comp_ref_val is not null) then
173     --
174     fnd_message.set_name('BEN','BEN_91277_ELIG_PER_PRD_FLD_CMP');
175     fnd_message.raise_error;
176     --
177   end if;
178   --
179   if (p_rt_comp_ref_val is null and p_rt_comp_ref_uom is not null) or
180      (p_rt_comp_ref_uom is null and p_rt_comp_ref_val is not null) then
181     --
182     fnd_message.set_name('BEN','BEN_91277_ELIG_PER_PRD_FLD_CMP');
183     fnd_message.raise_error;
184     --
185   end if;
186   --
187   l_api_updating:= ben_epo_shd.api_updating
188      (p_elig_per_opt_id       => p_elig_per_opt_id,
189       p_effective_date        => p_effective_date,
190       p_object_version_number => p_object_version_number);
191   --
192   if (l_api_updating
193       and p_comp_ref_uom
194       <> nvl(ben_epo_shd.g_old_rec.comp_ref_uom,hr_api.g_varchar2)
195       or not l_api_updating) and p_comp_ref_uom IS NOT NULL then
196     --
197     -- check if comp_ref_uom value exists in hr_lookups table
198     --
199     open c1;
200       --
201       fetch c1 into l_dummy;
202       if c1%notfound then
203         --
204         close c1;
205         fnd_message.set_name('BEN','MUPPET');
206         fnd_message.raise_error;
207         --
208       end if;
209       --
210     close c1;
211     --
212   end if;
213   --
214   if (l_api_updating
215       and p_rt_comp_ref_uom
216       <> nvl(ben_epo_shd.g_old_rec.rt_comp_ref_uom,hr_api.g_varchar2)
217       or not l_api_updating) and p_rt_comp_ref_uom IS NOT NULL then
218     --
219     -- check if rt_comp_ref_uom value exists in hr_lookups table
220     --
221     open c2;
222       --
223       fetch c2 into l_dummy;
224       if c2%notfound then
225         --
226         close c2;
227         fnd_message.set_name('BEN','MUPPET');
228         fnd_message.raise_error;
229         --
230       end if;
231       --
232     close c2;
233     --
234   end if;
235   --
236   hr_utility.set_location('Leaving :'||l_proc,10);
237   --
238 end chk_comp_ref_uom;
239 -- ---------------------------------------------------------------------------
240 -- |-------------------<chk_hrs_wkd_bndry_perd_cd>---------------------------|
241 -- ---------------------------------------------------------------------------
242 --
243 -- Description:
244 --  This procedure checks that a referenced foreign key actually exists
245 --  in the referenced table.
246 --
247 -- Pre Conditions
248 --  None.
249 --
250 -- In Parameters
251 --  p_elig_per_id PK
252 --  p_wv_prtn_rsn_cd ID of FK column
253 --  p_effective_date Session Date of record
254 --  p_object_version_number object version number
255 --
256 -- Post Success
257 --  Processing continues
258 --
259 -- Post Failure
260 --  Error raised
261 --
262 -- Access Status
263 --  Internal table handler use only.
264 --
265 Procedure chk_hrs_wkd_bndry_perd_cd (p_elig_per_opt_id       in number,
266                                      p_hrs_wkd_bndry_perd_cd in varchar2,
267                                      p_rt_hrs_wkd_bndry_perd_cd in varchar2,
268                                      p_effective_date        in date,
269                                      p_object_version_number in number) is
270   --
271   l_proc                varchar2(72) := g_package||'chk_hrs_wkd_bndry_perd_cd';
272   l_api_updating        boolean;
273   --
274 Begin
275   --
276   hr_utility.set_location('Entering:'||l_proc, 5);
277   --
278   l_api_updating := ben_epo_shd.api_updating
279     (p_elig_per_opt_id             => p_elig_per_opt_id,
280      p_effective_date              => p_effective_date,
281      p_object_version_number       => p_object_version_number);
282   --
283   if (l_api_updating
284       and nvl(p_hrs_wkd_bndry_perd_cd,hr_api.g_varchar2)
285       <> nvl(ben_epo_shd.g_old_rec.hrs_wkd_bndry_perd_cd,hr_api.g_varchar2)
286       or not l_api_updating) and p_hrs_wkd_bndry_perd_cd IS NOT NULL then
287     --
288     -- check if value of lookup falls within lookup type.
289     --
290     if hr_api.not_exists_in_hr_lookups
291           (p_lookup_type    => 'BEN_BNDRY_PERD',
292            p_lookup_code    => p_hrs_wkd_bndry_perd_cd,
293            p_effective_date => p_effective_date) then
294       --
295       -- raise error as does not exist as lookup
296       --
297       fnd_message.set_name('BEN','BEN_91628_LOOKUP_TYPE_GENERIC');
298       fnd_message.set_token('FIELD','p_hrs_wkd_bndry_perd_cd');
299       fnd_message.set_token('TYPE','BEN_BNDRY_PERD');
300       fnd_message.raise_error;
301       --
302     end if;
303     --
304   end if;
305   --
306   if (l_api_updating
307       and nvl(p_rt_hrs_wkd_bndry_perd_cd,hr_api.g_varchar2)
308       <> nvl(ben_epo_shd.g_old_rec.rt_hrs_wkd_bndry_perd_cd,hr_api.g_varchar2)
309       or not l_api_updating) and p_rt_hrs_wkd_bndry_perd_cd IS NOT NULL then
310     --
311     -- check if value of lookup falls within lookup type.
312     --
313     if hr_api.not_exists_in_hr_lookups
314           (p_lookup_type    => 'BEN_BNDRY_PERD',
315            p_lookup_code    => p_rt_hrs_wkd_bndry_perd_cd,
316            p_effective_date => p_effective_date) then
317       --
318       -- raise error as does not exist as lookup
319       --
320       fnd_message.set_name('BEN','BEN_91628_LOOKUP_TYPE_GENERIC');
321       fnd_message.set_token('FIELD','p_rt_hrs_wkd_bndry_perd_cd');
322       fnd_message.set_token('TYPE','BEN_BNDRY_PERD');
323       fnd_message.raise_error;
324       --
325     end if;
326     --
327   end if;
328   --
329   hr_utility.set_location('Leaving:'||l_proc,10);
330   --
331 end chk_hrs_wkd_bndry_perd_cd;
332 -- ---------------------------------------------------------------------------
333 -- |---------------------------------<chk_pct_val>---------------------------|
334 -- ---------------------------------------------------------------------------
335 --
336 -- Description:
337 --  This procedure checks that a percentage value is between 0 and 100
338 --
339 -- Pre Conditions
340 --  None.
341 --
342 -- In Parameters
343 --     p_pct_val percentage value to be checked
344 --
345 -- Post Success
346 --  Processing continues
347 --
348 -- Post Failure
349 --  Error raised
350 --
351 -- Access Status
352 --  Internal table handler use only.
353 --
354 Procedure chk_pct_val (p_pct_val    in number,
355                        p_rt_pct_val in number) is
356   --
357   l_proc                varchar2(72) := g_package||'chk_chk_pct_val';
358   l_api_updating        boolean;
359   --
360 Begin
361   --
362   hr_utility.set_location('Entering:'||l_proc, 5);
363   --
364   if (p_pct_val IS NOT NULL and (p_pct_val < 0 OR p_pct_val > 100)) then
365     --
366     fnd_message.set_name('BEN','BEN_91257_INV_PCT_VAL');
367     fnd_message.raise_error;
368     --
369   end if;
370   --
371   if (p_rt_pct_val IS NOT NULL and (p_rt_pct_val < 0 OR p_rt_pct_val > 100)) then
372     --
373     fnd_message.set_name('BEN','BEN_91257_INV_PCT_VAL');
374     fnd_message.raise_error;
375     --
376   end if;
377   --
378   hr_utility.set_location('Leaving:'||l_proc,10);
379   --
380 end chk_pct_val;
381 -- ---------------------------------------------------------------------------
382 -- |--------------------------<chk_age_uom>----------------------------------|
383 -- ---------------------------------------------------------------------------
384 --
385 -- Description:
386 --  This procedure checks that a referenced foreign key actually exists
387 --  in the referenced table.
388 --
389 -- Pre Conditions
390 --  None.
391 --
392 -- In Parameters
393 --  p_elig_per_id PK
394 --  p_age_uom ID of FK column
395 --  p_effective_date Session Date of record
396 --  p_object_version_number object version number
397 --
398 -- Post Success
399 --  Processing continues
400 --
401 -- Post Failure
402 --  Error raised
403 --
404 -- Access Status
405 --  Internal table handler use only.
406 --
407 Procedure chk_age_uom (p_elig_per_opt_id       in number,
408                        p_age_val               in number,
409                        p_age_uom               in varchar2,
410                        p_rt_age_val            in number,
411                        p_rt_age_uom            in varchar2,
412                        p_effective_date        in date,
413                        p_object_version_number in number) is
414   --
415   l_proc                varchar2(72) := g_package||'chk_age_uom';
419   --
416   l_api_updating        boolean;
417   --
418 Begin
420   hr_utility.set_location('Entering:'||l_proc, 5);
421   --
422   if (p_age_val is null and p_age_uom is not null) or
423      (p_age_uom is null and p_age_val is not null) then
424     --
425     fnd_message.set_name('BEN','BEN_91276_ELIG_PER_PRD_FLD_AGE');
426     fnd_message.raise_error;
427     --
428   end if;
429   --
430   if (p_rt_age_val is null and p_rt_age_uom is not null) or
431      (p_rt_age_uom is null and p_rt_age_val is not null) then
432     --
433     fnd_message.set_name('BEN','BEN_91276_ELIG_PER_PRD_FLD_AGE');
434     fnd_message.raise_error;
435     --
436   end if;
437   --
438   l_api_updating := ben_epo_shd.api_updating
439     (p_elig_per_opt_id            => p_elig_per_opt_id,
440      p_effective_date             => p_effective_date,
441      p_object_version_number      => p_object_version_number);
442   --
443   if (l_api_updating
444       and p_age_uom
445       <> nvl(ben_epo_shd.g_old_rec.age_uom,hr_api.g_varchar2)
446       or not l_api_updating) and p_age_uom IS NOT NULL then
447     --
448     -- check if value of lookup falls within lookup type.
449     --
450     if hr_api.not_exists_in_hr_lookups
451           (p_lookup_type    => 'BEN_TM_UOM',
452            p_lookup_code    => p_age_uom,
453            p_effective_date => p_effective_date) then
454       --
455       -- raise error as does not exist as lookup
456       --
457       fnd_message.set_name('BEN','BEN_91628_LOOKUP_TYPE_GENERIC');
458       fnd_message.set_token('FIELD','p_age_uom');
459       fnd_message.set_token('TYPE','BEN_TM_UOM');
460       fnd_message.raise_error;
461       --
462     end if;
463     --
464   end if;
465   --
466   if (l_api_updating
467       and p_rt_age_uom
468       <> nvl(ben_epo_shd.g_old_rec.rt_age_uom,hr_api.g_varchar2)
469       or not l_api_updating) and p_rt_age_uom IS NOT NULL then
470     --
471     -- check if value of lookup falls within lookup type.
472     --
473     if hr_api.not_exists_in_hr_lookups
474           (p_lookup_type    => 'BEN_TM_UOM',
475            p_lookup_code    => p_rt_age_uom,
476            p_effective_date => p_effective_date) then
477       --
478       -- raise error as does not exist as lookup
479       --
480       fnd_message.set_name('BEN','BEN_91628_LOOKUP_TYPE_GENERIC');
481       fnd_message.set_token('FIELD','p_rt_age_uom');
482       fnd_message.set_token('TYPE','BEN_TM_UOM');
483       fnd_message.raise_error;
484      --
485     end if;
486     --
487   end if;
488   --
489   hr_utility.set_location('Leaving:'||l_proc,10);
490   --
491 end chk_age_uom;
492 -- ---------------------------------------------------------------------------
493 -- |--------------------------<chk_once_r_cntug_cd>--------------------------|
494 -- ---------------------------------------------------------------------------
495 --
496 -- Description:
497 --  This procedure checks that a referenced foreign key actually exists
498 --  in the referenced table.
499 --
500 -- Pre Conditions
501 --  None.
502 --
503 -- In Parameters
504 --  p_elig_per_id PK
505 --  p_once_r_cntug_cd lookup
506 --  p_effective_date Session Date of record
507 --  p_object_version_number object version number
508 --
509 -- Post Success
510 --  Processing continues
511 --
512 -- Post Failure
513 --  Error raised
514 --
515 -- Access Status
516 --  Internal table handler use only.
517 --
518 Procedure chk_once_r_cntug_cd (p_elig_per_opt_id       in number,
519                                p_once_r_cntug_cd       in varchar2,
520                                p_effective_date        in date,
521                                p_object_version_number in number) is
522   --
523   l_proc                varchar2(72) := g_package||'chk_once_r_cntug_cd';
524   l_api_updating        boolean;
525   --
526 Begin
527   --
528   hr_utility.set_location('Entering:'||l_proc, 5);
529   --
530   l_api_updating := ben_epo_shd.api_updating
531     (p_elig_per_opt_id            => p_elig_per_opt_id,
532      p_effective_date             => p_effective_date,
533      p_object_version_number      => p_object_version_number);
534   --
535   if (l_api_updating
536       and p_once_r_cntug_cd
537       <> nvl(ben_epo_shd.g_old_rec.once_r_cntug_cd,hr_api.g_varchar2)
538       or not l_api_updating) and p_once_r_cntug_cd IS NOT NULL then
539     --
540     -- check if value of lookup falls within lookup type.
541     --
542     if hr_api.not_exists_in_hr_lookups
543           (p_lookup_type    => 'BEN_ONCE_R_CNTNG',
544            p_lookup_code    => p_once_r_cntug_cd,
545            p_effective_date => p_effective_date) then
546       --
547       -- raise error as does not exist as lookup
548       --
549       fnd_message.set_name('BEN','BEN_91628_LOOKUP_TYPE_GENERIC');
550       fnd_message.set_token('FIELD','p_once_r_cntug_cd');
551       fnd_message.set_token('TYPE','BEN_ONCE_R_CNTNG');
552       fnd_message.raise_error;
553       --
554     end if;
555     --
556   end if;
557   --
558   hr_utility.set_location('Leaving:'||l_proc,10);
559   --
563 -- ---------------------------------------------------------------------------
560 end chk_once_r_cntug_cd;
561 -- ---------------------------------------------------------------------------
562 -- |--------------------------<chk_inelg_rsn_cd>-----------------------------|
564 --
565 -- Description:
566 --  This procedure checks that a referenced foreign key actually exists
567 --  in the referenced table.
568 --
569 -- Pre Conditions
570 --  None.
571 --
572 -- In Parameters
573 --  p_elig_per_id PK
574 --  p_inelg_rsn_cd   lookup
575 --  p_effective_date Session Date of record
576 --  p_object_version_number object version number
577 --
578 -- Post Success
579 --  Processing continues
580 --
581 -- Post Failure
582 --  Error raised
583 --
584 -- Access Status
585 --  Internal table handler use only.
586 --
587 Procedure chk_inelg_rsn_cd (p_elig_per_opt_id       in number,
588                             p_inelg_rsn_cd          in varchar2,
589                             p_effective_date        in date,
590                             p_object_version_number in number) is
591   --
592   l_proc                varchar2(72) := g_package||'chk_inelg_rsn_cd';
593   l_api_updating        boolean;
594   --
595 Begin
596   --
597   hr_utility.set_location('Entering:'||l_proc, 5);
598   --
599   l_api_updating := ben_epo_shd.api_updating
600     (p_elig_per_opt_id            => p_elig_per_opt_id,
601      p_effective_date             => p_effective_date,
602      p_object_version_number      => p_object_version_number);
603   --
604   if (l_api_updating
605       and p_inelg_rsn_cd
606       <> nvl(ben_epo_shd.g_old_rec.inelg_rsn_cd,hr_api.g_varchar2)
607       or not l_api_updating) and p_inelg_rsn_cd IS NOT NULL then
608     --
609     -- check if value of lookup falls within lookup type.
610     --
611     if hr_api.not_exists_in_hr_lookups
612           (p_lookup_type    => 'BEN_INELG_RSN',
613            p_lookup_code    => p_inelg_rsn_cd,
614            p_effective_date => p_effective_date) then
615       --
616       -- raise error as does not exist as lookup
617       --
618       fnd_message.set_name('BEN','BEN_91628_LOOKUP_TYPE_GENERIC');
619       fnd_message.set_token('FIELD','p_inelg_rsn_cd');
620       fnd_message.set_token('TYPE','BEN_INELG_RSN');
621       fnd_message.raise_error;
622       --
623     end if;
624     --
625   end if;
626   --
627   hr_utility.set_location('Leaving:'||l_proc,10);
628   --
629 end chk_inelg_rsn_cd;
630 -- ---------------------------------------------------------------------------
631 -- |--------------------------<chk_los_uom>----------------------------------|
632 -- ---------------------------------------------------------------------------
633 --
634 -- Description:
635 --  This procedure checks that a referenced foreign key actually exists
636 --  in the referenced table.
637 --
638 -- Pre Conditions
639 --  None.
640 --
641 -- In Parameters
642 --  p_elig_per_id PK
643 --  p_los_uom ID of FK column
644 --  p_effective_date Session Date of record
645 --  p_object_version_number object version number
646 --
647 -- Post Success
648 --  Processing continues
649 --
650 -- Post Failure
651 --  Error raised
652 --
653 -- Access Status
654 --  Internal table handler use only.
655 --
656 Procedure chk_los_uom (p_elig_per_opt_id       in number,
657                        p_los_val               in number,
658                        p_los_uom               in varchar2,
659                        p_rt_los_val            in number,
660                        p_rt_los_uom            in varchar2,
661                        p_effective_date        in date,
662                        p_object_version_number in number) is
663   --
664   l_proc                varchar2(72) := g_package||'chk_los_uom';
665   l_api_updating        boolean;
666   --
667 Begin
668   --
669   hr_utility.set_location('Entering:'||l_proc, 5);
670   --
671   if (p_los_val is null and p_los_uom is not null) or
672      (p_los_uom is null and p_los_val is not null) then
673     --
674     fnd_message.set_name('BEN','BEN_91278_ELIG_PER_PRD_FLD_LOS');
675     fnd_message.raise_error;
676     --
677   end if;
678   --
679   if (p_rt_los_val is null and p_rt_los_uom is not null) or
680      (p_rt_los_uom is null and p_rt_los_val is not null) then
681     --
682     fnd_message.set_name('BEN','BEN_91278_ELIG_PER_PRD_FLD_LOS');
683     fnd_message.raise_error;
684     --
685   end if;
686   --
687   l_api_updating := ben_epo_shd.api_updating
688     (p_elig_per_opt_id            => p_elig_per_opt_id,
689      p_effective_date             => p_effective_date,
690      p_object_version_number      => p_object_version_number);
691   --
692   if (l_api_updating
693       and p_los_uom
694       <> nvl(ben_epo_shd.g_old_rec.los_uom,hr_api.g_varchar2)
695       or not l_api_updating) and p_los_uom IS NOT NULL then
696     --
697     -- check if value of lookup falls within lookup type.
698     --
699     if hr_api.not_exists_in_hr_lookups
700           (p_lookup_type    => 'BEN_TM_UOM',
701            p_lookup_code    => p_los_uom,
705       --
702            p_effective_date => p_effective_date) then
703       --
704       -- raise error as does not exist as lookup
706       fnd_message.set_name('BEN','BEN_91628_LOOKUP_TYPE_GENERIC');
707       fnd_message.set_token('FIELD','p_los_uom');
708       fnd_message.set_token('TYPE','BEN_TM_UOM');
709       fnd_message.raise_error;
710       --
711     end if;
712     --
713   end if;
714   --
715   if (l_api_updating
716       and p_rt_los_uom
717       <> nvl(ben_epo_shd.g_old_rec.rt_los_uom,hr_api.g_varchar2)
718       or not l_api_updating) and p_rt_los_uom IS NOT NULL then
719     --
720     -- check if value of lookup falls within lookup type.
721     --
722     if hr_api.not_exists_in_hr_lookups
723           (p_lookup_type    => 'BEN_TM_UOM',
724            p_lookup_code    => p_rt_los_uom,
725            p_effective_date => p_effective_date) then
726       --
727       -- raise error as does not exist as lookup
728       --
729       fnd_message.set_name('BEN','BEN_91628_LOOKUP_TYPE_GENERIC');
730       fnd_message.set_token('FIELD','p_rt_los_uom');
731       fnd_message.set_token('TYPE','BEN_TM_UOM');
732       fnd_message.raise_error;
733       --
734     end if;
735     --
736   end if;
737   --
738   hr_utility.set_location('Leaving:'||l_proc,10);
739   --
740 end chk_los_uom;
741 -- ----------------------------------------------------------------------------
742 -- |--------------------------< chk_prtn_ovridn_rsn_cd >----------------------|
743 -- ----------------------------------------------------------------------------
744 --
745 -- Description
746 --   This procedure is used to check that the lookup value is valid.
747 --
748 -- Pre Conditions
749 --   None.
750 --
751 -- In Parameters
752 --   elig_per_opt_id PK of record being inserted or updated.
753 --   prtn_ovridn_rsn_cd Value of lookup code.
754 --   effective_date effective date
755 --   object_version_number Object version number of record being
756 --                         inserted or updated.
757 --
758 -- Post Success
759 --   Processing continues
760 --
761 -- Post Failure
762 --   Error handled by procedure
763 --
764 -- Access Status
765 --   Internal table handler use only.
766 --
767 Procedure chk_prtn_ovridn_rsn_cd(p_elig_per_opt_id             in number,
768                                  p_prtn_ovridn_rsn_cd          in varchar2,
769                                  p_effective_date              in date,
770                                  p_object_version_number       in number) is
771   --
772   l_proc         varchar2(72) := g_package||'chk_prtn_ovridn_rsn_cd';
773   l_api_updating boolean;
774   --
775 Begin
776   --
777   hr_utility.set_location('Entering:'||l_proc, 5);
778   --
779   l_api_updating := ben_epo_shd.api_updating
780     (p_elig_per_opt_id             => p_elig_per_opt_id,
781      p_effective_date              => p_effective_date,
782      p_object_version_number       => p_object_version_number);
783   --
784   if (l_api_updating
785       and p_prtn_ovridn_rsn_cd
786       <> nvl(ben_epo_shd.g_old_rec.prtn_ovridn_rsn_cd,hr_api.g_varchar2)
787       or not l_api_updating)
788       and p_prtn_ovridn_rsn_cd is not null then
789     --
790     -- check if value of lookup falls within lookup type.
791     --
792     if hr_api.not_exists_in_hr_lookups
793           (p_lookup_type    => 'BEN_PRTN_OVRRIDN_RSN',
794            p_lookup_code    => p_prtn_ovridn_rsn_cd,
795            p_effective_date => p_effective_date) then
796       --
797       -- raise error as does not exist as lookup
798       --
799       fnd_message.set_name('BEN','BEN_91628_LOOKUP_TYPE_GENERIC');
800       fnd_message.set_token('FIELD','p_prtn_ovridn_rsn_cd');
801       fnd_message.set_token('TYPE','BEN_PRTN_OVRRIDN_RSN');
802       fnd_message.raise_error;
803       --
804     end if;
805     --
806   end if;
807   --
808   hr_utility.set_location('Leaving:'||l_proc,10);
809   --
810 end chk_prtn_ovridn_rsn_cd;
811 --
812 -- ----------------------------------------------------------------------------
813 -- |------------------------------< chk_elig_flag >---------------------------|
814 -- ----------------------------------------------------------------------------
815 --
816 -- Description
817 --   This procedure is used to check that the lookup value is valid.
818 --
819 -- Pre Conditions
820 --   None.
821 --
822 -- In Parameters
823 --   elig_per_opt_id PK of record being inserted or updated.
824 --   elig_flag Value of lookup code.
825 --   effective_date effective date
826 --   object_version_number Object version number of record being
827 --                         inserted or updated.
828 --
829 -- Post Success
830 --   Processing continues
831 --
832 -- Post Failure
833 --   Error handled by procedure
834 --
835 -- Access Status
836 --   Internal table handler use only.
837 --
838 Procedure chk_elig_flag(p_elig_per_opt_id         in number,
839                         p_elig_flag               in varchar2,
840                         p_effective_date          in date,
841                         p_object_version_number   in number) is
842   --
846 Begin
843   l_proc         varchar2(72) := g_package||'chk_elig_flag';
844   l_api_updating boolean;
845   --
847   --
848   hr_utility.set_location('Entering:'||l_proc, 5);
849   --
850   l_api_updating := ben_epo_shd.api_updating
851     (p_elig_per_opt_id             => p_elig_per_opt_id,
852      p_effective_date              => p_effective_date,
853      p_object_version_number       => p_object_version_number);
854   --
855   if (l_api_updating
856       and p_elig_flag
857       <> nvl(ben_epo_shd.g_old_rec.elig_flag,hr_api.g_varchar2)
858       or not l_api_updating) then
859     --
860     -- check if value of lookup falls within lookup type.
861     --
862     if hr_api.not_exists_in_hr_lookups
863           (p_lookup_type    => 'YES_NO',
864            p_lookup_code    => p_elig_flag,
865            p_effective_date => p_effective_date) then
866       --
867       -- raise error as does not exist as lookup
868       --
869       fnd_message.set_name('BEN','BEN_91628_LOOKUP_TYPE_GENERIC');
870       fnd_message.set_token('FIELD','p_elig_flag');
871       fnd_message.set_token('TYPE','YES_NO');
872       fnd_message.raise_error;
873       --
874     end if;
875     --
876   end if;
877   --
878   hr_utility.set_location('Leaving:'||l_proc,10);
879   --
880 end chk_elig_flag;
881 --
882 -- ----------------------------------------------------------------------------
883 -- |-----------------< chk_no_mx_prtn_ovrid_thru_flag >-----------------------|
884 -- ----------------------------------------------------------------------------
885 --
886 -- Description
887 --   This procedure is used to check that the lookup value is valid.
888 --
889 -- Pre Conditions
890 --   None.
891 --
892 -- In Parameters
893 --   elig_per_opt_id PK of record being inserted or updated.
894 --   no_mx_prtn_ovrid_thru_flag Value of lookup code.
895 --   effective_date effective date
896 --   object_version_number Object version number of record being
897 --                         inserted or updated.
898 --
899 -- Post Success
900 --   Processing continues
901 --
902 -- Post Failure
903 --   Error handled by procedure
904 --
905 -- Access Status
906 --   Internal table handler use only.
907 --
908 Procedure chk_no_mx_prtn_ovrid_thru_flag
909              (p_elig_per_opt_id             in number,
910               p_no_mx_prtn_ovrid_thru_flag  in varchar2,
911               p_effective_date              in date,
912               p_object_version_number       in number) is
913   --
914   l_proc         varchar2(72) := g_package||'chk_no_mx_prtn_ovrid_thru_flag';
915   l_api_updating boolean;
916   --
917 Begin
918   --
919   hr_utility.set_location('Entering:'||l_proc, 5);
920   --
921   l_api_updating := ben_epo_shd.api_updating
922     (p_elig_per_opt_id             => p_elig_per_opt_id,
923      p_effective_date              => p_effective_date,
924      p_object_version_number       => p_object_version_number);
925   --
926   if (l_api_updating
927       and p_no_mx_prtn_ovrid_thru_flag
928       <> nvl(ben_epo_shd.g_old_rec.no_mx_prtn_ovrid_thru_flag,hr_api.g_varchar2)
929       or not l_api_updating) then
930     --
931     -- check if value of lookup falls within lookup type.
932     --
933     --
934     if hr_api.not_exists_in_hr_lookups
935           (p_lookup_type    => 'YES_NO',
936            p_lookup_code    => p_no_mx_prtn_ovrid_thru_flag,
937            p_effective_date => p_effective_date) then
938       --
939       -- raise error as does not exist as lookup
940       --
941       fnd_message.set_name('BEN','BEN_91628_LOOKUP_TYPE_GENERIC');
942       fnd_message.set_token('FIELD','p_no_mx_prtn_ovrid_thru_flag');
943       fnd_message.set_token('TYPE','YES_NO');
944       fnd_message.raise_error;
945       --
946     end if;
947     --
948   end if;
949   --
950   hr_utility.set_location('Leaving:'||l_proc,10);
951   --
952 end chk_no_mx_prtn_ovrid_thru_flag;
953 --
954 -- ----------------------------------------------------------------------------
955 -- |---------------------------< chk_all_freeze_flags >-----------------------|
956 -- ----------------------------------------------------------------------------
957 --
958 -- Description
959 --   This procedure is used to check that the lookup value is valid.
960 --
961 -- Pre Conditions
962 --   None.
963 --
964 -- In Parameters
965 --   elig_per_opt_id              PK of record being inserted or updated.
966 --   rt_frz_los_flag              Value of lookup code.
967 --   rt_frz_age_flag              Value of lookup code.
968 --   rt_frz_cmp_lvl_flag          Value of lookup code.
969 --   rt_frz_pct_fl_tm_flag        Value of lookup code.
970 --   rt_frz_hrs_wkd_flag          Value of lookup code.
971 --   rt_frz_comb_age_and_los_flag Value of lookup code.
972 --   frz_los_flag                 Value of lookup code.
973 --   frz_age_flag                 Value of lookup code.
974 --   frz_cmp_lvl_flag             Value of lookup code.
975 --   frz_pct_fl_tm_flag           Value of lookup code.
976 --   frz_hrs_wkd_flag             Value of lookup code.
977 --   frz_comb_age_and_los_flag    Value of lookup code.
981 --
978 --   effective_date               effective date
979 --   object_version_number        Object version number of record being
980 --                                inserted or updated.
982 -- Post Success
983 --   Processing continues
984 --
985 -- Post Failure
986 --   Error handled by procedure
987 --
988 -- Access Status
989 --   Internal table handler use only.
990 --
991 Procedure chk_all_freeze_flags
992              (p_elig_per_opt_id              in number,
993               p_rt_frz_los_flag              in varchar2,
994               p_rt_frz_age_flag              in varchar2,
995               p_rt_frz_cmp_lvl_flag          in varchar2,
996               p_rt_frz_pct_fl_tm_flag        in varchar2,
997               p_rt_frz_hrs_wkd_flag          in varchar2,
998               p_rt_frz_comb_age_and_los_flag in varchar2,
999               p_frz_los_flag                 in varchar2,
1000               p_frz_age_flag                 in varchar2,
1001               p_frz_cmp_lvl_flag             in varchar2,
1002               p_frz_pct_fl_tm_flag           in varchar2,
1003               p_frz_hrs_wkd_flag             in varchar2,
1004               p_frz_comb_age_and_los_flag    in varchar2,
1005               p_effective_date               in date,
1006               p_object_version_number        in number) is
1007   --
1008   l_proc         varchar2(72) := g_package||'chk_all_freeze_flags';
1009   l_api_updating boolean;
1010   --
1011 Begin
1012   --
1013   hr_utility.set_location('Entering:'||l_proc, 5);
1014   --
1015   l_api_updating := ben_epo_shd.api_updating
1016     (p_elig_per_opt_id             => p_elig_per_opt_id,
1017      p_effective_date              => p_effective_date,
1018      p_object_version_number       => p_object_version_number);
1019   --
1020   hr_utility.set_location('RFLF:'||l_proc, 5);
1021   if (l_api_updating
1022       and p_rt_frz_los_flag
1023       <> nvl(ben_epo_shd.g_old_rec.rt_frz_los_flag,hr_api.g_varchar2)
1024       or not l_api_updating) then
1025     --
1026     -- check if value of lookup falls within lookup type.
1027     --
1028     hr_utility.set_location('HRAPI_NEIHL:'||l_proc, 5);
1029     if hr_api.not_exists_in_hr_lookups
1030           (p_lookup_type    => 'YES_NO',
1031            p_lookup_code    => p_rt_frz_los_flag,
1032            p_effective_date => p_effective_date) then
1033       --
1034       -- raise error as does not exist as lookup
1035       --
1036       fnd_message.set_name('BEN','BEN_91628_LOOKUP_TYPE_GENERIC');
1037       fnd_message.set_token('FIELD','p_rt_frz_los_flag');
1038       fnd_message.set_token('TYPE','YES_NO');
1039       fnd_message.raise_error;
1040       --
1041     end if;
1042     --
1043   end if;
1044   --
1045   hr_utility.set_location('RFAF:'||l_proc, 5);
1046   if (l_api_updating
1047       and p_rt_frz_age_flag
1048       <> nvl(ben_epo_shd.g_old_rec.rt_frz_age_flag,hr_api.g_varchar2)
1049       or not l_api_updating) then
1050     --
1051     -- check if value of lookup falls within lookup type.
1052     --
1053     if hr_api.not_exists_in_hr_lookups
1054           (p_lookup_type    => 'YES_NO',
1055            p_lookup_code    => p_rt_frz_age_flag,
1056            p_effective_date => p_effective_date) then
1057       --
1058       -- raise error as does not exist as lookup
1059       --
1060       fnd_message.set_name('BEN','BEN_91628_LOOKUP_TYPE_GENERIC');
1061       fnd_message.set_token('FIELD','p_rt_frz_age_flag');
1062       fnd_message.set_token('TYPE','YES_NO');
1063       fnd_message.raise_error;
1064       --
1065     end if;
1066     --
1067   end if;
1068   --
1069   hr_utility.set_location('RFCLF:'||l_proc, 5);
1070   if (l_api_updating
1071       and p_rt_frz_cmp_lvl_flag
1072       <> nvl(ben_epo_shd.g_old_rec.rt_frz_cmp_lvl_flag,hr_api.g_varchar2)
1073       or not l_api_updating) then
1074     --
1075     -- check if value of lookup falls within lookup type.
1076     --
1077     if hr_api.not_exists_in_hr_lookups
1078           (p_lookup_type    => 'YES_NO',
1079            p_lookup_code    => p_rt_frz_cmp_lvl_flag,
1080            p_effective_date => p_effective_date) then
1081       --
1082       -- raise error as does not exist as lookup
1083       --
1084       fnd_message.set_name('BEN','BEN_91628_LOOKUP_TYPE_GENERIC');
1085       fnd_message.set_token('FIELD','p_rt_cmp_lvl_flag');
1086       fnd_message.set_token('TYPE','YES_NO');
1087       fnd_message.raise_error;
1088       --
1089     end if;
1090     --
1091   end if;
1092   --
1093   hr_utility.set_location('RFPFTF:'||l_proc, 5);
1094   if (l_api_updating
1095       and p_rt_frz_pct_fl_tm_flag
1096       <> nvl(ben_epo_shd.g_old_rec.rt_frz_pct_fl_tm_flag,hr_api.g_varchar2)
1097       or not l_api_updating) then
1098     --
1099     -- check if value of lookup falls within lookup type.
1100     --
1101     if hr_api.not_exists_in_hr_lookups
1102           (p_lookup_type    => 'YES_NO',
1103            p_lookup_code    => p_rt_frz_pct_fl_tm_flag,
1104            p_effective_date => p_effective_date) then
1105       --
1106       -- raise error as does not exist as lookup
1107       --
1108       fnd_message.set_name('BEN','BEN_91628_LOOKUP_TYPE_GENERIC');
1109       fnd_message.set_token('FIELD','p_rt_frz_pct_fl_tm_flag');
1113     end if;
1110       fnd_message.set_token('TYPE','YES_NO');
1111       fnd_message.raise_error;
1112       --
1114     --
1115   end if;
1116   --
1117   hr_utility.set_location('RFHWF:'||l_proc, 5);
1118   if (l_api_updating
1119       and p_rt_frz_hrs_wkd_flag
1120       <> nvl(ben_epo_shd.g_old_rec.rt_frz_hrs_wkd_flag,hr_api.g_varchar2)
1121       or not l_api_updating) then
1122     --
1123     -- check if value of lookup falls within lookup type.
1124     --
1125     if hr_api.not_exists_in_hr_lookups
1126           (p_lookup_type    => 'YES_NO',
1127            p_lookup_code    => p_rt_frz_hrs_wkd_flag,
1128            p_effective_date => p_effective_date) then
1129       --
1130       -- raise error as does not exist as lookup
1131       --
1132       fnd_message.set_name('BEN','BEN_91628_LOOKUP_TYPE_GENERIC');
1133       fnd_message.set_token('FIELD','p_rt_frz_hrs_wkd_flag');
1134       fnd_message.set_token('TYPE','YES_NO');
1135       fnd_message.raise_error;
1136       --
1137     end if;
1138     --
1139   end if;
1140   --
1141   hr_utility.set_location('RFCAALF:'||l_proc, 5);
1142   if (l_api_updating
1143       and p_rt_frz_comb_age_and_los_flag
1144       <> nvl(ben_epo_shd.g_old_rec.rt_frz_comb_age_and_los_flag,hr_api.g_varchar2)
1145       or not l_api_updating) then
1146     --
1147     -- check if value of lookup falls within lookup type.
1148     --
1149     if hr_api.not_exists_in_hr_lookups
1150           (p_lookup_type    => 'YES_NO',
1151            p_lookup_code    => p_rt_frz_comb_age_and_los_flag,
1152            p_effective_date => p_effective_date) then
1153       --
1154       -- raise error as does not exist as lookup
1155       --
1156       fnd_message.set_name('BEN','BEN_91628_LOOKUP_TYPE_GENERIC');
1157       fnd_message.set_token('FIELD','p_rt_frz_comb_age_and_los_flag');
1158       fnd_message.set_token('TYPE','YES_NO');
1159       fnd_message.raise_error;
1160       --
1161     end if;
1162     --
1163   end if;
1164   --
1165   hr_utility.set_location('FLF:'||l_proc, 5);
1166   if (l_api_updating
1167       and p_frz_los_flag
1168       <> nvl(ben_epo_shd.g_old_rec.frz_los_flag,hr_api.g_varchar2)
1169       or not l_api_updating) then
1170     --
1171     -- check if value of lookup falls within lookup type.
1172     --
1173     if hr_api.not_exists_in_hr_lookups
1174           (p_lookup_type    => 'YES_NO',
1175            p_lookup_code    => p_frz_los_flag,
1176            p_effective_date => p_effective_date) then
1177       --
1178       -- raise error as does not exist as lookup
1179       --
1180       fnd_message.set_name('BEN','BEN_91628_LOOKUP_TYPE_GENERIC');
1181       fnd_message.set_token('FIELD','p_frz_los_flag');
1182       fnd_message.set_token('TYPE','YES_NO');
1183       fnd_message.raise_error;
1184       --
1185     end if;
1186     --
1187   end if;
1188   --
1189   hr_utility.set_location('FAF:'||l_proc, 5);
1190   if (l_api_updating
1191       and p_frz_age_flag
1192       <> nvl(ben_epo_shd.g_old_rec.frz_age_flag,hr_api.g_varchar2)
1193       or not l_api_updating) then
1194     --
1195     -- check if value of lookup falls within lookup type.
1196     --
1197     if hr_api.not_exists_in_hr_lookups
1198           (p_lookup_type    => 'YES_NO',
1199            p_lookup_code    => p_frz_age_flag,
1200            p_effective_date => p_effective_date) then
1201       --
1202       -- raise error as does not exist as lookup
1203       --
1204       fnd_message.set_name('BEN','BEN_91628_LOOKUP_TYPE_GENERIC');
1205       fnd_message.set_token('FIELD','p_frz_age_flag');
1206       fnd_message.set_token('TYPE','YES_NO');
1207       fnd_message.raise_error;
1208       --
1209     end if;
1210     --
1211   end if;
1212   --
1213   hr_utility.set_location('FCLF:'||l_proc, 5);
1214   if (l_api_updating
1215       and p_frz_cmp_lvl_flag
1216       <> nvl(ben_epo_shd.g_old_rec.frz_cmp_lvl_flag,hr_api.g_varchar2)
1217       or not l_api_updating) then
1218     --
1219     -- check if value of lookup falls within lookup type.
1220     --
1221     if hr_api.not_exists_in_hr_lookups
1222           (p_lookup_type    => 'YES_NO',
1223            p_lookup_code    => p_frz_cmp_lvl_flag,
1224            p_effective_date => p_effective_date) then
1225       --
1226       -- raise error as does not exist as lookup
1227       --
1228       fnd_message.set_name('BEN','BEN_91628_LOOKUP_TYPE_GENERIC');
1229       fnd_message.set_token('FIELD','p_frz_cmp_lvl_flag');
1230       fnd_message.set_token('TYPE','YES_NO');
1231       fnd_message.raise_error;
1232       --
1233     end if;
1234     --
1235   end if;
1236   --
1237   hr_utility.set_location('FPFTF:'||l_proc, 5);
1238   if (l_api_updating
1239       and p_frz_pct_fl_tm_flag
1240       <> nvl(ben_epo_shd.g_old_rec.frz_pct_fl_tm_flag,hr_api.g_varchar2)
1241       or not l_api_updating) then
1242     --
1243     -- check if value of lookup falls within lookup type.
1244     --
1245     if hr_api.not_exists_in_hr_lookups
1246           (p_lookup_type    => 'YES_NO',
1247            p_lookup_code    => p_frz_pct_fl_tm_flag,
1248            p_effective_date => p_effective_date) then
1249       --
1250       -- raise error as does not exist as lookup
1251       --
1255       fnd_message.raise_error;
1252       fnd_message.set_name('BEN','BEN_91628_LOOKUP_TYPE_GENERIC');
1253       fnd_message.set_token('FIELD','p_frz_pct_fl_tm_flag');
1254       fnd_message.set_token('TYPE','YES_NO');
1256       --
1257     end if;
1258     --
1259   end if;
1260   --
1261   hr_utility.set_location('FHWFF:'||l_proc, 5);
1262   if (l_api_updating
1263       and p_frz_hrs_wkd_flag
1264       <> nvl(ben_epo_shd.g_old_rec.frz_hrs_wkd_flag,hr_api.g_varchar2)
1265       or not l_api_updating) then
1266     --
1267     -- check if value of lookup falls within lookup type.
1268     --
1269     if hr_api.not_exists_in_hr_lookups
1270           (p_lookup_type    => 'YES_NO',
1271            p_lookup_code    => p_frz_hrs_wkd_flag,
1272            p_effective_date => p_effective_date) then
1273       --
1274       -- raise error as does not exist as lookup
1275       --
1276       fnd_message.set_name('BEN','BEN_91628_LOOKUP_TYPE_GENERIC');
1277       fnd_message.set_token('FIELD','p_frz_hrs_wkd_flag');
1278       fnd_message.set_token('TYPE','YES_NO');
1279       fnd_message.raise_error;
1280       --
1281     end if;
1282     --
1283   end if;
1284   --
1285   hr_utility.set_location('Leaving:'||l_proc,10);
1286   --
1287 end chk_all_freeze_flags;
1288 -- ----------------------------------------------------------------------------
1289 -- |----------------------------< chk_prtn_ovridn_flag >----------------------|
1290 -- ----------------------------------------------------------------------------
1291 --
1292 -- Description
1293 --   This procedure is used to check that the lookup value is valid.
1294 --
1295 -- Pre Conditions
1296 --   None.
1297 --
1298 -- In Parameters
1299 --   elig_per_opt_id PK of record being inserted or updated.
1300 --   prtn_ovridn_flag Value of lookup code.
1301 --   effective_date effective date
1302 --   object_version_number Object version number of record being
1303 --                         inserted or updated.
1304 --
1305 -- Post Success
1306 --   Processing continues
1307 --
1308 -- Post Failure
1309 --   Error handled by procedure
1310 --
1311 -- Access Status
1312 --   Internal table handler use only.
1313 --
1314 Procedure chk_prtn_ovridn_flag(p_elig_per_opt_id             in number,
1315                                p_prtn_ovridn_flag            in varchar2,
1316                                p_effective_date              in date,
1317                                p_object_version_number       in number) is
1318   --
1319   l_proc         varchar2(72) := g_package||'chk_prtn_ovridn_flag';
1320   l_api_updating boolean;
1321   --
1322 Begin
1323   --
1324   hr_utility.set_location('Entering:'||l_proc, 5);
1325   --
1326   l_api_updating := ben_epo_shd.api_updating
1327     (p_elig_per_opt_id             => p_elig_per_opt_id,
1328      p_effective_date              => p_effective_date,
1329      p_object_version_number       => p_object_version_number);
1330   --
1331   if (l_api_updating
1332       and p_prtn_ovridn_flag
1333       <> nvl(ben_epo_shd.g_old_rec.prtn_ovridn_flag,hr_api.g_varchar2)
1334       or not l_api_updating) then
1335     --
1336     -- check if value of lookup falls within lookup type.
1337     --
1338     if hr_api.not_exists_in_hr_lookups
1339           (p_lookup_type    => 'YES_NO',
1340            p_lookup_code    => p_prtn_ovridn_flag,
1341            p_effective_date => p_effective_date) then
1342       --
1343       -- raise error as does not exist as lookup
1344       --
1345       fnd_message.set_name('BEN','BEN_91628_LOOKUP_TYPE_GENERIC');
1346       fnd_message.set_token('FIELD','p_prtn_ovridn_flag');
1347       fnd_message.set_token('TYPE','YES_NO');
1348       fnd_message.raise_error;
1349       --
1350     end if;
1351     --
1352   end if;
1353   --
1354   hr_utility.set_location('Leaving:'||l_proc,10);
1355   --
1356 end chk_prtn_ovridn_flag;
1357 --
1358 -- ----------------------------------------------------------------------------
1359 -- |--------------------------< dt_update_validate >--------------------------|
1360 -- ----------------------------------------------------------------------------
1361 -- {Start Of Comments}
1362 --
1363 -- Description:
1364 --   This procedure is used for referential integrity of datetracked
1365 --   parent entities when a datetrack update operation is taking place
1366 --   and where there is no cascading of update defined for this entity.
1367 --
1368 -- Prerequisites:
1369 --   This procedure is called from the update_validate.
1370 --
1371 -- In Parameters:
1372 --
1373 -- Post Success:
1374 --   Processing continues.
1375 --
1376 -- Post Failure:
1377 --
1378 -- Developer Implementation Notes:
1379 --   This procedure should not need maintenance unless the HR Schema model
1380 --   changes.
1381 --
1382 -- Access Status:
1383 --   Internal Row Handler Use Only.
1384 --
1385 -- {End Of Comments}
1386 -- ----------------------------------------------------------------------------
1387 Procedure dt_update_validate
1388             (p_elig_per_id                   in number default hr_api.g_number,
1389              p_opt_id                        in number default hr_api.g_number,
1390          p_datetrack_mode             in varchar2,
1394   l_proc        varchar2(72) := g_package||'dt_update_validate';
1391              p_validation_start_date         in date,
1392          p_validation_end_date         in date) Is
1393 --
1395   l_integrity_error Exception;
1396   l_table_name        all_tables.table_name%TYPE;
1397 --
1398 Begin
1399   hr_utility.set_location('Entering:'||l_proc, 5);
1400   --
1401   -- Ensure that the p_datetrack_mode argument is not null
1402   --
1403   hr_api.mandatory_arg_error
1404     (p_api_name       => l_proc,
1405      p_argument       => 'datetrack_mode',
1406      p_argument_value => p_datetrack_mode);
1407   --
1408   -- Only perform the validation if the datetrack update mode is valid
1409   --
1410   If (dt_api.validate_dt_upd_mode(p_datetrack_mode => p_datetrack_mode)) then
1411     --
1412     --
1413     -- Ensure the arguments are not null
1414     --
1415     hr_api.mandatory_arg_error
1416       (p_api_name       => l_proc,
1417        p_argument       => 'validation_start_date',
1418        p_argument_value => p_validation_start_date);
1419     --
1420     hr_api.mandatory_arg_error
1421       (p_api_name       => l_proc,
1422        p_argument       => 'validation_end_date',
1423        p_argument_value => p_validation_end_date);
1424     --
1425     If ((nvl(p_elig_per_id, hr_api.g_number) <> hr_api.g_number) and
1426       NOT (dt_api.check_min_max_dates
1427             (p_base_table_name => 'ben_elig_per_f',
1428              p_base_key_column => 'elig_per_id',
1429              p_base_key_value  => p_elig_per_id,
1430              p_from_date       => p_validation_start_date,
1431              p_to_date         => p_validation_end_date)))  Then
1432       l_table_name := 'ben_elig_per_f';
1433       Raise l_integrity_error;
1434     End If;
1435     If ((nvl(p_opt_id, hr_api.g_number) <> hr_api.g_number) and
1436       NOT (dt_api.check_min_max_dates
1437             (p_base_table_name => 'ben_opt_f',
1438              p_base_key_column => 'opt_id',
1439              p_base_key_value  => p_opt_id,
1440              p_from_date       => p_validation_start_date,
1441              p_to_date         => p_validation_end_date)))  Then
1442       l_table_name := 'ben_opt_f';
1443       Raise l_integrity_error;
1444     End If;
1445     --
1446   End If;
1447   --
1448   hr_utility.set_location(' Leaving:'||l_proc, 10);
1449 Exception
1450   When l_integrity_error Then
1451     --
1452     -- A referential integrity check was violated therefore
1453     -- we must error
1454     --
1455     fnd_message.set_name('PAY', 'HR_7216_DT_UPD_INTEGRITY_ERR');
1456     fnd_message.set_token('TABLE_NAME', l_table_name);
1457     fnd_message.raise_error;
1458   When Others Then
1459     --
1460     -- An unhandled or unexpected error has occurred which
1461     -- we must report
1462     --
1463     fnd_message.set_name('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
1464     fnd_message.set_token('PROCEDURE', l_proc);
1465     fnd_message.set_token('STEP','15');
1466     fnd_message.raise_error;
1467 End dt_update_validate;
1468 --
1469 -- ----------------------------------------------------------------------------
1470 -- |--------------------------< dt_delete_validate >--------------------------|
1471 -- ----------------------------------------------------------------------------
1472 -- {Start Of Comments}
1473 --
1474 -- Description:
1475 --   This procedure is used for referential integrity of datetracked
1476 --   child entities when either a datetrack DELETE or ZAP is in operation
1477 --   and where there is no cascading of delete defined for this entity.
1478 --   For the datetrack mode of DELETE or ZAP we must ensure that no
1479 --   datetracked child rows exist between the validation start and end
1480 --   dates.
1481 --
1482 -- Prerequisites:
1483 --   This procedure is called from the delete_validate.
1484 --
1485 -- In Parameters:
1486 --
1487 -- Post Success:
1488 --   Processing continues.
1489 --
1490 -- Post Failure:
1491 --   If a row exists by determining the returning Boolean value from the
1492 --   generic dt_api.rows_exist function then we must supply an error via
1493 --   the use of the local exception handler l_rows_exist.
1494 --
1495 -- Developer Implementation Notes:
1496 --   This procedure should not need maintenance unless the HR Schema model
1497 --   changes.
1498 --
1499 -- Access Status:
1500 --   Internal Row Handler Use Only.
1501 --
1502 -- {End Of Comments}
1503 -- ----------------------------------------------------------------------------
1504 Procedure dt_delete_validate
1505             (p_elig_per_opt_id        in number,
1506              p_datetrack_mode        in varchar2,
1507          p_validation_start_date    in date,
1508          p_validation_end_date    in date) Is
1509 --
1510   l_proc    varchar2(72)     := g_package||'dt_delete_validate';
1511   l_rows_exist    Exception;
1512   l_table_name    all_tables.table_name%TYPE;
1513 --
1514 Begin
1515   hr_utility.set_location('Entering:'||l_proc, 5);
1516   --
1517   -- Ensure that the p_datetrack_mode argument is not null
1518   --
1519   hr_api.mandatory_arg_error
1520     (p_api_name       => l_proc,
1521      p_argument       => 'datetrack_mode',
1522      p_argument_value => p_datetrack_mode);
1523   --
1527   If (p_datetrack_mode = 'DELETE' or
1524   -- Only perform the validation if the datetrack mode is either
1525   -- DELETE or ZAP
1526   --
1528       p_datetrack_mode = 'ZAP') then
1529     --
1530     --
1531     -- Ensure the arguments are not null
1532     --
1533     hr_api.mandatory_arg_error
1534       (p_api_name       => l_proc,
1535        p_argument       => 'validation_start_date',
1536        p_argument_value => p_validation_start_date);
1537     --
1538     hr_api.mandatory_arg_error
1539       (p_api_name       => l_proc,
1540        p_argument       => 'validation_end_date',
1541        p_argument_value => p_validation_end_date);
1542     --
1543     hr_api.mandatory_arg_error
1544       (p_api_name       => l_proc,
1545        p_argument       => 'elig_per_opt_id',
1546        p_argument_value => p_elig_per_opt_id);
1547     --
1548     --
1549     --
1550   End If;
1551   --
1552   hr_utility.set_location(' Leaving:'||l_proc, 10);
1553 Exception
1554   When l_rows_exist Then
1555     --
1556     -- A referential integrity check was violated therefore
1557     -- we must error
1558     --
1559     fnd_message.set_name('PAY', 'HR_7215_DT_CHILD_EXISTS');
1560     fnd_message.set_token('TABLE_NAME', l_table_name);
1561     fnd_message.raise_error;
1562   When Others Then
1563     --
1564     -- An unhandled or unexpected error has occurred which
1565     -- we must report
1566     --
1567     fnd_message.set_name('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
1568     fnd_message.set_token('PROCEDURE', l_proc);
1569     fnd_message.set_token('STEP','15');
1570     fnd_message.raise_error;
1571 End dt_delete_validate;
1572 --
1573 -- ----------------------------------------------------------------------------
1574 -- |---------------------------< insert_validate >----------------------------|
1575 -- ----------------------------------------------------------------------------
1576 Procedure insert_validate
1577     (p_rec              in ben_epo_shd.g_rec_type,
1578      p_effective_date     in date,
1579      p_datetrack_mode     in varchar2,
1580      p_validation_start_date in date,
1581      p_validation_end_date     in date) is
1582 --
1583   l_proc    varchar2(72) := g_package||'insert_validate';
1584 --
1585 Begin
1586   hr_utility.set_location('Entering:'||l_proc, 5);
1587   --
1588   -- Call all supporting business operations
1589   --
1590   --
1591   hr_api.validate_bus_grp_id(p_rec.business_group_id);  -- Validate Bus Grp
1592   --
1593   chk_elig_per_opt_id
1594   (p_elig_per_opt_id       => p_rec.elig_per_opt_id,
1595    p_elig_per_id           => p_rec.elig_per_id,
1596    p_opt_id                => p_rec.opt_id,
1597    p_effective_date        => p_effective_date,
1598    p_object_version_number => p_rec.object_version_number);
1599   --
1600   chk_prtn_ovridn_rsn_cd
1601   (p_elig_per_opt_id       => p_rec.elig_per_opt_id,
1602    p_prtn_ovridn_rsn_cd    => p_rec.prtn_ovridn_rsn_cd,
1603    p_effective_date        => p_effective_date,
1604    p_object_version_number => p_rec.object_version_number);
1605   --
1606   chk_elig_flag
1607   (p_elig_per_opt_id       => p_rec.elig_per_opt_id,
1608    p_elig_flag             => p_rec.elig_flag,
1609    p_effective_date        => p_effective_date,
1610    p_object_version_number => p_rec.object_version_number);
1611   --
1612   chk_no_mx_prtn_ovrid_thru_flag
1613   (p_elig_per_opt_id            => p_rec.elig_per_opt_id,
1614    p_no_mx_prtn_ovrid_thru_flag => p_rec.no_mx_prtn_ovrid_thru_flag,
1615    p_effective_date             => p_effective_date,
1616    p_object_version_number      => p_rec.object_version_number);
1617   --
1618   chk_once_r_cntug_cd
1619   (p_elig_per_opt_id            => p_rec.elig_per_opt_id,
1620    p_once_r_cntug_cd            => p_rec.once_r_cntug_cd,
1621    p_effective_date             => p_effective_date,
1622    p_object_version_number      => p_rec.object_version_number);
1623   --
1624   chk_prtn_ovridn_flag
1625   (p_elig_per_opt_id       => p_rec.elig_per_opt_id,
1626    p_prtn_ovridn_flag      => p_rec.prtn_ovridn_flag,
1627    p_effective_date        => p_effective_date,
1628    p_object_version_number => p_rec.object_version_number);
1629   --
1630   chk_all_freeze_flags
1631   (p_elig_per_opt_id              => p_rec.elig_per_opt_id,
1632    p_rt_frz_los_flag              => p_rec.rt_frz_los_flag,
1633    p_rt_frz_age_flag              => p_rec.rt_frz_age_flag,
1634    p_rt_frz_cmp_lvl_flag          => p_rec.rt_frz_cmp_lvl_flag,
1635    p_rt_frz_pct_fl_tm_flag        => p_rec.rt_frz_pct_fl_tm_flag,
1636    p_rt_frz_hrs_wkd_flag          => p_rec.rt_frz_hrs_wkd_flag,
1637    p_rt_frz_comb_age_and_los_flag => p_rec.rt_frz_comb_age_and_los_flag,
1638    p_frz_los_flag                 => p_rec.frz_los_flag,
1639    p_frz_age_flag                 => p_rec.frz_age_flag,
1640    p_frz_cmp_lvl_flag             => p_rec.frz_cmp_lvl_flag,
1641    p_frz_pct_fl_tm_flag           => p_rec.frz_pct_fl_tm_flag,
1642    p_frz_hrs_wkd_flag             => p_rec.frz_hrs_wkd_flag,
1643    p_frz_comb_age_and_los_flag    => p_rec.frz_comb_age_and_los_flag,
1644    p_effective_date               => p_effective_date,
1645    p_object_version_number        => p_rec.object_version_number);
1646   --
1647   chk_comp_ref_uom
1648     (p_elig_per_opt_id       => p_rec.elig_per_opt_id,
1652      p_rt_comp_ref_uom       => p_rec.rt_comp_ref_uom,
1649      p_comp_ref_val          => p_rec.comp_ref_amt,
1650      p_comp_ref_uom          => p_rec.comp_ref_uom,
1651      p_rt_comp_ref_val       => p_rec.rt_comp_ref_amt,
1653      p_effective_date        => p_effective_date,
1654      p_object_version_number => p_rec.object_version_number);
1655   --
1656   chk_hrs_wkd_bndry_perd_cd
1657     (p_elig_per_opt_id          => p_rec.elig_per_opt_id,
1658      p_hrs_wkd_bndry_perd_cd    => p_rec.hrs_wkd_bndry_perd_cd,
1659      p_rt_hrs_wkd_bndry_perd_cd => p_rec.rt_hrs_wkd_bndry_perd_cd,
1660      p_effective_date           => p_effective_date,
1661      p_object_version_number    => p_rec.object_version_number);
1662   --
1663   chk_pct_val
1664     (p_pct_val               => p_rec.pct_fl_tm_val,
1665      p_rt_pct_val            => p_rec.rt_pct_fl_tm_val);
1666   --
1667   chk_age_uom
1668     (p_elig_per_opt_id       => p_rec.elig_per_opt_id,
1669      p_age_val               => p_rec.age_val,
1670      p_age_uom               => p_rec.age_uom,
1671      p_rt_age_val            => p_rec.rt_age_val,
1672      p_rt_age_uom            => p_rec.rt_age_uom,
1673      p_effective_date        => p_effective_date,
1674      p_object_version_number => p_rec.object_version_number);
1675   --
1676   chk_los_uom
1677     (p_elig_per_opt_id       => p_rec.elig_per_opt_id,
1678      p_los_val               => p_rec.los_val,
1679      p_los_uom               => p_rec.los_uom,
1680      p_rt_los_val            => p_rec.rt_los_val,
1681      p_rt_los_uom            => p_rec.rt_los_uom,
1682      p_effective_date        => p_effective_date,
1683      p_object_version_number => p_rec.object_version_number);
1684   --
1685   chk_inelg_rsn_cd
1686     (p_elig_per_opt_id       => p_rec.elig_per_opt_id,
1687      p_inelg_rsn_cd          => p_rec.inelg_rsn_cd,
1688      p_effective_date        => p_effective_date,
1689      p_object_version_number => p_rec.object_version_number);
1690   --
1691   hr_utility.set_location(' Leaving:'||l_proc, 10);
1692 End insert_validate;
1693 --
1694 -- ----------------------------------------------------------------------------
1695 -- |---------------------------< update_validate >----------------------------|
1696 -- ----------------------------------------------------------------------------
1697 Procedure update_validate
1698     (p_rec              in ben_epo_shd.g_rec_type,
1699      p_effective_date     in date,
1700      p_datetrack_mode     in varchar2,
1701      p_validation_start_date in date,
1702      p_validation_end_date     in date) is
1703 --
1704   l_proc    varchar2(72) := g_package||'update_validate';
1705 --
1706 Begin
1707   hr_utility.set_location('Entering:'||l_proc, 5);
1708   --
1709   -- Call all supporting business operations
1710   --
1711   --
1712   hr_api.validate_bus_grp_id(p_rec.business_group_id);  -- Validate Bus Grp
1713   --
1714   chk_elig_per_opt_id
1715   (p_elig_per_opt_id       => p_rec.elig_per_opt_id,
1716    p_elig_per_id           => p_rec.elig_per_id,
1717    p_opt_id                => p_rec.opt_id,
1718    p_effective_date        => p_effective_date,
1719    p_object_version_number => p_rec.object_version_number);
1720   --
1721   chk_prtn_ovridn_rsn_cd
1722   (p_elig_per_opt_id       => p_rec.elig_per_opt_id,
1723    p_prtn_ovridn_rsn_cd    => p_rec.prtn_ovridn_rsn_cd,
1724    p_effective_date        => p_effective_date,
1725    p_object_version_number => p_rec.object_version_number);
1726   --
1727   chk_elig_flag
1728   (p_elig_per_opt_id       => p_rec.elig_per_opt_id,
1729    p_elig_flag             => p_rec.elig_flag,
1730    p_effective_date        => p_effective_date,
1731    p_object_version_number => p_rec.object_version_number);
1732   --
1733   chk_no_mx_prtn_ovrid_thru_flag
1734   (p_elig_per_opt_id            => p_rec.elig_per_opt_id,
1735    p_no_mx_prtn_ovrid_thru_flag => p_rec.no_mx_prtn_ovrid_thru_flag,
1736    p_effective_date             => p_effective_date,
1737    p_object_version_number      => p_rec.object_version_number);
1738   --
1739   chk_once_r_cntug_cd
1740   (p_elig_per_opt_id            => p_rec.elig_per_opt_id,
1741    p_once_r_cntug_cd            => p_rec.once_r_cntug_cd,
1742    p_effective_date             => p_effective_date,
1743    p_object_version_number      => p_rec.object_version_number);
1744   --
1745   chk_prtn_ovridn_flag
1746   (p_elig_per_opt_id       => p_rec.elig_per_opt_id,
1747    p_prtn_ovridn_flag      => p_rec.prtn_ovridn_flag,
1748    p_effective_date        => p_effective_date,
1749    p_object_version_number => p_rec.object_version_number);
1750   --
1751   chk_all_freeze_flags
1752   (p_elig_per_opt_id              => p_rec.elig_per_opt_id,
1753    p_rt_frz_los_flag              => p_rec.rt_frz_los_flag,
1754    p_rt_frz_age_flag              => p_rec.rt_frz_age_flag,
1755    p_rt_frz_cmp_lvl_flag          => p_rec.rt_frz_cmp_lvl_flag,
1756    p_rt_frz_pct_fl_tm_flag        => p_rec.rt_frz_pct_fl_tm_flag,
1757    p_rt_frz_hrs_wkd_flag          => p_rec.rt_frz_hrs_wkd_flag,
1758    p_rt_frz_comb_age_and_los_flag => p_rec.rt_frz_comb_age_and_los_flag,
1759    p_frz_los_flag                 => p_rec.frz_los_flag,
1760    p_frz_age_flag                 => p_rec.frz_age_flag,
1761    p_frz_cmp_lvl_flag             => p_rec.frz_cmp_lvl_flag,
1762    p_frz_pct_fl_tm_flag           => p_rec.frz_pct_fl_tm_flag,
1763    p_frz_hrs_wkd_flag             => p_rec.frz_hrs_wkd_flag,
1767   --
1764    p_frz_comb_age_and_los_flag    => p_rec.frz_comb_age_and_los_flag,
1765    p_effective_date               => p_effective_date,
1766    p_object_version_number        => p_rec.object_version_number);
1768   chk_comp_ref_uom
1769     (p_elig_per_opt_id       => p_rec.elig_per_opt_id,
1770      p_comp_ref_val          => p_rec.comp_ref_amt,
1771      p_comp_ref_uom          => p_rec.comp_ref_uom,
1772      p_rt_comp_ref_val       => p_rec.rt_comp_ref_amt,
1773      p_rt_comp_ref_uom       => p_rec.rt_comp_ref_uom,
1774      p_effective_date        => p_effective_date,
1775      p_object_version_number => p_rec.object_version_number);
1776   --
1777   chk_hrs_wkd_bndry_perd_cd
1778     (p_elig_per_opt_id          => p_rec.elig_per_opt_id,
1779      p_hrs_wkd_bndry_perd_cd    => p_rec.hrs_wkd_bndry_perd_cd,
1780      p_rt_hrs_wkd_bndry_perd_cd => p_rec.rt_hrs_wkd_bndry_perd_cd,
1781      p_effective_date           => p_effective_date,
1782      p_object_version_number    => p_rec.object_version_number);
1783   --
1784   chk_pct_val
1785     (p_pct_val               => p_rec.pct_fl_tm_val,
1786      p_rt_pct_val            => p_rec.rt_pct_fl_tm_val);
1787   --
1788   chk_age_uom
1789     (p_elig_per_opt_id       => p_rec.elig_per_opt_id,
1790      p_age_val               => p_rec.age_val,
1791      p_age_uom               => p_rec.age_uom,
1792      p_rt_age_val            => p_rec.rt_age_val,
1793      p_rt_age_uom            => p_rec.rt_age_uom,
1794      p_effective_date        => p_effective_date,
1795      p_object_version_number => p_rec.object_version_number);
1796   --
1797   chk_los_uom
1798     (p_elig_per_opt_id       => p_rec.elig_per_opt_id,
1799      p_los_val               => p_rec.los_val,
1800      p_los_uom               => p_rec.los_uom,
1801      p_rt_los_val            => p_rec.rt_los_val,
1802      p_rt_los_uom            => p_rec.rt_los_uom,
1803      p_effective_date        => p_effective_date,
1804      p_object_version_number => p_rec.object_version_number);
1805   --
1806   chk_inelg_rsn_cd
1807     (p_elig_per_opt_id       => p_rec.elig_per_opt_id,
1808      p_inelg_rsn_cd          => p_rec.inelg_rsn_cd,
1809      p_effective_date        => p_effective_date,
1810      p_object_version_number => p_rec.object_version_number);
1811   --
1812   -- Call the datetrack update integrity operation
1813   --
1814   dt_update_validate
1815     (p_elig_per_id                   => p_rec.elig_per_id,
1816      p_opt_id                        => p_rec.opt_id,
1817      p_datetrack_mode                => p_datetrack_mode,
1818      p_validation_start_date         => p_validation_start_date,
1819      p_validation_end_date         => p_validation_end_date);
1820   --
1821   hr_utility.set_location(' Leaving:'||l_proc, 10);
1822 End update_validate;
1823 --
1824 -- ----------------------------------------------------------------------------
1825 -- |---------------------------< delete_validate >----------------------------|
1826 -- ----------------------------------------------------------------------------
1827 Procedure delete_validate
1828     (p_rec              in ben_epo_shd.g_rec_type,
1829      p_effective_date     in date,
1830      p_datetrack_mode     in varchar2,
1831      p_validation_start_date in date,
1832      p_validation_end_date     in date) is
1833 --
1834   l_proc    varchar2(72) := g_package||'delete_validate';
1835 --
1836 Begin
1837   hr_utility.set_location('Entering:'||l_proc, 5);
1838   --
1839   -- Call all supporting business operations
1840   --
1841   dt_delete_validate
1842     (p_datetrack_mode        => p_datetrack_mode,
1843      p_validation_start_date    => p_validation_start_date,
1844      p_validation_end_date    => p_validation_end_date,
1845      p_elig_per_opt_id        => p_rec.elig_per_opt_id);
1846   --
1847   hr_utility.set_location(' Leaving:'||l_proc, 10);
1848 End delete_validate;
1849 --
1850 --  ---------------------------------------------------------------------------
1851 --  |---------------------< return_legislation_code >-------------------------|
1852 --  ---------------------------------------------------------------------------
1853 --
1854 function return_legislation_code
1855   (p_elig_per_opt_id in number) return varchar2 is
1856   --
1857   -- Declare cursor
1858   --
1859   cursor csr_leg_code is
1860     select a.legislation_code
1861     from   per_business_groups a,
1862            ben_elig_per_opt_f b
1863     where b.elig_per_opt_id      = p_elig_per_opt_id
1864     and   a.business_group_id = b.business_group_id;
1865   --
1866   -- Declare local variables
1867   --
1868   l_legislation_code  varchar2(150);
1869   l_proc              varchar2(72)  :=  g_package||'return_legislation_code';
1870   --
1871 begin
1872   --
1873   hr_utility.set_location('Entering:'|| l_proc, 10);
1874   --
1875   -- Ensure that all the mandatory parameter are not null
1876   --
1877   hr_api.mandatory_arg_error(p_api_name       => l_proc,
1878                              p_argument       => 'elig_per_opt_id',
1879                              p_argument_value => p_elig_per_opt_id);
1880   --
1881   open csr_leg_code;
1882     --
1883     fetch csr_leg_code into l_legislation_code;
1884     --
1885     if csr_leg_code%notfound then
1886       --
1887       close csr_leg_code;
1888       --
1889       -- The primary key is invalid therefore we must error
1890       --
1891       fnd_message.set_name('PAY','HR_7220_INVALID_PRIMARY_KEY');
1892       fnd_message.raise_error;
1893       --
1894     end if;
1895     --
1896   close csr_leg_code;
1897   --
1898   hr_utility.set_location(' Leaving:'|| l_proc, 20);
1899   --
1900   return l_legislation_code;
1901   --
1902 end return_legislation_code;
1903 --
1904 end ben_epo_bus;