DBA Data[Home] [Help]

PACKAGE BODY: APPS.BEN_PRD_BUS

Source


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