DBA Data[Home] [Help]

PACKAGE BODY: APPS.BEN_ECR_BUS

Source


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