DBA Data[Home] [Help]

PACKAGE BODY: APPS.BEN_LPR_BUS

Source


4 -- ----------------------------------------------------------------------------
1 Package Body ben_lpr_bus as
2 /* $Header: belprrhi.pkb 115.11 2004/01/18 23:15:35 abparekh ship $ */
3 --
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33)	:= '  ben_lpr_bus.';  -- Global package name
9 --
10 -- ----------------------------------------------------------------------------
11 -- |------< chk_ler_chg_plip_enrt_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 --   ler_chg_plip_enrt_id PK of record being inserted or updated.
24 --   effective_date Effective Date of session
25 --   object_version_number Object version number of record being
26 --                         inserted or updated.
27 --
28 -- Post Success
29 --   Processing continues
30 --
31 -- Post Failure
32 --   Errors handled by the procedure
33 --
34 -- Access Status
35 --   Internal table handler use only.
36 --
37 Procedure chk_ler_chg_plip_enrt_id(p_ler_chg_plip_enrt_id                in number,
38                            p_effective_date              in date,
39                            p_object_version_number       in number) is
40   --
41   l_proc         varchar2(72) := g_package||'chk_ler_chg_plip_enrt_id';
42   l_api_updating boolean;
43   --
44 Begin
45   --
46   hr_utility.set_location('Entering:'||l_proc, 5);
47   --
48   l_api_updating := ben_lpr_shd.api_updating
49     (p_effective_date              => p_effective_date,
50      p_ler_chg_plip_enrt_id                => p_ler_chg_plip_enrt_id,
51      p_object_version_number       => p_object_version_number);
52   --
53   if (l_api_updating
54      and nvl(p_ler_chg_plip_enrt_id,hr_api.g_number)
55      <>  ben_lpr_shd.g_old_rec.ler_chg_plip_enrt_id) then
56     --
57     -- raise error as PK has changed
58     --
59     ben_lpr_shd.constraint_error('BEN_LER_CHG_PLIP_EN_PK');
60     --
61   elsif not l_api_updating then
62     --
63     -- check if PK is null
64     --
65     if p_ler_chg_plip_enrt_id is not null then
66       --
67       -- raise error as PK is not null
68       --
69       ben_lpr_shd.constraint_error('BEN_LER_CHG_PLIP_EN_PK');
70       --
71     end if;
72     --
73   end if;
74   --
75   hr_utility.set_location('Leaving:'||l_proc, 10);
76   --
77 End chk_ler_chg_plip_enrt_id;
78 --
79 -- ----------------------------------------------------------------------------
80 -- |------< chk_ler_id >------|
81 -- ----------------------------------------------------------------------------
82 --
83 -- Description
84 --   This procedure is used to ensure that the value is unique within plip
85 --   and within bus grp. The FK check is done elsewhere in the dt logic.
86 --
87 -- Pre Conditions
88 --   None.
89 --
90 -- In Parameters
91 --   effective_date effective date
92 --   object_version_number Object version number of record being
93 --                         inserted or updated.
94 --
95 -- Post Success
96 --   Processing continues
97 --
98 -- Post Failure
99 --   Error handled by procedure
100 --
101 -- Access Status
102 --   Internal table handler use only.
103 --
104 Procedure chk_ler_id(p_ler_chg_plip_enrt_id    in number,
105                             p_ler_id            in number,
106                             p_plip_id              in number,
107                             p_effective_date              in date,
108 				    p_validation_start_date         in date,
109                             p_validation_end_date           in date,
110                             p_business_group_id           in number,
111                             p_object_version_number       in number) is
112 
113 
114  --
115   l_proc         varchar2(72) := g_package||'chk_ler_id';
116   l_api_updating boolean;
117   l_exists       varchar2(1);
118   --
119   -- unique in bg, plip, and eff dates
120   --
121   cursor chk_unique is
122      select null
123         from ben_ler_chg_plip_enrt_f
124         where ler_id = p_ler_id
128           and p_validation_start_date <= effective_end_date
125           and ler_chg_plip_enrt_id  <> nvl(p_ler_chg_plip_enrt_id, hr_api.g_number)
126           and plip_id = p_plip_id
127           and business_group_id + 0 = p_business_group_id
129           and p_validation_end_date >= effective_start_date;
130   --
131 Begin
132   --
133   hr_utility.set_location('Entering:'||l_proc, 5);
134   --
135   l_api_updating := ben_lpr_shd.api_updating
136     (p_ler_chg_plip_enrt_id   => p_ler_chg_plip_enrt_id  ,
137      p_effective_date              => p_effective_date,
138      p_object_version_number       => p_object_version_number);
139   --
140   if (l_api_updating
141       and p_ler_id
142       <> nvl(ben_lpr_shd.g_old_rec.ler_id,hr_api.g_number)
143       or not l_api_updating) then
144     --
145     -- this value must be unique
146     --
147     open chk_unique;
148     fetch chk_unique into l_exists;
149     if chk_unique%found then
150       close chk_unique;
151       --
152       -- raise error as UK1 is violated
153       --
154       --Bug 2960193 Created message and updated message name in call to set_name
155       fnd_message.set_name('BEN','BEN_93794_FUTURE_LE_PLAN_EXIST');
156       fnd_message.raise_error;
157       --Bug 2960193
158       --
159     end if;
160     --
161     close chk_unique;
162     --
163   end if;
164   --
165   hr_utility.set_location('Leaving:'||l_proc,10);
166   --
167 end chk_ler_id;
168 --
169 
170 -- ----------------------------------------------------------------------------
171 -- |------< chk_enrt_cd >------|
172 -- ----------------------------------------------------------------------------
173 --
174 -- Description
175 --   This procedure is used to check that the lookup value is valid.
176 --
177 -- Pre Conditions
178 --   None.
179 --
180 -- In Parameters
181 --   ler_chg_plip_enrt_id PK of record being inserted or updated.
182 --   enrt_cd Value of lookup code.
183 --   effective_date effective date
184 --   object_version_number Object version number of record being
185 --                         inserted or updated.
186 --
187 -- Post Success
188 --   Processing continues
189 --
190 -- Post Failure
191 --   Error handled by procedure
192 --
193 -- Access Status
194 --   Internal table handler use only.
195 --
196 Procedure chk_enrt_cd(p_ler_chg_plip_enrt_id                in number,
197                             p_enrt_cd               in varchar2,
198                             p_effective_date              in date,
199                             p_object_version_number       in number) is
200   --
201   l_proc         varchar2(72) := g_package||'chk_enrt_cd';
202   l_api_updating boolean;
203   --
204 Begin
205   --
206   hr_utility.set_location('Entering:'||l_proc, 5);
207   --
208   l_api_updating := ben_lpr_shd.api_updating
209     (p_ler_chg_plip_enrt_id                => p_ler_chg_plip_enrt_id,
210      p_effective_date              => p_effective_date,
211      p_object_version_number       => p_object_version_number);
212   --
213   if (l_api_updating
214       and p_enrt_cd
215       <> nvl(ben_lpr_shd.g_old_rec.enrt_cd,hr_api.g_varchar2)
216       or not l_api_updating)
217       and p_enrt_cd is not null then
218     --
219     -- check if value of lookup falls within lookup type.
220     --
221     if hr_api.not_exists_in_hr_lookups
222           (p_lookup_type    => 'BEN_ENRT',
223            p_lookup_code    => p_enrt_cd,
224            p_effective_date => p_effective_date) then
225       --
226       -- raise error as does not exist as lookup
227       --
228       fnd_message.set_name('BEN','BEN_91628_LOOKUP_TYPE_GENERIC');
229       fnd_message.set_token('FIELD', 'p_enrt_cd');
230       fnd_message.set_token('TYPE', 'BEN_ENRT');
231       fnd_message.raise_error;
232       --
233     end if;
234     --
235   end if;
236   --
237   hr_utility.set_location('Leaving:'||l_proc,10);
238   --
239 end chk_enrt_cd;
240 --
241 -- ----------------------------------------------------------------------------
242 -- |------< chk_stl_elig_cant_chg_flag >------|
243 -- ----------------------------------------------------------------------------
244 --
245 -- Description
246 --   This procedure is used to check that the lookup value is valid.
247 --
248 -- Pre Conditions
249 --   None.
250 --
251 -- In Parameters
252 --   ler_chg_plip_enrt_id PK of record being inserted or updated.
253 --   stl_elig_cant_chg_flag Value of lookup code.
254 --   effective_date effective date
255 --   object_version_number Object version number of record being
256 --                         inserted or updated.
257 --
258 -- Post Success
259 --   Processing continues
260 --
261 -- Post Failure
262 --   Error handled by procedure
263 --
264 -- Access Status
265 --   Internal table handler use only.
266 --
267 Procedure chk_stl_elig_cant_chg_flag(p_ler_chg_plip_enrt_id                in number,
268                             p_stl_elig_cant_chg_flag               in varchar2,
269                             p_effective_date              in date,
270                             p_object_version_number       in number) is
271   --
272   l_proc         varchar2(72) := g_package||'chk_stl_elig_cant_chg_flag';
273   l_api_updating boolean;
274   --
275 Begin
276   --
277   hr_utility.set_location('Entering:'||l_proc, 5);
278   --
279   l_api_updating := ben_lpr_shd.api_updating
280     (p_ler_chg_plip_enrt_id        => p_ler_chg_plip_enrt_id,
281      p_effective_date              => p_effective_date,
285       and p_stl_elig_cant_chg_flag
282      p_object_version_number       => p_object_version_number);
283   --
284   if (l_api_updating
286       <> nvl(ben_lpr_shd.g_old_rec.stl_elig_cant_chg_flag,hr_api.g_varchar2)
287       or not l_api_updating)
288       and p_stl_elig_cant_chg_flag is not null then
289     --
290     -- check if value of lookup falls within lookup type.
291     --
292     if hr_api.not_exists_in_hr_lookups
293           (p_lookup_type    => 'YES_NO',
294            p_lookup_code    => p_stl_elig_cant_chg_flag,
295            p_effective_date => p_effective_date) then
296       --
297       -- raise error as does not exist as lookup
298       --
299       fnd_message.set_name('BEN','BEN_91628_LOOKUP_TYPE_GENERIC');
300       fnd_message.set_token('FIELD', 'p_stl_elig_cant_chg_flag');
301       fnd_message.set_token('TYPE', 'YES_NO');
302       fnd_message.raise_error;
303       --
304     end if;
305     --
306   end if;
307   --
308   hr_utility.set_location('Leaving:'||l_proc,10);
309   --
310 end chk_stl_elig_cant_chg_flag;
311 --
312 -- ----------------------------------------------------------------------------
313 -- |------< chk_enrt_mthd_cd >------|
314 -- ----------------------------------------------------------------------------
315 --
316 -- Description
317 --   This procedure is used to check that the lookup value is valid.
318 --
319 -- Pre Conditions
320 --   None.
321 --
322 -- In Parameters
323 --   ler_chg_plip_enrt_id PK of record being inserted or updated.
324 --   enrt_mthd_cd Value of lookup code.
325 --   effective_date effective date
326 --   object_version_number Object version number of record being
327 --                         inserted or updated.
328 --
329 -- Post Success
330 --   Processing continues
331 --
332 -- Post Failure
333 --   Error handled by procedure
334 --
335 -- Access Status
336 --   Internal table handler use only.
337 --
338 Procedure chk_enrt_mthd_cd(p_ler_chg_plip_enrt_id                in number,
339                             p_enrt_mthd_cd               in varchar2,
340                             p_effective_date              in date,
341                             p_object_version_number       in number) is
342   --
343   l_proc         varchar2(72) := g_package||'chk_enrt_mthd_cd';
344   l_api_updating boolean;
345   --
346 Begin
347   --
348   hr_utility.set_location('Entering:'||l_proc, 5);
349   --
350   l_api_updating := ben_lpr_shd.api_updating
351     (p_ler_chg_plip_enrt_id                => p_ler_chg_plip_enrt_id,
352      p_effective_date              => p_effective_date,
353      p_object_version_number       => p_object_version_number);
354   --
355   if (l_api_updating
356       and p_enrt_mthd_cd
357       <> nvl(ben_lpr_shd.g_old_rec.enrt_mthd_cd,hr_api.g_varchar2)
358       or not l_api_updating)
359       and p_enrt_mthd_cd is not null then
360     --
361     -- check if value of lookup falls within lookup type.
362     --
363     if hr_api.not_exists_in_hr_lookups
364           (p_lookup_type    => 'BEN_ENRT_MTHD',
365            p_lookup_code    => p_enrt_mthd_cd,
366            p_effective_date => p_effective_date) then
367       --
368       -- raise error as does not exist as lookup
369       --
370       fnd_message.set_name('BEN','BEN_91628_LOOKUP_TYPE_GENERIC');
371       fnd_message.set_token('FIELD', 'p_enrt_mthd_cd');
372       fnd_message.set_token('TYPE', 'BEN_ENRT_MTHD');
373       fnd_message.raise_error;
374       --
375     end if;
376     --
377   end if;
378   --
379   hr_utility.set_location('Leaving:'||l_proc,10);
380   --
381 end chk_enrt_mthd_cd;
382 --
383 -- ----------------------------------------------------------------------------
384 -- |------< chk_dflt_enrt_cd >------|
385 -- ----------------------------------------------------------------------------
386 --
387 -- Description
388 --   This procedure is used to check that the lookup value is valid.
389 --
390 -- Pre Conditions
391 --   None.
392 --
393 -- In Parameters
394 --   ler_chg_plip_enrt_id PK of record being inserted or updated.
395 --   dflt_enrt_cd Value of lookup code.
396 --   effective_date effective date
397 --   object_version_number Object version number of record being
398 --                         inserted or updated.
399 --
400 -- Post Success
401 --   Processing continues
402 --
403 -- Post Failure
404 --   Error handled by procedure
405 --
406 -- Access Status
407 --   Internal table handler use only.
408 --
409 Procedure chk_dflt_enrt_cd(p_ler_chg_plip_enrt_id                in number,
410                             p_dflt_enrt_cd               in varchar2,
411                             p_effective_date              in date,
412                             p_object_version_number       in number) is
413   --
414   l_proc         varchar2(72) := g_package||'chk_dflt_enrt_cd';
415   l_api_updating boolean;
416   --
417 Begin
418   --
419   hr_utility.set_location('Entering:'||l_proc, 5);
420   --
421   l_api_updating := ben_lpr_shd.api_updating
422     (p_ler_chg_plip_enrt_id                => p_ler_chg_plip_enrt_id,
423      p_effective_date              => p_effective_date,
424      p_object_version_number       => p_object_version_number);
425   --
426   if (l_api_updating
427       and p_dflt_enrt_cd
428       <> nvl(ben_lpr_shd.g_old_rec.dflt_enrt_cd,hr_api.g_varchar2)
429       or not l_api_updating)
430       and p_dflt_enrt_cd is not null then
431     --
432     -- check if value of lookup falls within lookup type.
433     --
437            p_effective_date => p_effective_date) then
434     if hr_api.not_exists_in_hr_lookups
435           (p_lookup_type    => 'BEN_DFLT_ENRT',
436            p_lookup_code    => p_dflt_enrt_cd,
438       --
439       -- raise error as does not exist as lookup
440       --
441       fnd_message.set_name('BEN','BEN_91628_LOOKUP_TYPE_GENERIC');
442       fnd_message.set_token('FIELD', 'p_dflt_enrt_cd');
443       fnd_message.set_token('TYPE', 'BEN_DFLT_ENRT');
444       fnd_message.raise_error;
445       --
446     end if;
447     --
448   end if;
449   --
450   hr_utility.set_location('Leaving:'||l_proc,10);
451   --
452 end chk_dflt_enrt_cd;
453 --
454 -- ----------------------------------------------------------------------------
455 -- |------< chk_enrt_rl >------|
456 -- ----------------------------------------------------------------------------
457 --
458 -- Description
459 --   This procedure is used to check that the lookup value is valid.
460 --
461 -- Pre Conditions
462 --   None.
463 --
464 -- In Parameters
465 --   ler_chg_plip_enrt_id PK of record being inserted or updated.
466 --   use_schedd_enrt_dfns_flag Value of lookup code.
467 --   effective_date effective date
468 --   object_version_number Object version number of record being
469 --                         inserted or updated.
470 --
471 -- Post Success
472 --   Processing continues
473 --
474 -- Post Failure
475 --   Error handled by procedure
476 --
477 -- Access Status
478 --   Internal table handler use only.
479 --
480 Procedure chk_enrt_rl(p_ler_chg_plip_enrt_id              in number,
481                             p_enrt_rl                     in number,
482                             p_effective_date              in date,
483                             p_business_group_id           in number,
484                             p_object_version_number       in number) is
485   --
486   l_proc         varchar2(72) := g_package||'chk_enrt_rl';
487   l_api_updating boolean;
488   l_dummy varchar2(30);
489   --
490   cursor c1 is
491     select null
492     from   ff_formulas_f ff,
493            per_business_groups pbg
494     where  ff.formula_id = p_enrt_rl
495     and    ff.formula_type_id = - 393
496     and    pbg.business_group_id = p_business_group_id
497     and    nvl(ff.business_group_id, p_business_group_id) =
498            p_business_group_id
499     and    nvl(ff.legislation_code, pbg.legislation_code) =
500            pbg.legislation_code
501     and    p_effective_date
502            between ff.effective_start_date
503            and     ff.effective_end_date;
504   --
505 Begin
506   --
507   hr_utility.set_location('Entering:'||l_proc, 5);
508   --
509   l_api_updating := ben_lpr_shd.api_updating
510     (p_ler_chg_plip_enrt_id        => p_ler_chg_plip_enrt_id,
511      p_effective_date              => p_effective_date,
512      p_object_version_number       => p_object_version_number);
513   --
514   if (l_api_updating
515       and p_enrt_rl
516       <> nvl(ben_lpr_shd.g_old_rec.enrt_rl,hr_api.g_number)
517       or not l_api_updating)
518       and p_enrt_rl is not null then
519     --
520     -- check if value of formula rule is valid.
521     --
522     open c1;
523       --
524       -- fetch value from cursor if it returns a record then the
525       -- formula is valid otherwise its invalid
526       --
527       fetch c1 into l_dummy;
528       if c1%notfound then
529         --
530         close c1;
531         --
532         -- raise error
533         --
534       fnd_message.set_name('BEN','BEN_91471_FORMULA_NOT_FOUND');
535       fnd_message.set_token('ID',p_enrt_rl);
536       fnd_message.set_token('TYPE_ID',-393);
537       fnd_message.raise_error;
538         --
539       end if;
540       --
541     close c1;
542     --
543   end if;
544   --
545   hr_utility.set_location('Leaving:'||l_proc,10);
546   --
547 end chk_enrt_rl;
548 --
549 -- ----------------------------------------------------------------------------
550 -- |------< chk_dflt_enrt_rl >------|
551 -- ----------------------------------------------------------------------------
552 --
553 -- Description
554 --   This procedure is used to check that the lookup value is valid.
555 --
556 -- Pre Conditions
557 --   None.
558 --
559 -- In Parameters
560 --   ler_chg_plip_enrt_id PK of record being inserted or updated.
561 --   use_schedd_enrt_dflts_flag Value of lookup code.
562 --   effective_date effective date
563 --   object_version_number Object version number of record being
564 --                         inserted or updated.
565 --
566 -- Post Success
567 --   Processing continues
568 --
569 -- Post Failure
570 --   Error handled by procedure
571 --
572 -- Access Status
573 --   Internal table handler use only.
574 --
575 Procedure chk_dflt_enrt_rl(p_ler_chg_plip_enrt_id         in number,
576                             p_dflt_enrt_rl                in number,
577                             p_effective_date              in date,
578                             p_business_group_id           in number,
579                             p_object_version_number       in number) is
580   --
581   l_proc         varchar2(72) := g_package||'chk_dflt_enrt_rl';
582   l_api_updating boolean;
583   l_dummy varchar2(30);
584   --
585   cursor c1 is
586     select null
587     from   ff_formulas_f ff,
588            per_business_groups pbg
592     and    nvl(ff.business_group_id, p_business_group_id) =
589     where  ff.formula_id = p_dflt_enrt_rl
590     and    ff.formula_type_id = - 32
591     and    pbg.business_group_id = p_business_group_id
593            p_business_group_id
594     and    nvl(ff.legislation_code, pbg.legislation_code) =
595            pbg.legislation_code
596     and    p_effective_date
597            between ff.effective_start_date
598            and     ff.effective_end_date;
599   --
600 Begin
601   --
602   hr_utility.set_location('Entering:'||l_proc, 5);
603   --
604   l_api_updating := ben_lpr_shd.api_updating
605     (p_ler_chg_plip_enrt_id        => p_ler_chg_plip_enrt_id,
606      p_effective_date              => p_effective_date,
607      p_object_version_number       => p_object_version_number);
608   --
609   if (l_api_updating
610       and p_dflt_enrt_rl
611       <> nvl(ben_lpr_shd.g_old_rec.dflt_enrt_rl,hr_api.g_number)
612       or not l_api_updating)
613       and p_dflt_enrt_rl is not null then
614     --
615     -- check if value of formula rule is valid.
616     --
617     open c1;
618       --
619       -- fetch value from cursor if it returns a record then the
620       -- formula is valid otherwise its invalid
621       --
622       fetch c1 into l_dummy;
623       if c1%notfound then
624         --
625         close c1;
626         --
627         -- raise error
628         --
629         fnd_message.set_name('BEN','BEN_91471_FORMULA_NOT_FOUND');
630         fnd_message.set_token('ID',p_dflt_enrt_rl);
631         fnd_message.set_token('TYPE_ID',-32);
632         fnd_message.raise_error;
633         --
634       end if;
635       --
636     close c1;
637     --
638     --
639   end if;
640   --
641   hr_utility.set_location('Leaving:'||l_proc,10);
642   --
643 end chk_dflt_enrt_rl;
644 --
645 -- ----------------------------------------------------------------------------
646 -- |------< chk_dflt_flag >------|
647 -- ----------------------------------------------------------------------------
648 --
649 -- Description
650 --   This procedure is used to check that the lookup value is valid and only
651 --   one record can have a 'Y' value.
652 --
653 -- Pre Conditions
654 --   None.
655 --
656 -- In Parameters
657 --   ler_chg_plip_enrt_id PK of record being inserted or updated.
658 --   dflt_flag Value of lookup code.
659 --   effective_date effective date
660 --   object_version_number Object version number of record being
661 --                         inserted or updated.
662 --
663 -- Post Success
664 --   Processing continues
665 --
666 -- Post Failure
667 --   Error handled by procedure
668 --
669 -- Access Status
670 --   Internal table handler use only.
671 --
672 Procedure chk_dflt_flag(p_ler_chg_plip_enrt_id                in number,
673                             p_dflt_flag               in varchar2,
674                             p_effective_date              in date,
675                             p_plip_id               in number,
676 				    p_validation_start_date         in date,
677                             p_validation_end_date           in date,
678                             p_business_group_id           in number,
679                             p_object_version_number       in number) is
680   --
681   l_proc         varchar2(72) := g_package||'chk_dflt_flag';
682   l_api_updating boolean;
683   l_exists       varchar2(1);
684   --
685   -- only one 'YES' value is allowed within parent, bg, and eff dates
686   --
687   cursor chk_unique is
688      select null
689         from ben_ler_chg_plip_enrt_f
690         where dflt_flag = p_dflt_flag
691           and dflt_flag = 'Y'
692           and ler_chg_plip_enrt_id  <> nvl(p_ler_chg_plip_enrt_id, hr_api.g_number)
693           and plip_id = p_plip_id
694           and business_group_id + 0 = p_business_group_id
695           and p_validation_start_date <= effective_end_date
696           and p_validation_end_date >= effective_start_date;
697   --
698 Begin
699   --
700   hr_utility.set_location('Entering:'||l_proc, 5);
701   --
702   l_api_updating := ben_lpr_shd.api_updating
703     (p_ler_chg_plip_enrt_id        => p_ler_chg_plip_enrt_id,
704      p_effective_date              => p_effective_date,
705      p_object_version_number       => p_object_version_number);
706   --
707   if (l_api_updating
708       and p_dflt_flag
709       <> nvl(ben_lpr_shd.g_old_rec.dflt_flag,hr_api.g_varchar2)
710       or not l_api_updating)
711       and p_dflt_flag is not null then
712     --
713     -- check if value of lookup falls within lookup type.
714     --
715     if hr_api.not_exists_in_hr_lookups
716           (p_lookup_type    => 'YES_NO',
717            p_lookup_code    => p_dflt_flag,
718            p_effective_date => p_effective_date) then
719       --
720       -- raise error as does not exist as lookup
721       --
722       fnd_message.set_name('BEN','BEN_91628_LOOKUP_TYPE_GENERIC');
723       fnd_message.set_token('FIELD', 'p_dflt_flag');
724       fnd_message.set_token('TYPE', 'YES_NO');
725       fnd_message.raise_error;
726       --
727     end if;
728     --
729 -- COMMENTING OUT PER BUG# 849
730 --  -- Only one 'Y' value is allowed within parent
731 --  --
732 --  open chk_unique;
733 --  fetch chk_unique into l_exists;
734 --  if chk_unique%found then
735 --    close chk_unique;
736 --    --
737 --    -- raise error as UK1 is violated
738 --    --
742 --  end if;
739 --    fnd_message.set_name('PAY','ONLY_ONE_DEFAULT');
740 --    fnd_message.raise_error;
741 --    --
743 --  --
744 --  close chk_unique;
745 ----
746 
747   end if;
748   --
749   hr_utility.set_location('Leaving:'||l_proc,10);
750   --
751 end chk_dflt_flag;
752 --
753 -- ----------------------------------------------------------------------------
754 -- |------< chk_crnt_enrt_prclds_chg_flag >------|
755 -- ----------------------------------------------------------------------------
756 --
757 -- Description
758 --   This procedure is used to check that the lookup value is valid.
759 --
760 -- Pre Conditions
761 --   None.
762 --
763 -- In Parameters
764 --   ler_chg_plip_enrt_id PK of record being inserted or updated.
765 --   crnt_enrt_prclds_chg_flag Value of lookup code.
766 --   effective_date effective date
767 --   object_version_number Object version number of record being
768 --                         inserted or updated.
769 --
770 -- Post Success
771 --   Processing continues
772 --
773 -- Post Failure
774 --   Error handled by procedure
775 --
776 -- Access Status
777 --   Internal table handler use only.
778 --
779 Procedure chk_crnt_enrt_prclds_chg_flag(p_ler_chg_plip_enrt_id                in number,
780                             p_crnt_enrt_prclds_chg_flag               in varchar2,
781                             p_effective_date              in date,
782                             p_object_version_number       in number) is
783   --
784   l_proc         varchar2(72) := g_package||'chk_crnt_enrt_prclds_chg_flag';
785   l_api_updating boolean;
786   --
787 Begin
788   --
789   hr_utility.set_location('Entering:'||l_proc, 5);
790   --
791   l_api_updating := ben_lpr_shd.api_updating
792     (p_ler_chg_plip_enrt_id        => p_ler_chg_plip_enrt_id,
793      p_effective_date              => p_effective_date,
794      p_object_version_number       => p_object_version_number);
795   --
796   if (l_api_updating
797       and p_crnt_enrt_prclds_chg_flag
798       <> nvl(ben_lpr_shd.g_old_rec.crnt_enrt_prclds_chg_flag,hr_api.g_varchar2)
799       or not l_api_updating)
800       and p_crnt_enrt_prclds_chg_flag is not null then
801     --
802     -- check if value of lookup falls within lookup type.
803     --
804     if hr_api.not_exists_in_hr_lookups
805           (p_lookup_type    => 'YES_NO',
806            p_lookup_code    => p_crnt_enrt_prclds_chg_flag,
807            p_effective_date => p_effective_date) then
808       --
809       -- raise error as does not exist as lookup
810       --
811       fnd_message.set_name('BEN','BEN_91628_LOOKUP_TYPE_GENERIC');
812       fnd_message.set_token('FIELD', 'p_crnt_enrt_prclds_chg_flag');
813       fnd_message.set_token('TYPE', 'YES_NO');
814       fnd_message.raise_error;
815       --
816     end if;
817     --
818   end if;
819   --
820   hr_utility.set_location('Leaving:'||l_proc,10);
821   --
822 end chk_crnt_enrt_prclds_chg_flag;
823 --
824 -- ----------------------------------------------------------------------------
825 -- |------< chk_tco_chg_enrt_cd >------|
826 -- ----------------------------------------------------------------------------
827 --
828 -- Description
829 --   This procedure is used to check that the lookup value is valid.
830 --
831 -- Pre Conditions
832 --   None.
833 --
834 -- In Parameters
835 --   ler_chg_plip_enrt_id PK of record being inserted or updated.
836 --   tco_chg_enrt_cd Value of lookup code.
837 --   effective_date effective date
838 --   object_version_number Object version number of record being
839 --                         inserted or updated.
840 --
841 -- Post Success
842 --   Processing continues
843 --
844 -- Post Failure
845 --   Error handled by procedure
846 --
847 -- Access Status
848 --   Internal table handler use only.
849 --
850 Procedure chk_tco_chg_enrt_cd(p_ler_chg_plip_enrt_id                in number,
851                             p_tco_chg_enrt_cd               in varchar2,
852                             p_effective_date              in date,
853                             p_object_version_number       in number) is
854   --
855   l_proc         varchar2(72) := g_package||'chk_tco_chg_enrt_cd';
856   l_api_updating boolean;
857   --
858 Begin
859   --
860   hr_utility.set_location('Entering:'||l_proc, 5);
861   --
862   l_api_updating := ben_lpr_shd.api_updating
863     (p_ler_chg_plip_enrt_id        => p_ler_chg_plip_enrt_id,
864      p_effective_date              => p_effective_date,
865      p_object_version_number       => p_object_version_number);
866   --
867   if (l_api_updating
868       and p_tco_chg_enrt_cd
869       <> nvl(ben_lpr_shd.g_old_rec.tco_chg_enrt_cd,hr_api.g_varchar2)
870       or not l_api_updating)
871       and p_tco_chg_enrt_cd is not null then
872     --
873     -- check if value of lookup falls within lookup type.
874     --
875     --
876     if hr_api.not_exists_in_hr_lookups
877           (p_lookup_type    => 'BEN_TCO_CHG_ENRT',
878            p_lookup_code    => p_tco_chg_enrt_cd,
879            p_effective_date => p_effective_date) then
880       --
881       -- raise error as does not exist as lookup
882       --
883       fnd_message.set_name('BEN','BEN_91628_LOOKUP_TYPE_GENERIC');
884       fnd_message.set_token('FIELD', 'p_tco_chg_enrt_cd');
885       fnd_message.set_token('TYPE', 'BEN_TCO_CHG_ENRT');
889     --
886       fnd_message.raise_error;
887       --
888     end if;
890   end if;
891   --
892   hr_utility.set_location('Leaving:'||l_proc,10);
893   --
894 end chk_tco_chg_enrt_cd;
895 --
896 -- ----------------------------------------------------------------------------
897 -- |------< chk_auto_enrt_mthd_rl >------|
898 -- ----------------------------------------------------------------------------
899 --
900 -- Description
901 --   This procedure is used to check that the lookup value is valid.
902 --
903 -- Pre Conditions
904 --   None.
905 --
906 -- In Parameters
907 --   ler_chg_plip_enrt_id PK of record being inserted or updated.
908 --   new_crnt_enrl_cd Value of lookup code.
909 --   effective_date effective date
910 --   object_version_number Object version number of record being
911 --                         inserted or updated.
912 --
913 -- Post Success
914 --   Processing continues
915 --
916 -- Post Failure
917 --   Error handled by procedure
918 --
919 -- Access Status
920 --   Internal table handler use only.
921 --
922 Procedure chk_auto_enrt_mthd_rl(p_ler_chg_plip_enrt_id                in number,
923                             p_auto_enrt_mthd_rl           in number,
924                             p_effective_date              in date,
925                             p_business_group_id           in number,
926                             p_object_version_number       in number) is
927   --
928   l_proc         varchar2(72) := g_package||'chk_auto_enrt_mthd_rl';
929   l_api_updating boolean;
930   l_dummy varchar2(30);
931   --
932   --
933   cursor c1 is
934     select null
935     from   ff_formulas_f ff,
936            per_business_groups pbg
937     where  ff.formula_id = p_auto_enrt_mthd_rl
938     and    ff.formula_type_id = - 146
939     and    pbg.business_group_id = p_business_group_id
940     and    nvl(ff.business_group_id, p_business_group_id) =
941            p_business_group_id
942     and    nvl(ff.legislation_code, pbg.legislation_code) =
943            pbg.legislation_code
944     and    p_effective_date
945            between ff.effective_start_date
946            and     ff.effective_end_date;
947  --
948 Begin
949   --
950   hr_utility.set_location('Entering:'||l_proc, 5);
951   --
952   l_api_updating := ben_lpr_shd.api_updating
953     (p_ler_chg_plip_enrt_id        => p_ler_chg_plip_enrt_id,
954      p_effective_date              => p_effective_date,
955      p_object_version_number       => p_object_version_number);
956   --
957   if (l_api_updating
958       and nvl(p_auto_enrt_mthd_rl,hr_api.g_number)
959       <> nvl(ben_lpr_shd.g_old_rec.auto_enrt_mthd_rl,hr_api.g_number)
960       or not l_api_updating) and p_auto_enrt_mthd_rl is not null then
961     --
962     -- check if value of formula rule is valid.
963     --
964     open c1;
965       --
966       -- fetch value from cursor if it returns a record then the
967       -- formula is valid otherwise its invalid
968       --
969       fetch c1 into l_dummy;
970       if c1%notfound then
971         --
972         close c1;
973         --
974         -- raise error
975         --
976         fnd_message.set_name('BEN','BEN_91471_FORMULA_NOT_FOUND');
977         fnd_message.set_token('ID',p_auto_enrt_mthd_rl);
978         fnd_message.set_token('TYPE_ID',-146);
979         fnd_message.raise_error;
980         --
981       end if;
982       --
983     close c1;
984     --
985   end if;
986   --
987   hr_utility.set_location('Leaving:'||l_proc,10);
988   --
989 end chk_auto_enrt_mthd_rl;
990 --
991 -- ----------------------------------------------------------------------------
992 -- |--------------------------< dt_update_validate >--------------------------|
993 -- ----------------------------------------------------------------------------
994 -- {Start Of Comments}
995 --
996 -- Description:
997 --   This procedure is used for referential integrity of datetracked
998 --   parent entities when a datetrack update operation is taking place
999 --   and where there is no cascading of update defined for this entity.
1000 --
1001 -- Prerequisites:
1002 --   This procedure is called from the update_validate.
1003 --
1004 -- In Parameters:
1005 --
1006 -- Post Success:
1007 --   Processing continues.
1008 --
1009 -- Post Failure:
1010 --
1011 -- Developer Implementation Notes:
1012 --   This procedure should not need maintenance unless the HR Schema model
1013 --   changes.
1014 --
1015 -- Access Status:
1016 --   Internal Row Handler Use Only.
1017 --
1018 -- {End Of Comments}
1019 -- ----------------------------------------------------------------------------
1020 Procedure dt_update_validate
1021             (p_plip_id                       in number default hr_api.g_number,
1022              p_ler_id                        in number default hr_api.g_number,
1023 	     p_datetrack_mode		     in varchar2,
1024              p_validation_start_date	     in date,
1025 	     p_validation_end_date	     in date) Is
1026 --
1027   l_proc	    varchar2(72) := g_package||'dt_update_validate';
1028   l_integrity_error Exception;
1029   l_table_name	    all_tables.table_name%TYPE;
1030 --
1031 Begin
1032   hr_utility.set_location('Entering:'||l_proc, 5);
1033   --
1034   -- Ensure that the p_datetrack_mode argument is not null
1035   --
1036   hr_api.mandatory_arg_error
1037     (p_api_name       => l_proc,
1038      p_argument       => 'datetrack_mode',
1039      p_argument_value => p_datetrack_mode);
1040   --
1041   -- Only perform the validation if the datetrack update mode is valid
1042   --
1046     -- Ensure the arguments are not null
1043   If (dt_api.validate_dt_upd_mode(p_datetrack_mode => p_datetrack_mode)) then
1044     --
1045     --
1047     --
1048     hr_api.mandatory_arg_error
1049       (p_api_name       => l_proc,
1050        p_argument       => 'validation_start_date',
1051        p_argument_value => p_validation_start_date);
1052     --
1053     hr_api.mandatory_arg_error
1054       (p_api_name       => l_proc,
1055        p_argument       => 'validation_end_date',
1056        p_argument_value => p_validation_end_date);
1057     --
1058     If ((nvl(p_plip_id, hr_api.g_number) <> hr_api.g_number) and
1059       NOT (dt_api.check_min_max_dates
1060             (p_base_table_name => 'ben_plip_f',
1061              p_base_key_column => 'plip_id',
1062              p_base_key_value  => p_plip_id,
1063              p_from_date       => p_validation_start_date,
1064              p_to_date         => p_validation_end_date)))  Then
1065       l_table_name := 'ben_plip_f';
1066       Raise l_integrity_error;
1067     End If;
1068     If ((nvl(p_ler_id, hr_api.g_number) <> hr_api.g_number) and
1069       NOT (dt_api.check_min_max_dates
1070             (p_base_table_name => 'ben_ler_f',
1071              p_base_key_column => 'ler_id',
1072              p_base_key_value  => p_ler_id,
1073              p_from_date       => p_validation_start_date,
1074              p_to_date         => p_validation_end_date)))  Then
1075       l_table_name := 'ben_ler_f';
1076       Raise l_integrity_error;
1077     End If;
1078     --
1079   End If;
1080   --
1081   hr_utility.set_location(' Leaving:'||l_proc, 10);
1082 Exception
1083   When l_integrity_error Then
1084     --
1085     -- A referential integrity check was violated therefore
1086     -- we must error
1087     --
1088     ben_utility.parent_integrity_error(p_table_name => l_table_name);
1089   When Others Then
1090     --
1091     -- An unhandled or unexpected error has occurred which
1092     -- we must report
1093     --
1094     fnd_message.set_name('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
1095     fnd_message.set_token('PROCEDURE', l_proc);
1096     fnd_message.set_token('STEP','15');
1097     fnd_message.raise_error;
1098 End dt_update_validate;
1099 --
1100 -- ----------------------------------------------------------------------------
1101 -- |--------------------------< dt_delete_validate >--------------------------|
1102 -- ----------------------------------------------------------------------------
1103 -- {Start Of Comments}
1104 --
1105 -- Description:
1106 --   This procedure is used for referential integrity of datetracked
1107 --   child entities when either a datetrack DELETE or ZAP is in operation
1108 --   and where there is no cascading of delete defined for this entity.
1109 --   For the datetrack mode of DELETE or ZAP we must ensure that no
1110 --   datetracked child rows exist between the validation start and end
1111 --   dates.
1112 --
1113 -- Prerequisites:
1114 --   This procedure is called from the delete_validate.
1115 --
1116 -- In Parameters:
1117 --
1118 -- Post Success:
1119 --   Processing continues.
1120 --
1121 -- Post Failure:
1122 --   If a row exists by determining the returning Boolean value from the
1123 --   generic dt_api.rows_exist function then we must supply an error via
1124 --   the use of the local exception handler l_rows_exist.
1125 --
1126 -- Developer Implementation Notes:
1127 --   This procedure should not need maintenance unless the HR Schema model
1128 --   changes.
1129 --
1130 -- Access Status:
1131 --   Internal Row Handler Use Only.
1132 --
1133 -- {End Of Comments}
1134 -- ----------------------------------------------------------------------------
1135 Procedure dt_delete_validate
1136             (p_ler_chg_plip_enrt_id		in number,
1137              p_datetrack_mode		in varchar2,
1138 	     p_validation_start_date	in date,
1139 	     p_validation_end_date	in date) Is
1140 --
1141   l_proc	varchar2(72) 	:= g_package||'dt_delete_validate';
1142   l_rows_exist	Exception;
1143   l_table_name	all_tables.table_name%TYPE;
1144 --
1145 Begin
1146   hr_utility.set_location('Entering:'||l_proc, 5);
1147   --
1148   -- Ensure that the p_datetrack_mode argument is not null
1149   --
1150   hr_api.mandatory_arg_error
1151     (p_api_name       => l_proc,
1152      p_argument       => 'datetrack_mode',
1153      p_argument_value => p_datetrack_mode);
1154   --
1155   -- Only perform the validation if the datetrack mode is either
1156   -- DELETE or ZAP
1157   --
1158   If (p_datetrack_mode = 'DELETE' or
1159       p_datetrack_mode = 'ZAP') then
1160     --
1161     --
1162     -- Ensure the arguments are not null
1163     --
1164     hr_api.mandatory_arg_error
1165       (p_api_name       => l_proc,
1166        p_argument       => 'validation_start_date',
1167        p_argument_value => p_validation_start_date);
1168     --
1169     hr_api.mandatory_arg_error
1170       (p_api_name       => l_proc,
1171        p_argument       => 'validation_end_date',
1172        p_argument_value => p_validation_end_date);
1173     --
1174     hr_api.mandatory_arg_error
1175       (p_api_name       => l_proc,
1176        p_argument       => 'ler_chg_plip_enrt_id',
1177        p_argument_value => p_ler_chg_plip_enrt_id);
1178     --
1179     If (dt_api.rows_exist
1180           (p_base_table_name => 'ben_ler_chg_plip_enrt_rl_f',
1181            p_base_key_column => 'ler_chg_plip_enrt_id',
1182            p_base_key_value  => p_ler_chg_plip_enrt_id,
1183            p_from_date       => p_validation_start_date,
1184            p_to_date         => p_validation_end_date)) Then
1185       l_table_name := 'ben_ler_chg_plip_enrt_rl_f';
1186       Raise l_rows_exist;
1187     End If;
1188     --
1192 Exception
1189   End If;
1190   --
1191   hr_utility.set_location(' Leaving:'||l_proc, 10);
1193   When l_rows_exist Then
1194     --
1195     -- A referential integrity check was violated therefore
1196     -- we must error
1197     --
1198     ben_utility.child_exists_error(p_table_name => l_table_name);
1199   When Others Then
1200     --
1201     -- An unhandled or unexpected error has occurred which
1202     -- we must report
1203     --
1204     fnd_message.set_name('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
1205     fnd_message.set_token('PROCEDURE', l_proc);
1206     fnd_message.set_token('STEP','15');
1207     fnd_message.raise_error;
1208 End dt_delete_validate;
1209 --
1210 -- ----------------------------------------------------------------------------
1211 -- |---------------------------< insert_validate >----------------------------|
1212 -- ----------------------------------------------------------------------------
1213 Procedure insert_validate
1214 	(p_rec 			 in ben_lpr_shd.g_rec_type,
1215 	 p_effective_date	 in date,
1216 	 p_datetrack_mode	 in varchar2,
1217 	 p_validation_start_date in date,
1218 	 p_validation_end_date	 in date) is
1219 --
1220   l_proc	varchar2(72) := g_package||'insert_validate';
1221 --
1222 Begin
1223   hr_utility.set_location('Entering:'||l_proc, 5);
1224   --
1225   -- Call all supporting business operations
1226   --
1227   --
1228   hr_api.validate_bus_grp_id(p_rec.business_group_id);  -- Validate Bus Grp
1229   --
1230   chk_ler_chg_plip_enrt_id
1231   (p_ler_chg_plip_enrt_id          => p_rec.ler_chg_plip_enrt_id,
1232    p_effective_date        => p_effective_date,
1233    p_object_version_number => p_rec.object_version_number);
1234  --
1235   chk_ler_id
1236   (p_ler_chg_plip_enrt_id          => p_rec.ler_chg_plip_enrt_id,
1237    p_ler_id              => p_rec.ler_id,
1238    p_plip_id              => p_rec.plip_id,
1239    p_effective_date        => p_effective_date,
1240    p_validation_start_date  =>    p_validation_start_date,
1241    p_validation_end_date      =>  p_validation_end_date,
1242    p_business_group_id        =>  p_rec.business_group_id,
1243    p_object_version_number => p_rec.object_version_number);
1244    --
1245   chk_enrt_cd
1246   (p_ler_chg_plip_enrt_id          => p_rec.ler_chg_plip_enrt_id,
1247    p_enrt_cd         => p_rec.enrt_cd,
1248    p_effective_date        => p_effective_date,
1249    p_object_version_number => p_rec.object_version_number);
1250   --
1251   chk_stl_elig_cant_chg_flag
1252   (p_ler_chg_plip_enrt_id          => p_rec.ler_chg_plip_enrt_id,
1253    p_stl_elig_cant_chg_flag         => p_rec.stl_elig_cant_chg_flag,
1254    p_effective_date        => p_effective_date,
1255    p_object_version_number => p_rec.object_version_number);
1256   --
1257   chk_enrt_mthd_cd
1258   (p_ler_chg_plip_enrt_id          => p_rec.ler_chg_plip_enrt_id,
1259    p_enrt_mthd_cd         => p_rec.enrt_mthd_cd,
1260    p_effective_date        => p_effective_date,
1261    p_object_version_number => p_rec.object_version_number);
1262   --
1263   chk_dflt_enrt_cd
1264   (p_ler_chg_plip_enrt_id          => p_rec.ler_chg_plip_enrt_id,
1265    p_dflt_enrt_cd         => p_rec.dflt_enrt_cd,
1266    p_effective_date        => p_effective_date,
1267    p_object_version_number => p_rec.object_version_number);
1268   --
1269   chk_enrt_rl
1270   (p_ler_chg_plip_enrt_id          => p_rec.ler_chg_plip_enrt_id,
1271    p_enrt_rl               => p_rec.enrt_rl,
1272    p_effective_date        => p_effective_date,
1273    p_business_group_id     => p_rec.business_group_id,
1274    p_object_version_number => p_rec.object_version_number);
1275   --
1276   chk_dflt_enrt_rl
1277   (p_ler_chg_plip_enrt_id          => p_rec.ler_chg_plip_enrt_id,
1278    p_dflt_enrt_rl         => p_rec.dflt_enrt_rl,
1279    p_effective_date        => p_effective_date,
1280    p_business_group_id     => p_rec.business_group_id,
1281    p_object_version_number => p_rec.object_version_number);
1282   --
1283   chk_dflt_flag
1284   (p_ler_chg_plip_enrt_id          => p_rec.ler_chg_plip_enrt_id,
1285    p_dflt_flag         => p_rec.dflt_flag,
1286    p_plip_id              => p_rec.plip_id,
1287    p_effective_date        => p_effective_date,
1288    p_validation_start_date  =>    p_validation_start_date,
1289    p_validation_end_date      =>  p_validation_end_date,
1290    p_business_group_id        =>  p_rec.business_group_id,
1291    p_object_version_number => p_rec.object_version_number);
1292   --
1293   chk_crnt_enrt_prclds_chg_flag
1294   (p_ler_chg_plip_enrt_id          => p_rec.ler_chg_plip_enrt_id,
1295    p_crnt_enrt_prclds_chg_flag         => p_rec.crnt_enrt_prclds_chg_flag,
1296    p_effective_date        => p_effective_date,
1297    p_object_version_number => p_rec.object_version_number);
1298   --
1299   chk_tco_chg_enrt_cd
1300   (p_ler_chg_plip_enrt_id          => p_rec.ler_chg_plip_enrt_id,
1301    p_tco_chg_enrt_cd         => p_rec.tco_chg_enrt_cd,
1302    p_effective_date        => p_effective_date,
1303    p_object_version_number => p_rec.object_version_number);
1304   --
1305   chk_auto_enrt_mthd_rl
1306   (p_ler_chg_plip_enrt_id          => p_rec.ler_chg_plip_enrt_id,
1307    p_auto_enrt_mthd_rl         => p_rec.auto_enrt_mthd_rl,
1308    p_effective_date        => p_effective_date,
1309    p_business_group_id     => p_rec.business_group_id,
1310    p_object_version_number => p_rec.object_version_number);
1311   --
1312   hr_utility.set_location(' Leaving:'||l_proc, 10);
1313 End insert_validate;
1314 --
1315 -- ----------------------------------------------------------------------------
1316 -- |---------------------------< update_validate >----------------------------|
1317 -- ----------------------------------------------------------------------------
1318 Procedure update_validate
1322 	 p_validation_start_date in date,
1319 	(p_rec 			 in ben_lpr_shd.g_rec_type,
1320 	 p_effective_date	 in date,
1321 	 p_datetrack_mode	 in varchar2,
1323 	 p_validation_end_date	 in date) is
1324 --
1325   l_proc	varchar2(72) := g_package||'update_validate';
1326 --
1327 Begin
1328   hr_utility.set_location('Entering:'||l_proc, 5);
1329   --
1330   -- Call all supporting business operations
1331   --
1332   --
1333   hr_api.validate_bus_grp_id(p_rec.business_group_id);  -- Validate Bus Grp
1334   --
1335   chk_ler_chg_plip_enrt_id
1336   (p_ler_chg_plip_enrt_id          => p_rec.ler_chg_plip_enrt_id,
1337    p_effective_date        => p_effective_date,
1338    p_object_version_number => p_rec.object_version_number);
1339  --
1340   chk_ler_id
1341   (p_ler_chg_plip_enrt_id          => p_rec.ler_chg_plip_enrt_id,
1342    p_ler_id              => p_rec.ler_id,
1343    p_plip_id              => p_rec.plip_id,
1344    p_effective_date        => p_effective_date,
1345    p_validation_start_date  =>    p_validation_start_date,
1346    p_validation_end_date      =>  p_validation_end_date,
1347    p_business_group_id        =>  p_rec.business_group_id,
1348    p_object_version_number => p_rec.object_version_number);
1349   --
1350   chk_enrt_cd
1351   (p_ler_chg_plip_enrt_id          => p_rec.ler_chg_plip_enrt_id,
1352    p_enrt_cd         => p_rec.enrt_cd,
1353    p_effective_date        => p_effective_date,
1354    p_object_version_number => p_rec.object_version_number);
1355   --
1356   chk_stl_elig_cant_chg_flag
1357   (p_ler_chg_plip_enrt_id          => p_rec.ler_chg_plip_enrt_id,
1358    p_stl_elig_cant_chg_flag         => p_rec.stl_elig_cant_chg_flag,
1359    p_effective_date        => p_effective_date,
1360    p_object_version_number => p_rec.object_version_number);
1361   --
1362   chk_enrt_mthd_cd
1363   (p_ler_chg_plip_enrt_id          => p_rec.ler_chg_plip_enrt_id,
1364    p_enrt_mthd_cd         => p_rec.enrt_mthd_cd,
1365    p_effective_date        => p_effective_date,
1366    p_object_version_number => p_rec.object_version_number);
1367   --
1368   chk_dflt_enrt_cd
1369   (p_ler_chg_plip_enrt_id          => p_rec.ler_chg_plip_enrt_id,
1370    p_dflt_enrt_cd         => p_rec.dflt_enrt_cd,
1371    p_effective_date        => p_effective_date,
1372    p_object_version_number => p_rec.object_version_number);
1373   --
1374   chk_enrt_rl
1375   (p_ler_chg_plip_enrt_id          => p_rec.ler_chg_plip_enrt_id,
1376    p_enrt_rl               => p_rec.enrt_rl,
1377    p_effective_date        => p_effective_date,
1378    p_business_group_id     => p_rec.business_group_id,
1379    p_object_version_number => p_rec.object_version_number);
1380   --
1381   chk_dflt_enrt_rl
1382   (p_ler_chg_plip_enrt_id          => p_rec.ler_chg_plip_enrt_id,
1383    p_dflt_enrt_rl          => p_rec.dflt_enrt_rl,
1384    p_effective_date        => p_effective_date,
1385    p_business_group_id     => p_rec.business_group_id,
1386    p_object_version_number => p_rec.object_version_number);
1387   --
1388   chk_dflt_flag
1389   (p_ler_chg_plip_enrt_id          => p_rec.ler_chg_plip_enrt_id,
1390    p_dflt_flag         => p_rec.dflt_flag,
1391    p_plip_id              => p_rec.plip_id,
1392    p_effective_date        => p_effective_date,
1393    p_validation_start_date  =>    p_validation_start_date,
1394    p_validation_end_date      =>  p_validation_end_date,
1395    p_business_group_id        =>  p_rec.business_group_id,
1396    p_object_version_number => p_rec.object_version_number);
1397   --
1398   chk_crnt_enrt_prclds_chg_flag
1399   (p_ler_chg_plip_enrt_id          => p_rec.ler_chg_plip_enrt_id,
1400    p_crnt_enrt_prclds_chg_flag         => p_rec.crnt_enrt_prclds_chg_flag,
1401    p_effective_date        => p_effective_date,
1402    p_object_version_number => p_rec.object_version_number);
1403   --
1404   chk_tco_chg_enrt_cd
1405   (p_ler_chg_plip_enrt_id          => p_rec.ler_chg_plip_enrt_id,
1406    p_tco_chg_enrt_cd         => p_rec.tco_chg_enrt_cd,
1407    p_effective_date        => p_effective_date,
1408    p_object_version_number => p_rec.object_version_number);
1409   --
1410   chk_auto_enrt_mthd_rl
1411   (p_ler_chg_plip_enrt_id          => p_rec.ler_chg_plip_enrt_id,
1412    p_auto_enrt_mthd_rl         => p_rec.auto_enrt_mthd_rl,
1413    p_effective_date        => p_effective_date,
1414    p_business_group_id     => p_rec.business_group_id,
1415    p_object_version_number => p_rec.object_version_number);
1416   --
1417   -- Call the datetrack update integrity operation
1418   --
1419   dt_update_validate
1420     (p_plip_id                       => p_rec.plip_id,
1421              p_ler_id                        => p_rec.ler_id,
1422      p_datetrack_mode                => p_datetrack_mode,
1423      p_validation_start_date	     => p_validation_start_date,
1424      p_validation_end_date	     => p_validation_end_date);
1425   --
1426   hr_utility.set_location(' Leaving:'||l_proc, 10);
1427 End update_validate;
1428 --
1429 -- ----------------------------------------------------------------------------
1430 -- |---------------------------< delete_validate >----------------------------|
1431 -- ----------------------------------------------------------------------------
1432 Procedure delete_validate
1433 	(p_rec 			 in ben_lpr_shd.g_rec_type,
1434 	 p_effective_date	 in date,
1435 	 p_datetrack_mode	 in varchar2,
1436 	 p_validation_start_date in date,
1437 	 p_validation_end_date	 in date) is
1438 --
1439   l_proc	varchar2(72) := g_package||'delete_validate';
1440 --
1441 Begin
1442   hr_utility.set_location('Entering:'||l_proc, 5);
1443   --
1444   -- Call all supporting business operations
1445   --
1446   dt_delete_validate
1447     (p_datetrack_mode		=> p_datetrack_mode,
1448      p_validation_start_date	=> p_validation_start_date,
1449      p_validation_end_date	=> p_validation_end_date,
1450      p_ler_chg_plip_enrt_id		=> p_rec.ler_chg_plip_enrt_id);
1451   --
1452   hr_utility.set_location(' Leaving:'||l_proc, 10);
1453 End delete_validate;
1454 --
1455 --
1456 --  ---------------------------------------------------------------------------
1457 --  |---------------------< return_legislation_code >-------------------------|
1458 --  ---------------------------------------------------------------------------
1459 --
1460 function return_legislation_code
1461   (p_ler_chg_plip_enrt_id in number) return varchar2 is
1462   --
1463   -- Declare cursor
1464   --
1465   cursor csr_leg_code is
1466     select a.legislation_code
1467     from   per_business_groups a,
1468            ben_ler_chg_plip_enrt_f b
1469     where b.ler_chg_plip_enrt_id      = p_ler_chg_plip_enrt_id
1470     and   a.business_group_id = b.business_group_id;
1471   --
1472   -- Declare local variables
1473   --
1474   l_legislation_code  varchar2(150);
1475   l_proc              varchar2(72)  :=  g_package||'return_legislation_code';
1476   --
1477 begin
1478   --
1479   hr_utility.set_location('Entering:'|| l_proc, 10);
1480   --
1481   -- Ensure that all the mandatory parameter are not null
1482   --
1483   hr_api.mandatory_arg_error(p_api_name       => l_proc,
1484                              p_argument       => 'ler_chg_plip_enrt_id',
1485                              p_argument_value => p_ler_chg_plip_enrt_id);
1486   --
1487   open csr_leg_code;
1488     --
1489     fetch csr_leg_code into l_legislation_code;
1490     --
1491     if csr_leg_code%notfound then
1492       --
1493       close csr_leg_code;
1494       --
1495       -- The primary key is invalid therefore we must error
1496       --
1497       fnd_message.set_name('PAY','HR_7220_INVALID_PRIMARY_KEY');
1498       fnd_message.raise_error;
1499       --
1500     end if;
1501     --
1502   close csr_leg_code;
1503   --
1504   hr_utility.set_location(' Leaving:'|| l_proc, 20);
1505   --
1506   return l_legislation_code;
1507   --
1508 end return_legislation_code;
1509 --
1510 end ben_lpr_bus;