DBA Data[Home] [Help]

PACKAGE BODY: APPS.BEN_BEC_BUS

Source


1 Package Body ben_bec_bus as
2 /* $Header: bebecrhi.pkb 120.0 2005/05/28 00:37:26 appldev noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33)	:= '  ben_bec_bus.';  -- Global package name
9 --
10 -- ----------------------------------------------------------------------------
11 -- |-------------------------< chk_batch_elctbl_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 --   batch_elctbl_id PK of record being inserted or updated.
24 --   object_version_number Object version number of record being
25 --                         inserted or updated.
26 --
27 -- Post Success
28 --   Processing continues
29 --
30 -- Post Failure
31 --   Errors handled by the procedure
32 --
33 -- Access Status
34 --   Internal table handler use only.
35 --
36 Procedure chk_batch_elctbl_id(p_batch_elctbl_id             in number,
37                               p_object_version_number       in number) is
38   --
39   l_proc         varchar2(72) := g_package||'chk_batch_elctbl_id';
40   l_api_updating boolean;
41   --
42 Begin
43   --
44   hr_utility.set_location('Entering:'||l_proc, 5);
45   --
46   l_api_updating := ben_bec_shd.api_updating
47     (p_batch_elctbl_id             => p_batch_elctbl_id,
48      p_object_version_number       => p_object_version_number);
49   --
50   if (l_api_updating
51      and nvl(p_batch_elctbl_id,hr_api.g_number)
52      <>  ben_bec_shd.g_old_rec.batch_elctbl_id) then
53     --
54     -- raise error as PK has changed
55     --
56     ben_bec_shd.constraint_error('BEN_BATCH_ELCTBL_CHC_INFO_PK');
57     --
58   elsif not l_api_updating then
59     --
60     -- check if PK is null
61     --
62     if p_batch_elctbl_id is not null then
63       --
64       -- raise error as PK is not null
65       --
66       ben_bec_shd.constraint_error('BEN_BATCH_ELCTBL_CHC_INFO_PK');
67       --
68     end if;
69     --
70   end if;
71   --
72   hr_utility.set_location('Leaving:'||l_proc, 10);
73   --
74 End chk_batch_elctbl_id;
75 --
76 -- ----------------------------------------------------------------------------
77 -- |------------------------< chk_person_id >---------------------------------|
78 -- ----------------------------------------------------------------------------
79 --
80 -- Description
81 --   This procedure checks that a referenced foreign key actually exists
82 --   in the referenced table.
83 --
84 -- Pre-Conditions
85 --   None.
86 --
87 -- In Parameters
88 --   p_batch_elctbl_id PK
89 --   p_person_id ID of FK column
90 --   p_effective_date Session Date of record
91 --   p_object_version_number object version number
92 --
93 -- Post Success
94 --   Processing continues
95 --
96 -- Post Failure
97 --   Error raised.
98 --
99 -- Access Status
100 --   Internal table handler use only.
101 --
102 Procedure chk_person_id (p_batch_elctbl_id       in number,
103                          p_person_id             in number,
104                          p_effective_date        in date,
105                          p_object_version_number in number) is
106   --
107   l_proc         varchar2(72) := g_package||'chk_person_id';
108   l_api_updating boolean;
109   l_dummy        varchar2(1);
110   --
111   cursor c1 is
112     select null
113     from   per_all_people_f a
114     where  a.person_id = p_person_id
115     and    p_effective_date
116            between a.effective_start_date
117            and     a.effective_end_date;
118   --
119 Begin
120   --
121   hr_utility.set_location('Entering:'||l_proc,5);
122   --
123   l_api_updating := ben_bec_shd.api_updating
124      (p_batch_elctbl_id         => p_batch_elctbl_id,
125       p_object_version_number   => p_object_version_number);
126   --
127   if (l_api_updating
128      and nvl(p_person_id,hr_api.g_number)
129      <> nvl(ben_bec_shd.g_old_rec.person_id,hr_api.g_number)
130      or not l_api_updating) then
131     --
132     -- check if person_id value exists in per_all_people_f table
133     --
134     open c1;
135       --
136       fetch c1 into l_dummy;
137       if c1%notfound then
138         --
139         close c1;
140         --
141         -- raise error as FK does not relate to PK in per_all_people_f
142         -- table.
143         --
144         ben_bec_shd.constraint_error('BEN_BATCH_ELCTBL_CHC_INFO_DT4');
145         --
146       end if;
147       --
148     close c1;
149     --
150   end if;
151   --
152   hr_utility.set_location('Leaving:'||l_proc,10);
153   --
154 End chk_person_id;
155 --
156 -- ----------------------------------------------------------------------------
157 -- |------------------------------< chk_oipl_id >-----------------------------|
158 -- ----------------------------------------------------------------------------
159 --
160 -- Description
161 --   This procedure checks that a referenced foreign key actually exists
162 --   in the referenced table.
163 --
164 -- Pre-Conditions
165 --   None.
166 --
167 -- In Parameters
168 --   p_batch_elctbl_id PK
169 --   p_oipl_id ID of FK column
170 --   p_effective_date Session Date of record
171 --   p_object_version_number object version number
172 --
173 -- Post Success
174 --   Processing continues
175 --
176 -- Post Failure
177 --   Error raised.
178 --
179 -- Access Status
180 --   Internal table handler use only.
181 --
182 Procedure chk_oipl_id (p_batch_elctbl_id       in number,
183                        p_oipl_id               in number,
184                        p_effective_date        in date,
185                        p_object_version_number in number) is
186   --
187   l_proc         varchar2(72) := g_package||'chk_oipl_id';
188   l_api_updating boolean;
189   l_dummy        varchar2(1);
190   --
191   cursor c1 is
192     select null
193     from   ben_oipl_f a
194     where  a.oipl_id = p_oipl_id
195     and    p_effective_date
196            between a.effective_start_date
197            and     a.effective_end_date;
198   --
199 Begin
200   --
201   hr_utility.set_location('Entering:'||l_proc,5);
202   --
203   l_api_updating := ben_bec_shd.api_updating
204      (p_batch_elctbl_id         => p_batch_elctbl_id,
205       p_object_version_number   => p_object_version_number);
206   --
207   if (l_api_updating
208      and nvl(p_oipl_id,hr_api.g_number)
209      <> nvl(ben_bec_shd.g_old_rec.oipl_id,hr_api.g_number)
210      or not l_api_updating) and
211      p_oipl_id is not null then
212     --
213     -- check if oipl_id value exists in ben_oipl_f table
214     --
215     open c1;
216       --
217       fetch c1 into l_dummy;
218       if c1%notfound then
219         --
220         close c1;
221         --
222         -- raise error as FK does not relate to PK in ben_oipl_f
223         -- table.
224         --
225         ben_bec_shd.constraint_error('BEN_BATCH_ELCTBL_CHC_INFO_DT3');
226         --
227       end if;
228       --
229     close c1;
230     --
231   end if;
232   --
233   hr_utility.set_location('Leaving:'||l_proc,10);
234   --
235 End chk_oipl_id;
236 --
237 -- ----------------------------------------------------------------------------
238 -- |-----------------------------< chk_pl_id >--------------------------------|
239 -- ----------------------------------------------------------------------------
240 --
241 -- Description
242 --   This procedure checks that a referenced foreign key actually exists
243 --   in the referenced table.
244 --
245 -- Pre-Conditions
246 --   None.
247 --
248 -- In Parameters
249 --   p_batch_elctbl_id PK
250 --   p_pl_id ID of FK column
251 --   p_effective_date Session Date of record
252 --   p_object_version_number object version number
253 --
254 -- Post Success
255 --   Processing continues
256 --
257 -- Post Failure
258 --   Error raised.
259 --
260 -- Access Status
261 --   Internal table handler use only.
262 --
263 Procedure chk_pl_id (p_batch_elctbl_id       in number,
264                      p_pl_id                 in number,
265                      p_effective_date        in date,
266                      p_object_version_number in number) is
267   --
268   l_proc         varchar2(72) := g_package||'chk_pl_id';
269   l_api_updating boolean;
270   l_dummy        varchar2(1);
271   --
272   cursor c1 is
273     select null
274     from   ben_pl_f a
275     where  a.pl_id = p_pl_id
276     and    p_effective_date
277            between a.effective_start_date
278            and     a.effective_end_date;
279   --
280 Begin
281   --
282   hr_utility.set_location('Entering:'||l_proc,5);
283   --
284   l_api_updating := ben_bec_shd.api_updating
285      (p_batch_elctbl_id         => p_batch_elctbl_id,
286       p_object_version_number   => p_object_version_number);
287   --
288   if (l_api_updating
289      and nvl(p_pl_id,hr_api.g_number)
290      <> nvl(ben_bec_shd.g_old_rec.pl_id,hr_api.g_number)
291      or not l_api_updating) and
292      p_pl_id is not null then
293     --
294     -- check if pl_id value exists in ben_pl_f table
295     --
296     open c1;
297       --
298       fetch c1 into l_dummy;
299       if c1%notfound then
300         --
301         close c1;
302         --
303         -- raise error as FK does not relate to PK in ben_pl_f
304         -- table.
305         --
306         ben_bec_shd.constraint_error('BEN_BATCH_ELCTBL_CHC_INFO_DT2');
307         --
308       end if;
309       --
310     close c1;
311     --
312   end if;
313   --
314   hr_utility.set_location('Leaving:'||l_proc,10);
315   --
316 End chk_pl_id;
317 --
318 -- ----------------------------------------------------------------------------
319 -- |-----------------------< chk_pgm_id >-------------------------------------|
320 -- ----------------------------------------------------------------------------
321 --
322 -- Description
323 --   This procedure checks that a referenced foreign key actually exists
324 --   in the referenced table.
325 --
326 -- Pre-Conditions
327 --   None.
328 --
329 -- In Parameters
330 --   p_batch_elctbl_id PK
331 --   p_pgm_id ID of FK column
332 --   p_effective_date Session Date of record
333 --   p_object_version_number object version number
334 --
335 -- Post Success
336 --   Processing continues
337 --
338 -- Post Failure
339 --   Error raised.
340 --
341 -- Access Status
342 --   Internal table handler use only.
343 --
344 Procedure chk_pgm_id (p_batch_elctbl_id       in number,
345                       p_pgm_id                in number,
346                       p_effective_date        in date,
347                       p_object_version_number in number) is
348   --
349   l_proc         varchar2(72) := g_package||'chk_pgm_id';
350   l_api_updating boolean;
351   l_dummy        varchar2(1);
352   --
353   cursor c1 is
354     select null
355     from   ben_pgm_f a
356     where  a.pgm_id = p_pgm_id
357     and    p_effective_date
358            between a.effective_start_date
359            and     a.effective_end_date;
360   --
361 Begin
362   --
363   hr_utility.set_location('Entering:'||l_proc,5);
364   --
365   l_api_updating := ben_bec_shd.api_updating
366      (p_batch_elctbl_id         => p_batch_elctbl_id,
367       p_object_version_number   => p_object_version_number);
368   --
369   if (l_api_updating
370      and nvl(p_pgm_id,hr_api.g_number)
371      <> nvl(ben_bec_shd.g_old_rec.pgm_id,hr_api.g_number)
372      or not l_api_updating) and
373      p_pgm_id is not null then
374     --
375     -- check if pgm_id value exists in ben_pgm_f table
376     --
377     open c1;
378       --
379       fetch c1 into l_dummy;
380       if c1%notfound then
381         --
382         close c1;
383         --
384         -- raise error as FK does not relate to PK in ben_pgm_f
385         -- table.
386         --
387         ben_bec_shd.constraint_error('BEN_BATCH_ELCTBL_CHC_INFO_DT1');
388         --
389       end if;
390       --
391     close c1;
392     --
393   end if;
394   --
395   hr_utility.set_location('Leaving:'||l_proc,10);
396   --
397 End chk_pgm_id;
398 --
399 -- ----------------------------------------------------------------------------
400 -- |------------------------------< chk_benefit_action_id >-------------------|
401 -- ----------------------------------------------------------------------------
402 --
403 -- Description
404 --   This procedure checks that a referenced foreign key actually exists
405 --   in the referenced table.
406 --
407 -- Pre-Conditions
408 --   None.
409 --
410 -- In Parameters
411 --   p_batch_elctbl_id PK
412 --   p_benefit_action_id ID of FK column
413 --   p_object_version_number object version number
414 --
415 -- Post Success
416 --   Processing continues
417 --
418 -- Post Failure
419 --   Error raised.
420 --
421 -- Access Status
422 --   Internal table handler use only.
423 --
424 Procedure chk_benefit_action_id (p_batch_elctbl_id       in number,
425                                  p_benefit_action_id     in number,
426                                  p_object_version_number in number) is
427   --
428   l_proc         varchar2(72) := g_package||'chk_benefit_action_id';
429   l_api_updating boolean;
430   l_dummy        varchar2(1);
431   --
432   cursor c1 is
433     select null
434     from   ben_benefit_actions a
435     where  a.benefit_action_id = p_benefit_action_id;
436   --
437 Begin
438   --
439   hr_utility.set_location('Entering:'||l_proc,5);
440   --
441   l_api_updating := ben_bec_shd.api_updating
442      (p_batch_elctbl_id         => p_batch_elctbl_id,
443       p_object_version_number   => p_object_version_number);
444   --
445   if (l_api_updating
446      and nvl(p_benefit_action_id,hr_api.g_number)
447      <> nvl(ben_bec_shd.g_old_rec.benefit_action_id,hr_api.g_number)
448      or not l_api_updating) then
449     --
450     -- check if benefit_action_id value exists in ben_benefit_actions table
451     --
452     open c1;
453       --
454       fetch c1 into l_dummy;
455       if c1%notfound then
456         --
457         close c1;
458         --
459         -- raise error as FK does not relate to PK in ben_benefit_actions
460         -- table.
461         --
462         ben_bec_shd.constraint_error('BEN_BATCH_ELCTBL_CHC_INFO_FK1');
463         --
464       end if;
465       --
466     close c1;
467     --
468   end if;
469   --
470   hr_utility.set_location('Leaving:'||l_proc,10);
471   --
472 End chk_benefit_action_id;
473 --
474 -- ----------------------------------------------------------------------------
475 -- |---------------------------< chk_dflt_flag >------------------------------|
476 -- ----------------------------------------------------------------------------
477 --
478 -- Description
479 --   This procedure is used to check that the lookup value is valid.
480 --
481 -- Pre Conditions
482 --   None.
483 --
484 -- In Parameters
485 --   batch_elctbl_id PK of record being inserted or updated.
486 --   dflt_flag Value of lookup code.
487 --   effective_date effective date
488 --   object_version_number Object version number of record being
489 --                         inserted or updated.
490 --
491 -- Post Success
492 --   Processing continues
493 --
494 -- Post Failure
495 --   Error handled by procedure
496 --
497 -- Access Status
498 --   Internal table handler use only.
499 --
500 Procedure chk_dflt_flag(p_batch_elctbl_id         in number,
501                         p_dflt_flag               in varchar2,
502                         p_effective_date          in date,
503                         p_object_version_number   in number) is
504   --
505   l_proc         varchar2(72) := g_package||'chk_dflt_flag';
506   l_api_updating boolean;
507   --
508 Begin
509   --
510   hr_utility.set_location('Entering:'||l_proc, 5);
511   --
512   l_api_updating := ben_bec_shd.api_updating
513     (p_batch_elctbl_id             => p_batch_elctbl_id,
514      p_object_version_number       => p_object_version_number);
515   --
516   if (l_api_updating
517       and p_dflt_flag
518       <> nvl(ben_bec_shd.g_old_rec.dflt_flag,hr_api.g_varchar2)
519       or not l_api_updating) then
520     --
521     -- check if value of lookup falls within lookup type.
522     --
523     --
524     if hr_api.not_exists_in_hr_lookups
525           (p_lookup_type    => 'YES_NO',
526            p_lookup_code    => p_dflt_flag,
527            p_effective_date => p_effective_date) then
528       --
529       -- raise error as does not exist as lookup
530       --
531       fnd_message.set_name('BEN','BEN_91628_LOOKUP_TYPE_GENERIC');
532       fnd_message.set_token('FIELD','p_dflt_flag');
533       fnd_message.set_token('TYPE','YES_NO');
534       fnd_message.raise_error;
535       --
536     end if;
537     --
538   end if;
539   --
540   hr_utility.set_location('Leaving:'||l_proc,10);
541   --
542 end chk_dflt_flag;
543 --
544 -- ----------------------------------------------------------------------------
545 -- |-----------------------------< chk_mndtry_flag >--------------------------|
546 -- ----------------------------------------------------------------------------
547 --
548 -- Description
549 --   This procedure is used to check that the lookup value is valid.
550 --
551 -- Pre Conditions
552 --   None.
553 --
554 -- In Parameters
555 --   batch_elctbl_id PK of record being inserted or updated.
556 --   mndtry_flag Value of lookup code.
557 --   effective_date effective date
558 --   object_version_number Object version number of record being
559 --                         inserted or updated.
560 --
561 -- Post Success
562 --   Processing continues
563 --
564 -- Post Failure
565 --   Error handled by procedure
566 --
567 -- Access Status
568 --   Internal table handler use only.
569 --
570 Procedure chk_mndtry_flag(p_batch_elctbl_id           in number,
571                           p_mndtry_flag               in varchar2,
572                           p_effective_date            in date,
573                           p_object_version_number     in number) is
574   --
575   l_proc         varchar2(72) := g_package||'chk_mndtry_flag';
576   l_api_updating boolean;
577   --
578 Begin
579   --
580   hr_utility.set_location('Entering:'||l_proc, 5);
581   --
582   l_api_updating := ben_bec_shd.api_updating
583     (p_batch_elctbl_id             => p_batch_elctbl_id,
584      p_object_version_number       => p_object_version_number);
585   --
586   if (l_api_updating
587       and p_mndtry_flag
588       <> nvl(ben_bec_shd.g_old_rec.mndtry_flag,hr_api.g_varchar2)
589       or not l_api_updating) then
590     --
591     -- check if value of lookup falls within lookup type.
592     --
593     --
594     if hr_api.not_exists_in_hr_lookups
595           (p_lookup_type    => 'YES_NO',
596            p_lookup_code    => p_mndtry_flag,
597            p_effective_date => p_effective_date) then
598       --
599       -- raise error as does not exist as lookup
600       --
601       fnd_message.set_name('BEN','BEN_91628_LOOKUP_TYPE_GENERIC');
602       fnd_message.set_token('FIELD','p_mndtry_flag');
603       fnd_message.set_token('TYPE','YES_NO');
604       fnd_message.raise_error;
605       --
606     end if;
607     --
608   end if;
609   --
610   hr_utility.set_location('Leaving:'||l_proc,10);
611   --
612 end chk_mndtry_flag;
613 --
614 -- ----------------------------------------------------------------------------
615 -- |-------------------------< chk_comp_lvl_cd >------------------------------|
616 -- ----------------------------------------------------------------------------
617 --
618 -- Description
619 --   This procedure is used to check that the lookup value is valid.
620 --
621 -- Pre Conditions
622 --   None.
623 --
624 -- In Parameters
625 --   batch_elctbl_id PK of record being inserted or updated.
626 --   comp_lvl_cd Value of lookup code.
627 --   effective_date effective date
628 --   object_version_number Object version number of record being
629 --                         inserted or updated.
630 --
631 -- Post Success
632 --   Processing continues
633 --
634 -- Post Failure
635 --   Error handled by procedure
636 --
637 -- Access Status
638 --   Internal table handler use only.
639 --
640 Procedure chk_comp_lvl_cd(p_batch_elctbl_id           in number,
641                           p_comp_lvl_cd               in varchar2,
642                           p_effective_date            in date,
643                           p_object_version_number     in number) is
644   --
645   l_proc         varchar2(72) := g_package||'chk_comp_lvl_cd';
646   l_api_updating boolean;
647   --
648 Begin
649   --
650   hr_utility.set_location('Entering:'||l_proc, 5);
651   --
652   l_api_updating := ben_bec_shd.api_updating
653     (p_batch_elctbl_id             => p_batch_elctbl_id,
654      p_object_version_number       => p_object_version_number);
655   --
656   if (l_api_updating
657       and p_comp_lvl_cd
658       <> nvl(ben_bec_shd.g_old_rec.comp_lvl_cd,hr_api.g_varchar2)
659       or not l_api_updating)
660       and p_comp_lvl_cd is not null then
661     --
662     -- check if value of lookup falls within lookup type.
663     --
664     if hr_api.not_exists_in_hr_lookups
665           (p_lookup_type    => 'BEN_COMP_LVL',
666            p_lookup_code    => p_comp_lvl_cd,
667            p_effective_date => p_effective_date) then
668       --
669       -- raise error as does not exist as lookup
670       --
671       fnd_message.set_name('BEN','BEN_91628_LOOKUP_TYPE_GENERIC');
672       fnd_message.set_token('FIELD','p_comp_lvl_cd');
673       fnd_message.set_token('TYPE','BEN_COMP_LVL');
674       fnd_message.raise_error;
675       --
676     end if;
677     --
678   end if;
679   --
680   hr_utility.set_location('Leaving:'||l_proc,10);
681   --
682 end chk_comp_lvl_cd;
683 --
684 -- ----------------------------------------------------------------------------
685 -- |------------------------< chk_enrt_typ_cycl_cd >--------------------------|
686 -- ----------------------------------------------------------------------------
687 --
688 -- Description
689 --   This procedure is used to check that the lookup value is valid.
690 --
691 -- Pre Conditions
692 --   None.
693 --
694 -- In Parameters
695 --   batch_elctbl_id PK of record being inserted or updated.
696 --   enrt_typ_cycl_cd Value of lookup code.
697 --   effective_date effective date
698 --   object_version_number Object version number of record being
699 --                         inserted or updated.
700 --
701 -- Post Success
702 --   Processing continues
703 --
704 -- Post Failure
705 --   Error handled by procedure
706 --
707 -- Access Status
708 --   Internal table handler use only.
709 --
710 Procedure chk_enrt_typ_cycl_cd(p_batch_elctbl_id             in number,
711                                p_enrt_typ_cycl_cd            in varchar2,
712                                p_effective_date              in date,
713                                p_object_version_number       in number) is
714   --
715   l_proc         varchar2(72) := g_package||'chk_enrt_typ_cycl_cd';
716   l_api_updating boolean;
717   --
718 Begin
719   --
720   hr_utility.set_location('Entering:'||l_proc, 5);
721   --
722   l_api_updating := ben_bec_shd.api_updating
723     (p_batch_elctbl_id             => p_batch_elctbl_id,
724      p_object_version_number       => p_object_version_number);
725   --
726   if (l_api_updating
727       and p_enrt_typ_cycl_cd
728       <> nvl(ben_bec_shd.g_old_rec.enrt_typ_cycl_cd,hr_api.g_varchar2)
729       or not l_api_updating)
730       and p_enrt_typ_cycl_cd is not null then
731     --
732     -- check if value of lookup falls within lookup type.
733     --
734     if hr_api.not_exists_in_hr_lookups
735           (p_lookup_type    => 'BEN_ENRT_TYP_CYCL',
736            p_lookup_code    => p_enrt_typ_cycl_cd,
737            p_effective_date => p_effective_date) then
738       --
739       -- raise error as does not exist as lookup
740       --
741       fnd_message.set_name('BEN','BEN_91628_LOOKUP_TYPE_GENERIC');
742       fnd_message.set_token('FIELD','p_enrt_typ_cycl_cd');
743       fnd_message.set_token('TYPE','BEN_ENRT_TYP_CYCL');
744       fnd_message.raise_error;
745       --
746     end if;
747     --
748   end if;
749   --
750   hr_utility.set_location('Leaving:'||l_proc,10);
751   --
752 end chk_enrt_typ_cycl_cd;
753 --
754 -- ----------------------------------------------------------------------------
755 -- |---------------------------< insert_validate >----------------------------|
756 -- ----------------------------------------------------------------------------
757 Procedure insert_validate(p_rec in ben_bec_shd.g_rec_type
758                          ,p_effective_date in date) is
759 --
760   l_proc  varchar2(72) := g_package||'insert_validate';
761 --
762 Begin
763   hr_utility.set_location('Entering:'||l_proc, 5);
764   --
765   -- Call all supporting business operations
766   --
767   --
768   hr_api.validate_bus_grp_id(p_rec.business_group_id);  -- Validate Bus Grp
769   --
770   chk_batch_elctbl_id
771   (p_batch_elctbl_id       => p_rec.batch_elctbl_id,
772    p_object_version_number => p_rec.object_version_number);
773   --
774   chk_person_id
775   (p_batch_elctbl_id       => p_rec.batch_elctbl_id,
776    p_person_id             => p_rec.person_id,
777    p_effective_date        => p_effective_date,
778    p_object_version_number => p_rec.object_version_number);
779   --
780   chk_oipl_id
781   (p_batch_elctbl_id       => p_rec.batch_elctbl_id,
782    p_oipl_id               => p_rec.oipl_id,
783    p_effective_date        => p_effective_date,
784    p_object_version_number => p_rec.object_version_number);
785   --
786   chk_pl_id
787   (p_batch_elctbl_id       => p_rec.batch_elctbl_id,
788    p_pl_id                 => p_rec.pl_id,
789    p_effective_date        => p_effective_date,
790    p_object_version_number => p_rec.object_version_number);
791   --
792   chk_pgm_id
793   (p_batch_elctbl_id       => p_rec.batch_elctbl_id,
794    p_pgm_id                => p_rec.pgm_id,
795    p_effective_date        => p_effective_date,
796    p_object_version_number => p_rec.object_version_number);
797   --
798   chk_benefit_action_id
799   (p_batch_elctbl_id       => p_rec.batch_elctbl_id,
800    p_benefit_action_id     => p_rec.benefit_action_id,
801    p_object_version_number => p_rec.object_version_number);
802   --
803   chk_dflt_flag
804   (p_batch_elctbl_id       => p_rec.batch_elctbl_id,
805    p_dflt_flag             => p_rec.dflt_flag,
806    p_effective_date        => p_effective_date,
807    p_object_version_number => p_rec.object_version_number);
808   --
809   chk_mndtry_flag
810   (p_batch_elctbl_id       => p_rec.batch_elctbl_id,
811    p_mndtry_flag           => p_rec.mndtry_flag,
812    p_effective_date        => p_effective_date,
813    p_object_version_number => p_rec.object_version_number);
814   --
815   chk_comp_lvl_cd
816   (p_batch_elctbl_id       => p_rec.batch_elctbl_id,
817    p_comp_lvl_cd           => p_rec.comp_lvl_cd,
818    p_effective_date        => p_effective_date,
819    p_object_version_number => p_rec.object_version_number);
820   --
821   chk_enrt_typ_cycl_cd
822   (p_batch_elctbl_id       => p_rec.batch_elctbl_id,
823    p_enrt_typ_cycl_cd      => p_rec.enrt_typ_cycl_cd,
824    p_effective_date        => p_effective_date,
825    p_object_version_number => p_rec.object_version_number);
826   --
827   hr_utility.set_location(' Leaving:'||l_proc, 10);
828 End insert_validate;
829 --
830 -- ----------------------------------------------------------------------------
831 -- |---------------------------< update_validate >----------------------------|
832 -- ----------------------------------------------------------------------------
833 Procedure update_validate(p_rec in ben_bec_shd.g_rec_type
834                          ,p_effective_date in date) is
835 --
836   l_proc  varchar2(72) := g_package||'update_validate';
837 --
838 Begin
839   hr_utility.set_location('Entering:'||l_proc, 5);
840   --
841   -- Call all supporting business operations
842   --
843   --
844   hr_api.validate_bus_grp_id(p_rec.business_group_id);  -- Validate Bus Grp
845   --
846   chk_batch_elctbl_id
847   (p_batch_elctbl_id       => p_rec.batch_elctbl_id,
848    p_object_version_number => p_rec.object_version_number);
849   --
850   chk_person_id
851   (p_batch_elctbl_id       => p_rec.batch_elctbl_id,
852    p_person_id             => p_rec.person_id,
853    p_effective_date        => p_effective_date,
854    p_object_version_number => p_rec.object_version_number);
855   --
856   chk_oipl_id
857   (p_batch_elctbl_id       => p_rec.batch_elctbl_id,
858    p_oipl_id               => p_rec.oipl_id,
859    p_effective_date        => p_effective_date,
860    p_object_version_number => p_rec.object_version_number);
861   --
862   chk_pl_id
863   (p_batch_elctbl_id       => p_rec.batch_elctbl_id,
864    p_pl_id                 => p_rec.pl_id,
865    p_effective_date        => p_effective_date,
866    p_object_version_number => p_rec.object_version_number);
867   --
868   chk_pgm_id
869   (p_batch_elctbl_id       => p_rec.batch_elctbl_id,
870    p_pgm_id                => p_rec.pgm_id,
871    p_effective_date        => p_effective_date,
872    p_object_version_number => p_rec.object_version_number);
873   --
874   chk_benefit_action_id
875   (p_batch_elctbl_id       => p_rec.batch_elctbl_id,
876    p_benefit_action_id     => p_rec.benefit_action_id,
877    p_object_version_number => p_rec.object_version_number);
878   --
879   chk_dflt_flag
880   (p_batch_elctbl_id       => p_rec.batch_elctbl_id,
881    p_dflt_flag             => p_rec.dflt_flag,
882    p_effective_date        => p_effective_date,
883    p_object_version_number => p_rec.object_version_number);
884   --
885   chk_mndtry_flag
886   (p_batch_elctbl_id       => p_rec.batch_elctbl_id,
887    p_mndtry_flag           => p_rec.mndtry_flag,
888    p_effective_date        => p_effective_date,
889    p_object_version_number => p_rec.object_version_number);
890   --
891   chk_comp_lvl_cd
892   (p_batch_elctbl_id       => p_rec.batch_elctbl_id,
893    p_comp_lvl_cd           => p_rec.comp_lvl_cd,
894    p_effective_date        => p_effective_date,
895    p_object_version_number => p_rec.object_version_number);
896   --
897   chk_enrt_typ_cycl_cd
898   (p_batch_elctbl_id       => p_rec.batch_elctbl_id,
899    p_enrt_typ_cycl_cd      => p_rec.enrt_typ_cycl_cd,
900    p_effective_date        => p_effective_date,
901    p_object_version_number => p_rec.object_version_number);
902   --
903   hr_utility.set_location(' Leaving:'||l_proc, 10);
904 End update_validate;
905 --
906 -- ----------------------------------------------------------------------------
907 -- |---------------------------< delete_validate >----------------------------|
908 -- ----------------------------------------------------------------------------
909 Procedure delete_validate(p_rec in ben_bec_shd.g_rec_type
910                          ,p_effective_date in date) is
911 --
912   l_proc  varchar2(72) := g_package||'delete_validate';
913 --
914 Begin
915   hr_utility.set_location('Entering:'||l_proc, 5);
916   --
917   -- Call all supporting business operations
918   --
919   hr_utility.set_location(' Leaving:'||l_proc, 10);
920 End delete_validate;
921 --
922 --
923 --  ---------------------------------------------------------------------------
924 --  |---------------------< return_legislation_code >-------------------------|
925 --  ---------------------------------------------------------------------------
926 --
927 function return_legislation_code
928   (p_batch_elctbl_id in number) return varchar2 is
929   --
930   -- Declare cursor
931   --
932   cursor csr_leg_code is
933     select a.legislation_code
934     from   per_business_groups a,
935            ben_batch_elctbl_chc_info b
936     where b.batch_elctbl_id      = p_batch_elctbl_id
937     and   a.business_group_id = b.business_group_id;
938   --
939   -- Declare local variables
940   --
941   l_legislation_code  varchar2(150);
942   l_proc              varchar2(72)  :=  g_package||'return_legislation_code';
943   --
944 begin
945   --
946   hr_utility.set_location('Entering:'|| l_proc, 10);
947   --
948   -- Ensure that all the mandatory parameter are not null
949   --
950   hr_api.mandatory_arg_error(p_api_name       => l_proc,
951                              p_argument       => 'batch_elctbl_id',
952                              p_argument_value => p_batch_elctbl_id);
953   --
954   open csr_leg_code;
955     --
956     fetch csr_leg_code into l_legislation_code;
957     --
958     if csr_leg_code%notfound then
959       --
960       close csr_leg_code;
961       --
962       -- The primary key is invalid therefore we must error
963       --
964       hr_utility.set_message(801,'HR_7220_INVALID_PRIMARY_KEY');
965       hr_utility.raise_error;
966       --
967     end if;
968     --
969   close csr_leg_code;
970   --
971   hr_utility.set_location(' Leaving:'|| l_proc, 20);
972   --
973   return l_legislation_code;
974   --
975 end return_legislation_code;
976 --
977 end ben_bec_bus;