DBA Data[Home] [Help]

PACKAGE BODY: APPS.BEN_EGD_BUS

Source


1 Package Body ben_egd_bus as
2 /* $Header: beegdrhi.pkb 120.0.12010000.2 2008/08/05 14:24:02 ubhat ship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33)	:= '  ben_egd_bus.';  -- Global package name
9 --
10 -- ----------------------------------------------------------------------------
11 -- |------< chk_elig_dpnt_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_dpnt_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_elig_dpnt_id(p_elig_dpnt_id                in number,
37                            p_object_version_number       in number) is
38   --
39   l_proc         varchar2(72) := g_package||'chk_elig_dpnt_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_egd_shd.api_updating
47     (p_elig_dpnt_id                => p_elig_dpnt_id,
48      p_object_version_number       => p_object_version_number);
49   --
50   if (l_api_updating
51      and nvl(p_elig_dpnt_id,hr_api.g_number)
52      <>  ben_egd_shd.g_old_rec.elig_dpnt_id) then
53     --
54     -- raise error as PK has changed
55     --
56     ben_egd_shd.constraint_error('BEN_ELIG_DPNT_PK');
57     --
58   elsif not l_api_updating then
59     --
60     -- check if PK is null
61     --
62     if p_elig_dpnt_id is not null then
63       --
64       -- raise error as PK is not null
65       --
66       ben_egd_shd.constraint_error('BEN_ELIG_DPNT_PK');
67       --
68     end if;
69     --
70   end if;
71   --
72   hr_utility.set_location('Leaving:'||l_proc, 10);
73   --
74 End chk_elig_dpnt_id;
75 --
76 -- ----------------------------------------------------------------------------
77 -- |------< chk_elig_per_opt_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_elig_dpnt_id PK
89 --   p_elig_per_opt_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_elig_per_opt_id (p_elig_dpnt_id          in number,
103                             p_elig_per_opt_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_elig_per_opt_id';
108   l_api_updating boolean;
109   l_dummy        varchar2(1);
110   --
111   cursor c1 is
112     select null
113     from   ben_elig_per_opt_f a
114     where  a.elig_per_opt_id = p_elig_per_opt_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_egd_shd.api_updating
124      (p_elig_dpnt_id            => p_elig_dpnt_id,
125       p_object_version_number   => p_object_version_number);
126   --
127   if (l_api_updating
128      and nvl(p_elig_per_opt_id,hr_api.g_number)
129      <> nvl(ben_egd_shd.g_old_rec.elig_per_opt_id,hr_api.g_number)
130      or not l_api_updating)
131      and p_elig_per_opt_id is not null then
132     --
133     -- check if elig_per_opt_id value exists in ben_elig_per_opt_f table
134     --
135     open c1;
136       --
137       fetch c1 into l_dummy;
138       if c1%notfound then
139         --
140         close c1;
141         --
142         -- raise error as FK does not relate to PK in ben_elig_per_opt_f
143         -- table.
144         --
145         ben_egd_shd.constraint_error('BEN_ELIG_DPNT_DT1');
146         --
147       end if;
148       --
149     close c1;
150     --
151   end if;
152   --
153   hr_utility.set_location('Leaving:'||l_proc,10);
154   --
155 End chk_elig_per_opt_id;
156 --
157 -- ----------------------------------------------------------------------------
158 -- |------< chk_elig_per_id >------|
159 -- ----------------------------------------------------------------------------
160 --
161 -- Description
162 --   This procedure checks that a referenced foreign key actually exists
163 --   in the referenced table.
164 --
165 -- Pre-Conditions
166 --   None.
167 --
168 -- In Parameters
169 --   p_elig_dpnt_id PK
170 --   p_elig_per_id ID of FK column
171 --   p_effective_date Session Date of record
172 --   p_object_version_number object version number
173 --
174 -- Post Success
175 --   Processing continues
176 --
177 -- Post Failure
178 --   Error raised.
179 --
180 -- Access Status
181 --   Internal table handler use only.
182 --
183 Procedure chk_elig_per_id (p_elig_dpnt_id          in number,
184                             p_elig_per_id          in number,
185                             p_effective_date        in date,
186                             p_object_version_number in number) is
187   --
188   l_proc         varchar2(72) := g_package||'chk_elig_per_id';
189   l_api_updating boolean;
190   l_dummy        varchar2(1);
191   --
192   cursor c1 is
193     select null
194     from   ben_elig_per_f a
195     where  a.elig_per_id = p_elig_per_id
196     and    p_effective_date
197            between a.effective_start_date
198            and     a.effective_end_date;
199   --
200 Begin
201   --
202   hr_utility.set_location('Entering:'||l_proc,5);
203   --
204   l_api_updating := ben_egd_shd.api_updating
205      (p_elig_dpnt_id            => p_elig_dpnt_id,
206       p_object_version_number   => p_object_version_number);
207   --
208   if (l_api_updating
209      and nvl(p_elig_per_id,hr_api.g_number)
210      <> nvl(ben_egd_shd.g_old_rec.elig_per_id,hr_api.g_number)
211      or not l_api_updating)
212      and p_elig_per_id is not null then
213     --
214     -- check if elig_per_id value exists in ben_elig_per_f table
215     --
216     open c1;
217       --
218       fetch c1 into l_dummy;
219       if c1%notfound then
220         --
221         close c1;
222         --
223         -- raise error as FK does not relate to PK in ben_elig_per_f
224         -- table.
225         --
226         ben_egd_shd.constraint_error('BEN_ELIG_DPNT_DT2');
227         --
228       end if;
229       --
230     close c1;
231     --
232   end if;
233   --
234   hr_utility.set_location('Leaving:'||l_proc,10);
235   --
236 End chk_elig_per_id;
237 --
238 -- ----------------------------------------------------------------------------
239 -- |------< chk_person_id >------|
240 -- ----------------------------------------------------------------------------
241 --
242 -- Description
243 --   This procedure checks that a referenced foreign key actually exists
244 --   in the referenced table.
245 --
246 -- Pre-Conditions
247 --   None.
248 --
249 -- In Parameters
250 --   p_elig_dpnt_id PK
251 --   p_person_id ID of FK column
252 --   p_effective_date Session Date of record
253 --   p_object_version_number object version number
254 --
255 -- Post Success
256 --   Processing continues
257 --
258 -- Post Failure
259 --   Error raised.
260 --
261 -- Access Status
262 --   Internal table handler use only.
263 --
264 Procedure chk_person_id (p_elig_dpnt_id          in number,
265                             p_dpnt_person_id          in number,
266                             p_effective_date        in date,
267                             p_object_version_number in number) is
268   --
269   l_proc         varchar2(72) := g_package||'chk_person_id';
270   l_api_updating boolean;
271   l_dummy        varchar2(1);
272   --
273   cursor c1 is
274     select null
275     from   per_all_people_f a
276     where  a.person_id = p_dpnt_person_id
277     and    p_effective_date
278            between a.effective_start_date
279            and     a.effective_end_date;
280   --
281 Begin
282   --
283   hr_utility.set_location('Entering:'||l_proc,5);
284   --
285   l_api_updating := ben_egd_shd.api_updating
286      (p_elig_dpnt_id            => p_elig_dpnt_id,
287       p_object_version_number   => p_object_version_number);
288   --
289   if (l_api_updating
290      and nvl(p_dpnt_person_id,hr_api.g_number)
291      <> nvl(ben_egd_shd.g_old_rec.dpnt_person_id,hr_api.g_number)
292      or not l_api_updating) then
293     --
294     -- check if person_id value exists in per_all_people_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 per_all_people_f
304         -- table.
305         --
306         ben_egd_shd.constraint_error('BEN_ELIG_DPNT_DT4');
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_person_id;
317 --
318 -- ----------------------------------------------------------------------------
319 -- |------< chk_per_in_ler_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_elig_dpnt_id PK
331 --   p_per_in_ler_id ID of FK column
332 --   p_object_version_number object version number
333 --
334 -- Post Success
335 --   Processing continues
336 --
337 -- Post Failure
338 --   Error raised.
339 --
340 -- Access Status
341 --   Internal table handler use only.
342 --
343 Procedure chk_per_in_ler_id (p_elig_dpnt_id          in number,
344                             p_per_in_ler_id          in number,
345                             p_object_version_number in number,
346                             p_effective_date        in date ) is
347   --
348   l_proc         varchar2(72) := g_package||'chk_per_in_ler_id';
349   l_api_updating boolean;
350   l_dummy        varchar2(1);
351   --
352   cursor c1 is
353     select null
354     from   ben_per_in_ler a ,
355            ben_ler_f b
356     where  a.per_in_ler_id = p_per_in_ler_id
357       and  a.per_in_ler_stat_cd not in ('VOIDD', 'BCKDT')
358       and  a.ler_id = b.ler_id
359       and  b.typ_cd <> 'COMP'
360       and    p_effective_date
361            between b.effective_start_date
362            and     b.effective_end_date;
363   --
364 Begin
365   --
366   hr_utility.set_location('Entering:'||l_proc,5);
367   --
368   l_api_updating := ben_egd_shd.api_updating
369      (p_elig_dpnt_id            => p_elig_dpnt_id,
370       p_object_version_number   => p_object_version_number);
371   --
372   if (l_api_updating
373      and nvl(p_per_in_ler_id,hr_api.g_number)
374      <> nvl(ben_egd_shd.g_old_rec.per_in_ler_id,hr_api.g_number)
375      or not l_api_updating) and
376      p_per_in_ler_id is not null then
377     --
378     -- check if per_in_ler_id value exists in ben_per_in_ler table
379     --
380     open c1;
381       --
382       fetch c1 into l_dummy;
383       if c1%notfound then
384         --
385         close c1;
386         --
387         -- raise error as FK does not relate to PK in ben_per_in_ler
388         -- table.
389         --
390         ben_egd_shd.constraint_error('BEN_ELIG_DPNT_FK2');
391         --
392       end if;
393       --
394     close c1;
395     --
396   end if;
397   --
398   hr_utility.set_location('Leaving:'||l_proc,10);
399   --
400 End chk_per_in_ler_id;
401 --
402 -- ----------------------------------------------------------------------------
403 -- |------< chk_dpnt_inelig_flag >------|
404 -- ----------------------------------------------------------------------------
405 --
406 -- Description
407 --   This procedure is used to check that the lookup value is valid.
408 --
409 -- Pre Conditions
410 --   None.
411 --
412 -- In Parameters
413 --   elig_dpnt_id PK of record being inserted or updated.
414 --   dpnt_inelig_flag Value of lookup code.
415 --   effective_date effective date
416 --   object_version_number Object version number of record being
417 --                         inserted or updated.
418 --
419 -- Post Success
420 --   Processing continues
421 --
422 -- Post Failure
423 --   Error handled by procedure
424 --
425 -- Access Status
426 --   Internal table handler use only.
427 --
428 Procedure chk_dpnt_inelig_flag(p_elig_dpnt_id                in number,
429                             p_dpnt_inelig_flag               in varchar2,
430                             p_effective_date              in date,
431                             p_object_version_number       in number) is
432   --
433   l_proc         varchar2(72) := g_package||'chk_dpnt_inelig_flag';
434   l_api_updating boolean;
435   --
436 Begin
437   --
438   hr_utility.set_location('Entering:'||l_proc, 5);
439   --
440   l_api_updating := ben_egd_shd.api_updating
441     (p_elig_dpnt_id                => p_elig_dpnt_id,
442      p_object_version_number       => p_object_version_number);
443   --
444   if (l_api_updating
445       and p_dpnt_inelig_flag
446       <> nvl(ben_egd_shd.g_old_rec.dpnt_inelig_flag,hr_api.g_varchar2)
447       or not l_api_updating) then
448     --
449     -- check if value of lookup falls within lookup type.
450     --
451     --
452     if hr_api.not_exists_in_hr_lookups
453           (p_lookup_type    => 'YES_NO',
454            p_lookup_code    => p_dpnt_inelig_flag,
455            p_effective_date => p_effective_date) then
456       --
457       -- raise error as does not exist as lookup
458       --
459       fnd_message.set_name('BEN','BEN_91628_LOOKUP_TYPE_GENERIC');
460       fnd_message.set_token('FIELD', p_dpnt_inelig_flag);
461       fnd_message.set_token('TYPE','YES_NO');
462       fnd_message.raise_error;
463       --
464     end if;
465     --
466   end if;
467   --
468   hr_utility.set_location('Leaving:'||l_proc,10);
469   --
470 end chk_dpnt_inelig_flag;
471 --
472 -- ----------------------------------------------------------------------------
473 -- |------< chk_inelg_rsn_cd >------|
474 -- ----------------------------------------------------------------------------
475 --
476 -- Description
477 --   This procedure is used to check that the lookup value is valid.
478 --
479 -- Pre Conditions
480 --   None.
481 --
482 -- In Parameters
483 --   elig_dpnt_id PK of record being inserted or updated.
484 --   inelg_rsn_cd Value of lookup code.
485 --   effective_date effective date
486 --   object_version_number Object version number of record being
487 --                         inserted or updated.
488 --
489 -- Post Success
490 --   Processing continues
491 --
492 -- Post Failure
493 --   Error handled by procedure
494 --
495 -- Access Status
496 --   Internal table handler use only.
497 --
498 Procedure chk_inelg_rsn_cd(p_elig_dpnt_id                in number,
499                             p_inelg_rsn_cd               in varchar2,
500                             p_effective_date              in date,
501                             p_object_version_number       in number) is
502   --
503   l_proc         varchar2(72) := g_package||'chk_inelg_rsn_cd';
504   l_api_updating boolean;
505   --
506 Begin
507   --
508   hr_utility.set_location('Entering:'||l_proc, 5);
509   --
510   l_api_updating := ben_egd_shd.api_updating
511     (p_elig_dpnt_id                => p_elig_dpnt_id,
512      p_object_version_number       => p_object_version_number);
513   --
514   if (l_api_updating
515       and p_inelg_rsn_cd
516       <> nvl(ben_egd_shd.g_old_rec.inelg_rsn_cd,hr_api.g_varchar2)
517       or not l_api_updating)
518       and p_inelg_rsn_cd is not null then
519     --
520     -- check if value of lookup falls within lookup type.
521     --
522     if hr_api.not_exists_in_hr_lookups
523           (p_lookup_type    => 'BEN_INELG_RSN',
524            p_lookup_code    => p_inelg_rsn_cd,
525            p_effective_date => p_effective_date) then
526       --
527       -- raise error as does not exist as lookup
528       --
529       fnd_message.set_name('BEN','BEN_91628_LOOKUP_TYPE_GENERIC');
530       fnd_message.set_token('FIELD', p_inelg_rsn_cd);
531       fnd_message.set_token('TYPE','BEN_INELG_RSN');
532       fnd_message.raise_error;
533       --
534     end if;
535     --
536   end if;
537   --
538   hr_utility.set_location('Leaving:'||l_proc,10);
539   --
540 end chk_inelg_rsn_cd;
541 --
542 -- ----------------------------------------------------------------------------
543 -- |------< chk_ovrdn_flag >------|
544 -- ----------------------------------------------------------------------------
545 --
546 -- Description
547 --   This procedure is used to check that the lookup value is valid.
548 --
549 -- Pre Conditions
550 --   None.
551 --
552 -- In Parameters
553 --   elig_dpnt_id PK of record being inserted or updated.
554 --   ovrdn_flag Value of lookup code.
555 --   effective_date effective date
556 --   object_version_number Object version number of record being
557 --                         inserted or updated.
558 --
559 -- Post Success
560 --   Processing continues
561 --
562 -- Post Failure
563 --   Error handled by procedure
564 --
565 -- Access Status
566 --   Internal table handler use only.
567 --
568 Procedure chk_ovrdn_flag(p_elig_dpnt_id                in number,
569                             p_ovrdn_flag               in varchar2,
570                             p_effective_date              in date,
571                             p_object_version_number       in number) is
572   --
573   l_proc         varchar2(72) := g_package||'chk_ovrdn_flag';
574   l_api_updating boolean;
575   --
576 Begin
577   --
578   hr_utility.set_location('Entering:'||l_proc, 5);
579   --
580   l_api_updating := ben_egd_shd.api_updating
581     (p_elig_dpnt_id                => p_elig_dpnt_id,
582      p_object_version_number       => p_object_version_number);
583   --
584   if (l_api_updating
585       and p_ovrdn_flag
586       <> nvl(ben_egd_shd.g_old_rec.ovrdn_flag,hr_api.g_varchar2)
587       or not l_api_updating) then
588     --
589     -- check if value of lookup falls within lookup type.
590     --
591     --
592     if hr_api.not_exists_in_hr_lookups
593           (p_lookup_type    => 'YES_NO',
594            p_lookup_code    => p_ovrdn_flag,
595            p_effective_date => p_effective_date) then
596       --
597       -- raise error as does not exist as lookup
598       --
599       fnd_message.set_name('BEN','BEN_91628_LOOKUP_TYPE_GENERIC');
600       fnd_message.set_token('FIELD', p_ovrdn_flag);
601       fnd_message.set_token('TYPE','YES_NO');
602       fnd_message.raise_error;
603       --
604     end if;
605     --
606   end if;
607   --
608   hr_utility.set_location('Leaving:'||l_proc,10);
609   --
610 end chk_ovrdn_flag;
611 --
612 -- ----------------------------------------------------------------------------
613 -- |---------------------------< insert_validate >----------------------------|
614 -- ----------------------------------------------------------------------------
615 Procedure insert_validate(p_rec in ben_egd_shd.g_rec_type
616                          ,p_effective_date in date) is
617 --
618   l_proc  varchar2(72) := g_package||'insert_validate';
619 --
620 Begin
621   hr_utility.set_location('Entering:'||l_proc, 5);
622   --
623   -- Call all supporting business operations
624   --
625   --
626   hr_api.validate_bus_grp_id(p_rec.business_group_id);  -- Validate Bus Grp
627   --
628   chk_elig_dpnt_id
629   (p_elig_dpnt_id          => p_rec.elig_dpnt_id,
630    p_object_version_number => p_rec.object_version_number);
631   --
632   chk_per_in_ler_id
633   (p_elig_dpnt_id          => p_rec.elig_dpnt_id,
634    p_per_in_ler_id          => p_rec.per_in_ler_id,
635    p_object_version_number => p_rec.object_version_number,
636    p_effective_date        => p_effective_date );
637   --
638   chk_elig_per_opt_id
639   (p_elig_dpnt_id          => p_rec.elig_dpnt_id,
640    p_elig_per_opt_id       => p_rec.elig_per_opt_id,
641    p_effective_date        => p_effective_date,
642    p_object_version_number => p_rec.object_version_number);
643   --
644   chk_elig_per_id
645   (p_elig_dpnt_id          => p_rec.elig_dpnt_id,
646    p_elig_per_id           => p_rec.elig_per_id,
647    p_effective_date        => p_effective_date,
648    p_object_version_number => p_rec.object_version_number);
649   --
650   chk_person_id
651   (p_elig_dpnt_id          => p_rec.elig_dpnt_id,
652    p_dpnt_person_id        => p_rec.dpnt_person_id,
653    p_effective_date        => p_effective_date,
654    p_object_version_number => p_rec.object_version_number);
655   --
656   chk_dpnt_inelig_flag
657   (p_elig_dpnt_id          => p_rec.elig_dpnt_id,
658    p_dpnt_inelig_flag      => p_rec.dpnt_inelig_flag,
659    p_effective_date        => p_effective_date,
660    p_object_version_number => p_rec.object_version_number);
661   --
662   chk_inelg_rsn_cd
663   (p_elig_dpnt_id          => p_rec.elig_dpnt_id,
664    p_inelg_rsn_cd         => p_rec.inelg_rsn_cd,
665    p_effective_date        => p_effective_date,
666    p_object_version_number => p_rec.object_version_number);
667   --
668   chk_ovrdn_flag
669   (p_elig_dpnt_id          => p_rec.elig_dpnt_id,
670    p_ovrdn_flag         => p_rec.ovrdn_flag,
671    p_effective_date        => p_effective_date,
672    p_object_version_number => p_rec.object_version_number);
673   --
674   hr_utility.set_location(' Leaving:'||l_proc, 10);
675 End insert_validate;
676 --
677 -- ----------------------------------------------------------------------------
678 -- |---------------------------< update_validate >----------------------------|
679 -- ----------------------------------------------------------------------------
680 Procedure update_validate(p_rec in ben_egd_shd.g_rec_type
681                          ,p_effective_date in date) is
682 --
683   l_proc  varchar2(72) := g_package||'update_validate';
684 --
685 Begin
686   hr_utility.set_location('Entering:'||l_proc, 5);
687   --
688   -- Call all supporting business operations
689   --
690   --
691   hr_api.validate_bus_grp_id(p_rec.business_group_id);  -- Validate Bus Grp
692   --
693   chk_elig_dpnt_id
694   (p_elig_dpnt_id          => p_rec.elig_dpnt_id,
695    p_object_version_number => p_rec.object_version_number);
696   --
697   chk_per_in_ler_id
698   (p_elig_dpnt_id          => p_rec.elig_dpnt_id,
699    p_per_in_ler_id         => p_rec.per_in_ler_id,
700    p_object_version_number => p_rec.object_version_number,
701    p_effective_date        => p_effective_date);
702   --
703   chk_elig_per_opt_id
704   (p_elig_dpnt_id          => p_rec.elig_dpnt_id,
705    p_elig_per_opt_id       => p_rec.elig_per_opt_id,
706    p_effective_date        => p_effective_date,
707    p_object_version_number => p_rec.object_version_number);
708   --
709   chk_elig_per_id
710   (p_elig_dpnt_id          => p_rec.elig_dpnt_id,
711    p_elig_per_id           => p_rec.elig_per_id,
712    p_effective_date        => p_effective_date,
713    p_object_version_number => p_rec.object_version_number);
714   --
715   chk_person_id
716   (p_elig_dpnt_id          => p_rec.elig_dpnt_id,
717    p_dpnt_person_id        => p_rec.dpnt_person_id,
718    p_effective_date        => p_effective_date,
719    p_object_version_number => p_rec.object_version_number);
720   --
721   chk_dpnt_inelig_flag
722   (p_elig_dpnt_id          => p_rec.elig_dpnt_id,
723    p_dpnt_inelig_flag         => p_rec.dpnt_inelig_flag,
724    p_effective_date        => p_effective_date,
725    p_object_version_number => p_rec.object_version_number);
726   --
727   chk_inelg_rsn_cd
728   (p_elig_dpnt_id          => p_rec.elig_dpnt_id,
729    p_inelg_rsn_cd         => p_rec.inelg_rsn_cd,
730    p_effective_date        => p_effective_date,
731    p_object_version_number => p_rec.object_version_number);
732   --
733   chk_ovrdn_flag
734   (p_elig_dpnt_id          => p_rec.elig_dpnt_id,
735    p_ovrdn_flag         => p_rec.ovrdn_flag,
736    p_effective_date        => p_effective_date,
737    p_object_version_number => p_rec.object_version_number);
738   --
739   hr_utility.set_location(' Leaving:'||l_proc, 10);
740 End update_validate;
741 --
742 -- ----------------------------------------------------------------------------
743 -- |---------------------------< delete_validate >----------------------------|
744 -- ----------------------------------------------------------------------------
745 Procedure delete_validate(p_rec in ben_egd_shd.g_rec_type
746                          ,p_effective_date in date) is
747 --
748   l_proc  varchar2(72) := g_package||'delete_validate';
749 --
750 Begin
751   hr_utility.set_location('Entering:'||l_proc, 5);
752   --
753   -- Call all supporting business operations
754   --
755   hr_utility.set_location(' Leaving:'||l_proc, 10);
756 End delete_validate;
757 --
758 --
759 --  ---------------------------------------------------------------------------
760 --  |---------------------< return_legislation_code >-------------------------|
761 --  ---------------------------------------------------------------------------
762 --
763 function return_legislation_code
764   (p_elig_dpnt_id in number) return varchar2 is
765   --
766   -- Declare cursor
767   --
768   cursor csr_leg_code is
769     select a.legislation_code
770     from   per_business_groups a,
771            ben_elig_dpnt b
772     where b.elig_dpnt_id      = p_elig_dpnt_id
773     and   a.business_group_id = b.business_group_id;
774   --
775   -- Declare local variables
776   --
777   l_legislation_code  varchar2(150);
778   l_proc              varchar2(72)  :=  g_package||'return_legislation_code';
779   --
780 begin
781   --
782   hr_utility.set_location('Entering:'|| l_proc, 10);
783   --
784   -- Ensure that all the mandatory parameter are not null
785   --
786   hr_api.mandatory_arg_error(p_api_name       => l_proc,
787                              p_argument       => 'elig_dpnt_id',
788                              p_argument_value => p_elig_dpnt_id);
789   --
790   open csr_leg_code;
791     --
792     fetch csr_leg_code into l_legislation_code;
793     --
794     if csr_leg_code%notfound then
795       --
796       close csr_leg_code;
797       --
798       -- The primary key is invalid therefore we must error
799       --
800       fnd_message.set_name('PAY','HR_7220_INVALID_PRIMARY_KEY');
801       fnd_message.raise_error;
802       --
803     end if;
804     --
805   close csr_leg_code;
806   --
807   hr_utility.set_location(' Leaving:'|| l_proc, 20);
808   --
809   return l_legislation_code;
810   --
811 end return_legislation_code;
812 --
813 end ben_egd_bus;