DBA Data[Home] [Help]

PACKAGE BODY: APPS.BEN_BFT_BUS

Source


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