DBA Data[Home] [Help]

PACKAGE BODY: APPS.BEN_PCX_BUS

Source


1 Package Body ben_pcx_bus as
2 /* $Header: bepcxrhi.pkb 120.0 2005/05/28 10:21:17 appldev noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33)	:= '  ben_pcx_bus.';  -- Global package name
9 --
10 -- ----------------------------------------------------------------------------
11 -- |------< chk_pl_bnf_ctfn_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 --   pl_bnf_ctfn_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_pl_bnf_ctfn_id(p_pl_bnf_ctfn_id                in number,
38                            p_effective_date              in date,
39                            p_object_version_number       in number) is
40   --
44 Begin
41   l_proc         varchar2(72) := g_package||'chk_pl_bnf_ctfn_id';
42   l_api_updating boolean;
43   --
45   --
46   hr_utility.set_location('Entering:'||l_proc, 5);
47   --
48   l_api_updating := ben_pcx_shd.api_updating
49     (p_effective_date              => p_effective_date,
50      p_pl_bnf_ctfn_id                => p_pl_bnf_ctfn_id,
51      p_object_version_number       => p_object_version_number);
52   --
53   if (l_api_updating
54      and nvl(p_pl_bnf_ctfn_id,hr_api.g_number)
55      <>  ben_pcx_shd.g_old_rec.pl_bnf_ctfn_id) then
56     --
57     -- raise error as PK has changed
58     --
59     ben_pcx_shd.constraint_error('BEN_PL_BNF_CTFN_PK');
60     --
61   elsif not l_api_updating then
62     --
63     -- check if PK is null
64     --
65     if p_pl_bnf_ctfn_id is not null then
66       --
67       -- raise error as PK is not null
68       --
69       ben_pcx_shd.constraint_error('BEN_PL_BNF_CTFN_PK');
70       --
71     end if;
72     --
73   end if;
74   --
75   hr_utility.set_location('Leaving:'||l_proc, 10);
76   --
77 End chk_pl_bnf_ctfn_id;
78 --
79 -- ----------------------------------------------------------------------------
80 -- |---------------< chk_bnf_ctfn_typ_cd_unique >------------------------|
81 -- ----------------------------------------------------------------------------
82 --
83 -- Description
84 --   ensure that no two dependent certification types have the same value
85 --
86 -- Pre Conditions
87 --   None.
88 --
89 -- In Parameters
90 --     p_bnf_ctfn_typ_cd       is dependent certification type code
91 --     p_rlshp_typ_cd          is relationship type code
92 --     p_pl_bnf_ctfn_id        is primary key for ben_pl_bnf_ctfn_f
93 --     p_pl_id
94 --     p_business_group_id
95 --     p_validation_start_date
96 --     p_validation_end_date
97 --
98 -- Post Success
99 --   Processing continues
100 --
101 -- Post Failure
102 --   Errors handled by the procedure
103 --
104 -- Access Status
105 --   Internal table handler use only.
106 --
107 -- ----------------------------------------------------------------------------
108 Procedure chk_bnf_ctfn_typ_cd_unique
109           ( p_pl_bnf_ctfn_id        in number
110            ,p_bnf_ctfn_typ_cd       in varchar2
111            ,p_rlshp_typ_cd          in varchar2
112            ,p_pl_id                 in number
113            ,p_business_group_id     in number
114            ,p_validation_start_date in date
115            ,p_validation_end_date   in date)
116 is
117 l_proc      varchar2(72) := g_package||'chk_bnf_ctfn_typ_cd_unique';
118 l_dummy    char(1);
119 cursor c1 is select null
120                from ben_pl_bnf_ctfn_f
121               Where pl_bnf_ctfn_id <> nvl(p_pl_bnf_ctfn_id,-1)
122                 and nvl(bnf_ctfn_typ_cd,0) = nvl(p_bnf_ctfn_typ_cd,0)
123                 and nvl(rlshp_typ_cd,0) = nvl(p_rlshp_typ_cd,0)
124                 and pl_id = p_pl_id
125                 and business_group_id = p_business_group_id
126                 and ((p_validation_start_date between
127                      effective_start_date and effective_end_date)
128                  or (p_validation_end_date between
129                      effective_start_date and effective_end_date)) ;
130 --
131 Begin
132   hr_utility.set_location('Entering:'||l_proc, 5);
133   --
134   open c1;
135   fetch c1 into l_dummy;
136   if c1%found then
137       close c1;
138       fnd_message.set_name('BEN','BEN_92122_CTFN_TYP_UNIQUE');
139       fnd_message.raise_error;
140   end if;
141   --
142   hr_utility.set_location('Leaving:'||l_proc, 15);
143 End chk_bnf_ctfn_typ_cd_unique;
144 --
145 -- ----------------------------------------------------------------------------
146 -- |------< chk_ctfn_rqd_when_rl >------|
147 -- ----------------------------------------------------------------------------
148 --
149 -- Description
150 --   This procedure is used to check that the Formula Rule is valid.
151 --
152 -- Pre Conditions
153 --   None.
154 --
155 -- In Parameters
156 --   pl_bnf_ctfn_id PK of record being inserted or updated.
157 --   ctfn_rqd_when_rl Value of formula rule id.
158 --   effective_date effective date
159 --   object_version_number Object version number of record being
160 --                         inserted or updated.
161 --
162 -- Post Success
163 --   Processing continues
164 --
165 -- Post Failure
166 --   Error handled by procedure
167 --
168 -- Access Status
169 --   Internal table handler use only.
170 --
171 Procedure chk_ctfn_rqd_when_rl(p_pl_bnf_ctfn_id                in number,
172                              p_ctfn_rqd_when_rl              in number,
173                              p_effective_date              in date,
174                              p_business_group_id            in number,
175                              p_object_version_number       in number) is
176   --
177   l_proc         varchar2(72) := g_package||'chk_ctfn_rqd_when_rl';
178   l_api_updating boolean;
179   l_dummy        varchar2(1);
180   --
181   cursor c1 is
182     select null
183     from   ff_formulas_f ff
184            ,per_business_groups pbg
185     where  ff.formula_id = p_ctfn_rqd_when_rl
186     and    ff.formula_type_id = -25
187     and    pbg.business_group_id = p_business_group_id
188     and    nvl(ff.business_group_id, p_business_group_id) =
189             p_business_group_id
193            between ff.effective_start_date
190     and    nvl(ff.legislation_code, pbg.legislation_code) =
191             pbg.legislation_code
192     and    p_effective_date
194            and     ff.effective_end_date;
195   --
196 Begin
197   --
198   hr_utility.set_location('Entering:'||l_proc, 5);
199   --
200   l_api_updating := ben_pcx_shd.api_updating
201     (p_pl_bnf_ctfn_id                => p_pl_bnf_ctfn_id,
202      p_effective_date              => p_effective_date,
203      p_object_version_number       => p_object_version_number);
204   --
205   if (l_api_updating
206       and nvl(p_ctfn_rqd_when_rl,hr_api.g_number)
207       <> ben_pcx_shd.g_old_rec.ctfn_rqd_when_rl
208       or not l_api_updating)
209       and p_ctfn_rqd_when_rl is not null then
210     --
211     -- check if value of formula rule is valid.
212     --
213     open c1;
214       --
215       -- fetch value from cursor if it returns a record then the
216       -- formula is valid otherwise its invalid
217       --
218       fetch c1 into l_dummy;
219       if c1%notfound then
220         --
221         close c1;
222         --
223         -- raise error
224         --
225         fnd_message.set_name('BEN','BEN_91471_FORMULA_NOT_FOUND');
226         fnd_message.set_token('ID',p_ctfn_rqd_when_rl);
227         fnd_message.set_token('TYPE_ID',-25);
228         fnd_message.raise_error;
229         --
230       end if;
231       --
232     close c1;
233     --
234   end if;
235   --
236   hr_utility.set_location('Leaving:'||l_proc,10);
237   --
238 end chk_ctfn_rqd_when_rl;
239 --
240 -- ----------------------------------------------------------------------------
241 -- |------< chk_pfd_flag >------|
242 -- ----------------------------------------------------------------------------
243 --
244 -- Description
245 --   This procedure is used to check that the lookup value is valid.
246 --
247 -- Pre Conditions
248 --   None.
249 --
250 -- In Parameters
251 --   pl_bnf_ctfn_id PK of record being inserted or updated.
252 --   pfd_flag Value of lookup code.
253 --   effective_date effective date
254 --   object_version_number Object version number of record being
255 --                         inserted or updated.
256 --
257 -- Post Success
258 --   Processing continues
259 --
260 -- Post Failure
261 --   Error handled by procedure
262 --
263 -- Access Status
264 --   Internal table handler use only.
265 --
266 Procedure chk_pfd_flag(p_pl_bnf_ctfn_id                in number,
267                             p_pfd_flag               in varchar2,
268                             p_effective_date              in date,
269                             p_object_version_number       in number) is
270   --
271   l_proc         varchar2(72) := g_package||'chk_pfd_flag';
272   l_api_updating boolean;
273   --
274 Begin
275   --
276   hr_utility.set_location('Entering:'||l_proc, 5);
277   --
278   l_api_updating := ben_pcx_shd.api_updating
279     (p_pl_bnf_ctfn_id                => p_pl_bnf_ctfn_id,
280      p_effective_date              => p_effective_date,
281      p_object_version_number       => p_object_version_number);
282   --
283   if (l_api_updating
284       and p_pfd_flag
285       <> nvl(ben_pcx_shd.g_old_rec.pfd_flag,hr_api.g_varchar2)
286       or not l_api_updating)
287       and p_pfd_flag is not null then
288     --
289     -- check if value of lookup falls within lookup type.
290     --
291     if hr_api.not_exists_in_hr_lookups
292           (p_lookup_type    => 'YES_NO',
293            p_lookup_code    => p_pfd_flag,
294            p_effective_date => p_effective_date) then
295       --
296       -- raise error as does not exist as lookup
297       --
298       fnd_message.set_name('PAY','HR_LOOKUP_DOES_NOT_EXIST');
299       fnd_message.raise_error;
300       --
301     end if;
302     --
303   end if;
304   --
305   hr_utility.set_location('Leaving:'||l_proc,10);
306   --
307 end chk_pfd_flag;
308 --
309 -- ----------------------------------------------------------------------------
310 -- |------< chk_lack_ctfn_sspnd_enrt_flag >------|
311 -- ----------------------------------------------------------------------------
312 --
313 -- Description
314 --   This procedure is used to check that the lookup value is valid.
315 --
316 -- Pre Conditions
317 --   None.
318 --
319 -- In Parameters
320 --   pl_bnf_ctfn_id PK of record being inserted or updated.
321 --   lack_ctfn_sspnd_enrt_flag Value of lookup code.
322 --   effective_date effective date
323 --   object_version_number Object version number of record being
324 --                         inserted or updated.
325 --
326 -- Post Success
327 --   Processing continues
328 --
329 -- Post Failure
330 --   Error handled by procedure
331 --
332 -- Access Status
333 --   Internal table handler use only.
334 --
335 Procedure chk_lack_ctfn_sspnd_enrt_flag(p_pl_bnf_ctfn_id                in number,
336                             p_lack_ctfn_sspnd_enrt_flag               in varchar2,
337                             p_effective_date              in date,
338                             p_object_version_number       in number) is
339   --
340   l_proc         varchar2(72) := g_package||'chk_lack_ctfn_sspnd_enrt_flag';
341   l_api_updating boolean;
342   --
343 Begin
344   --
345   hr_utility.set_location('Entering:'||l_proc, 5);
346   --
350      p_object_version_number       => p_object_version_number);
347   l_api_updating := ben_pcx_shd.api_updating
348     (p_pl_bnf_ctfn_id                => p_pl_bnf_ctfn_id,
349      p_effective_date              => p_effective_date,
351   --
352   if (l_api_updating
353       and p_lack_ctfn_sspnd_enrt_flag
354       <> nvl(ben_pcx_shd.g_old_rec.lack_ctfn_sspnd_enrt_flag,hr_api.g_varchar2)
355       or not l_api_updating)
356       and p_lack_ctfn_sspnd_enrt_flag is not null then
357     --
358     -- check if value of lookup falls within lookup type.
359     --
360     if hr_api.not_exists_in_hr_lookups
361           (p_lookup_type    => 'YES_NO',
362            p_lookup_code    => p_lack_ctfn_sspnd_enrt_flag,
363            p_effective_date => p_effective_date) then
364       --
365       -- raise error as does not exist as lookup
366       --
367       fnd_message.set_name('PAY','HR_LOOKUP_DOES_NOT_EXIST');
368       fnd_message.raise_error;
369       --
370     end if;
371     --
372   end if;
373   --
374   hr_utility.set_location('Leaving:'||l_proc,10);
375   --
376 end chk_lack_ctfn_sspnd_enrt_flag;
377 --
378 -- ----------------------------------------------------------------------------
379 -- |------< chk_bnf_ctfn_typ_cd >------|
380 -- ----------------------------------------------------------------------------
381 --
382 -- Description
383 --   This procedure is used to check that the lookup value is valid.
384 --
385 -- Pre Conditions
386 --   None.
387 --
388 -- In Parameters
389 --   pl_bnf_ctfn_id PK of record being inserted or updated.
390 --   bnf_ctfn_typ_cd Value of lookup code.
391 --   effective_date effective date
392 --   object_version_number Object version number of record being
393 --                         inserted or updated.
394 --
395 -- Post Success
396 --   Processing continues
397 --
398 -- Post Failure
399 --   Error handled by procedure
400 --
401 -- Access Status
402 --   Internal table handler use only.
403 --
404 Procedure chk_bnf_ctfn_typ_cd(p_pl_bnf_ctfn_id                in number,
405                             p_bnf_ctfn_typ_cd               in varchar2,
406                             p_effective_date              in date,
407                             p_object_version_number       in number) is
408   --
409   l_proc         varchar2(72) := g_package||'chk_bnf_ctfn_typ_cd';
410   l_api_updating boolean;
411   --
412 Begin
413   --
414   hr_utility.set_location('Entering:'||l_proc, 5);
415   --
416   l_api_updating := ben_pcx_shd.api_updating
417     (p_pl_bnf_ctfn_id                => p_pl_bnf_ctfn_id,
418      p_effective_date              => p_effective_date,
419      p_object_version_number       => p_object_version_number);
420   --
421   if (l_api_updating
422       and p_bnf_ctfn_typ_cd
423       <> nvl(ben_pcx_shd.g_old_rec.bnf_ctfn_typ_cd,hr_api.g_varchar2)
424       or not l_api_updating)
425       and p_bnf_ctfn_typ_cd is not null then
426     --
427     -- check if value of lookup falls within lookup type.
428     --
429     if hr_api.not_exists_in_hr_lookups
430           (p_lookup_type    => 'BEN_BNF_CTFN_TYP',
431            p_lookup_code    => p_bnf_ctfn_typ_cd,
432            p_effective_date => p_effective_date) then
433       --
434       -- raise error as does not exist as lookup
435       --
436       fnd_message.set_name('PAY','HR_LOOKUP_DOES_NOT_EXIST');
437       fnd_message.raise_error;
438       --
439     end if;
440     --
441   end if;
442   --
443   hr_utility.set_location('Leaving:'||l_proc,10);
444   --
445 end chk_bnf_ctfn_typ_cd;
446 --
447 -- ----------------------------------------------------------------------------
448 -- |--------------------------< dt_update_validate >--------------------------|
449 -- ----------------------------------------------------------------------------
450 -- {Start Of Comments}
451 --
452 -- Description:
453 --   This procedure is used for referential integrity of datetracked
454 --   parent entities when a datetrack update operation is taking place
455 --   and where there is no cascading of update defined for this entity.
456 --
457 -- Prerequisites:
458 --   This procedure is called from the update_validate.
459 --
460 -- In Parameters:
461 --
462 -- Post Success:
463 --   Processing continues.
464 --
465 -- Post Failure:
466 --
467 -- Developer Implementation Notes:
468 --   This procedure should not need maintenance unless the HR Schema model
469 --   changes.
470 --
471 -- Access Status:
472 --   Internal Row Handler Use Only.
473 --
474 -- {End Of Comments}
475 -- ----------------------------------------------------------------------------
476 Procedure dt_update_validate
477             (p_pl_id                         in number default hr_api.g_number,
478 	     p_datetrack_mode		     in varchar2,
479              p_validation_start_date	     in date,
480 	     p_validation_end_date	     in date) Is
481 --
482   l_proc	    varchar2(72) := g_package||'dt_update_validate';
483   l_integrity_error Exception;
484   l_table_name	    all_tables.table_name%TYPE;
485 --
486 Begin
487   hr_utility.set_location('Entering:'||l_proc, 5);
488   --
489   -- Ensure that the p_datetrack_mode argument is not null
490   --
491   hr_api.mandatory_arg_error
492     (p_api_name       => l_proc,
493      p_argument       => 'datetrack_mode',
494      p_argument_value => p_datetrack_mode);
495   --
496   -- Only perform the validation if the datetrack update mode is valid
497   --
498   If (dt_api.validate_dt_upd_mode(p_datetrack_mode => p_datetrack_mode)) then
499     --
500     --
504       (p_api_name       => l_proc,
501     -- Ensure the arguments are not null
502     --
503     hr_api.mandatory_arg_error
505        p_argument       => 'validation_start_date',
506        p_argument_value => p_validation_start_date);
507     --
508     hr_api.mandatory_arg_error
509       (p_api_name       => l_proc,
510        p_argument       => 'validation_end_date',
511        p_argument_value => p_validation_end_date);
512     --
513     If ((nvl(p_pl_id, hr_api.g_number) <> hr_api.g_number) and
514       NOT (dt_api.check_min_max_dates
515             (p_base_table_name => 'ben_pl_f',
516              p_base_key_column => 'pl_id',
517              p_base_key_value  => p_pl_id,
518              p_from_date       => p_validation_start_date,
519              p_to_date         => p_validation_end_date)))  Then
520       l_table_name := 'ben_pl_f';
521       Raise l_integrity_error;
522     End If;
523     --
524   End If;
525   --
526   hr_utility.set_location(' Leaving:'||l_proc, 10);
527 Exception
528   When l_integrity_error Then
529     --
530     -- A referential integrity check was violated therefore
531     -- we must error
532     --
533     ben_utility.parent_integrity_error(p_table_name => l_table_name);
534     --
535   When Others Then
536     --
537     -- An unhandled or unexpected error has occurred which
538     -- we must report
539     --
540     fnd_message.set_name('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
541     fnd_message.set_token('PROCEDURE', l_proc);
542     fnd_message.set_token('STEP','15');
543     fnd_message.raise_error;
544 End dt_update_validate;
545 --
546 -- ----------------------------------------------------------------------------
547 -- |--------------------------< dt_delete_validate >--------------------------|
548 -- ----------------------------------------------------------------------------
549 -- {Start Of Comments}
550 --
551 -- Description:
552 --   This procedure is used for referential integrity of datetracked
553 --   child entities when either a datetrack DELETE or ZAP is in operation
554 --   and where there is no cascading of delete defined for this entity.
555 --   For the datetrack mode of DELETE or ZAP we must ensure that no
556 --   datetracked child rows exist between the validation start and end
557 --   dates.
558 --
559 -- Prerequisites:
560 --   This procedure is called from the delete_validate.
561 --
562 -- In Parameters:
563 --
564 -- Post Success:
565 --   Processing continues.
566 --
567 -- Post Failure:
568 --   If a row exists by determining the returning Boolean value from the
569 --   generic dt_api.rows_exist function then we must supply an error via
570 --   the use of the local exception handler l_rows_exist.
571 --
572 -- Developer Implementation Notes:
573 --   This procedure should not need maintenance unless the HR Schema model
574 --   changes.
575 --
576 -- Access Status:
577 --   Internal Row Handler Use Only.
578 --
579 -- {End Of Comments}
580 -- ----------------------------------------------------------------------------
581 Procedure dt_delete_validate
582             (p_pl_bnf_ctfn_id		in number,
583              p_datetrack_mode		in varchar2,
584 	     p_validation_start_date	in date,
585 	     p_validation_end_date	in date) Is
586 --
587   l_proc	varchar2(72) 	:= g_package||'dt_delete_validate';
588   l_rows_exist	Exception;
589   l_table_name	all_tables.table_name%TYPE;
590 --
591 Begin
592   hr_utility.set_location('Entering:'||l_proc, 5);
593   --
594   -- Ensure that the p_datetrack_mode argument is not null
595   --
596   hr_api.mandatory_arg_error
597     (p_api_name       => l_proc,
598      p_argument       => 'datetrack_mode',
599      p_argument_value => p_datetrack_mode);
600   --
601   -- Only perform the validation if the datetrack mode is either
602   -- DELETE or ZAP
603   --
604   If (p_datetrack_mode = 'DELETE' or
605       p_datetrack_mode = 'ZAP') then
606     --
607     --
608     -- Ensure the arguments are not null
609     --
610     hr_api.mandatory_arg_error
611       (p_api_name       => l_proc,
612        p_argument       => 'validation_start_date',
613        p_argument_value => p_validation_start_date);
614     --
615     hr_api.mandatory_arg_error
616       (p_api_name       => l_proc,
617        p_argument       => 'validation_end_date',
618        p_argument_value => p_validation_end_date);
619     --
620     hr_api.mandatory_arg_error
621       (p_api_name       => l_proc,
622        p_argument       => 'pl_bnf_ctfn_id',
623        p_argument_value => p_pl_bnf_ctfn_id);
624     --
625     --
626     --
627   End If;
628   --
629   hr_utility.set_location(' Leaving:'||l_proc, 10);
630 Exception
631   When l_rows_exist Then
632     --
633     -- A referential integrity check was violated therefore
634     -- we must error
635     --
636     ben_utility.child_exists_error(p_table_name => l_table_name);
637     --
638   When Others Then
639     --
640     -- An unhandled or unexpected error has occurred which
641     -- we must report
642     --
643     fnd_message.set_name('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
644     fnd_message.set_token('PROCEDURE', l_proc);
645     fnd_message.set_token('STEP','15');
646     fnd_message.raise_error;
647 End dt_delete_validate;
648 --
649 -- ----------------------------------------------------------------------------
650 -- |---------------------------< insert_validate >----------------------------|
651 -- ----------------------------------------------------------------------------
652 Procedure insert_validate
656 	 p_validation_start_date in date,
653 	(p_rec 			 in ben_pcx_shd.g_rec_type,
654 	 p_effective_date	 in date,
655 	 p_datetrack_mode	 in varchar2,
657 	 p_validation_end_date	 in date) is
658 --
659   l_proc	varchar2(72) := g_package||'insert_validate';
660 --
661 Begin
662   hr_utility.set_location('Entering:'||l_proc, 5);
663   --
664   -- Call all supporting business operations
665   --
666   --
667   hr_api.validate_bus_grp_id(p_rec.business_group_id);  -- Validate Bus Grp
668   --
669   chk_pl_bnf_ctfn_id
670   (p_pl_bnf_ctfn_id          => p_rec.pl_bnf_ctfn_id,
671    p_effective_date        => p_effective_date,
672    p_object_version_number => p_rec.object_version_number);
673   --
674   chk_bnf_ctfn_typ_cd_unique
675   (p_pl_bnf_ctfn_id           => p_rec.pl_bnf_ctfn_id,
676    p_bnf_ctfn_typ_cd          => p_rec.bnf_ctfn_typ_cd,
677    p_rlshp_typ_cd             => p_rec.rlshp_typ_cd,
678    p_pl_id                    => p_rec.pl_id,
679    p_business_group_id        => p_rec.business_group_id,
680    p_validation_start_date    => p_validation_start_date,
681    p_validation_end_date      => p_validation_end_date);
682   --
683   chk_ctfn_rqd_when_rl
684   (p_pl_bnf_ctfn_id          => p_rec.pl_bnf_ctfn_id,
685    p_ctfn_rqd_when_rl        => p_rec.ctfn_rqd_when_rl,
686    p_effective_date        => p_effective_date,
687    p_business_group_id        =>  p_rec.business_group_id,
688    p_object_version_number => p_rec.object_version_number);
689   --
690   chk_pfd_flag
691   (p_pl_bnf_ctfn_id          => p_rec.pl_bnf_ctfn_id,
692    p_pfd_flag         => p_rec.pfd_flag,
693    p_effective_date        => p_effective_date,
694    p_object_version_number => p_rec.object_version_number);
695   --
696   chk_lack_ctfn_sspnd_enrt_flag
697   (p_pl_bnf_ctfn_id          => p_rec.pl_bnf_ctfn_id,
698    p_lack_ctfn_sspnd_enrt_flag         => p_rec.lack_ctfn_sspnd_enrt_flag,
699    p_effective_date        => p_effective_date,
700    p_object_version_number => p_rec.object_version_number);
701   --
702   chk_bnf_ctfn_typ_cd
703   (p_pl_bnf_ctfn_id          => p_rec.pl_bnf_ctfn_id,
704    p_bnf_ctfn_typ_cd         => p_rec.bnf_ctfn_typ_cd,
705    p_effective_date        => p_effective_date,
706    p_object_version_number => p_rec.object_version_number);
707   --
708   hr_utility.set_location(' Leaving:'||l_proc, 10);
709 End insert_validate;
710 --
711 -- ----------------------------------------------------------------------------
712 -- |---------------------------< update_validate >----------------------------|
713 -- ----------------------------------------------------------------------------
714 Procedure update_validate
715 	(p_rec 			 in ben_pcx_shd.g_rec_type,
716 	 p_effective_date	 in date,
717 	 p_datetrack_mode	 in varchar2,
718 	 p_validation_start_date in date,
719 	 p_validation_end_date	 in date) is
720 --
721   l_proc	varchar2(72) := g_package||'update_validate';
722 --
723 Begin
724   hr_utility.set_location('Entering:'||l_proc, 5);
725   --
726   -- Call all supporting business operations
727   --
728   --
729   hr_api.validate_bus_grp_id(p_rec.business_group_id);  -- Validate Bus Grp
730   --
731   chk_pl_bnf_ctfn_id
732   (p_pl_bnf_ctfn_id          => p_rec.pl_bnf_ctfn_id,
733    p_effective_date        => p_effective_date,
734    p_object_version_number => p_rec.object_version_number);
735   --
736   chk_bnf_ctfn_typ_cd_unique
737   (p_pl_bnf_ctfn_id           => p_rec.pl_bnf_ctfn_id,
738    p_bnf_ctfn_typ_cd          => p_rec.bnf_ctfn_typ_cd,
739    p_rlshp_typ_cd             => p_rec.rlshp_typ_cd,
740    p_pl_id                    => p_rec.pl_id,
741    p_business_group_id        => p_rec.business_group_id,
742    p_validation_start_date    => p_validation_start_date,
743    p_validation_end_date      => p_validation_end_date);
744   --
745   chk_ctfn_rqd_when_rl
746   (p_pl_bnf_ctfn_id          => p_rec.pl_bnf_ctfn_id,
747    p_ctfn_rqd_when_rl        => p_rec.ctfn_rqd_when_rl,
748    p_effective_date        => p_effective_date,
749    p_business_group_id        =>  p_rec.business_group_id,
750    p_object_version_number => p_rec.object_version_number);
751   --
752   chk_pfd_flag
753   (p_pl_bnf_ctfn_id          => p_rec.pl_bnf_ctfn_id,
754    p_pfd_flag         => p_rec.pfd_flag,
755    p_effective_date        => p_effective_date,
756    p_object_version_number => p_rec.object_version_number);
757   --
758   chk_lack_ctfn_sspnd_enrt_flag
759   (p_pl_bnf_ctfn_id          => p_rec.pl_bnf_ctfn_id,
760    p_lack_ctfn_sspnd_enrt_flag         => p_rec.lack_ctfn_sspnd_enrt_flag,
761    p_effective_date        => p_effective_date,
762    p_object_version_number => p_rec.object_version_number);
763   --
764   chk_bnf_ctfn_typ_cd
765   (p_pl_bnf_ctfn_id          => p_rec.pl_bnf_ctfn_id,
766    p_bnf_ctfn_typ_cd         => p_rec.bnf_ctfn_typ_cd,
767    p_effective_date        => p_effective_date,
768    p_object_version_number => p_rec.object_version_number);
769   --
770   -- Call the datetrack update integrity operation
771   --
772   dt_update_validate
773     (p_pl_id                         => p_rec.pl_id,
774      p_datetrack_mode                => p_datetrack_mode,
775      p_validation_start_date	     => p_validation_start_date,
776      p_validation_end_date	     => p_validation_end_date);
777   --
778   hr_utility.set_location(' Leaving:'||l_proc, 10);
779 End update_validate;
780 --
781 -- ----------------------------------------------------------------------------
782 -- |---------------------------< delete_validate >----------------------------|
783 -- ----------------------------------------------------------------------------
784 Procedure delete_validate
785 	(p_rec 			 in ben_pcx_shd.g_rec_type,
786 	 p_effective_date	 in date,
787 	 p_datetrack_mode	 in varchar2,
788 	 p_validation_start_date in date,
789 	 p_validation_end_date	 in date) is
790 --
791   l_proc	varchar2(72) := g_package||'delete_validate';
792 --
793 Begin
794   hr_utility.set_location('Entering:'||l_proc, 5);
795   --
796   -- Call all supporting business operations
797   --
798   dt_delete_validate
799     (p_datetrack_mode		=> p_datetrack_mode,
800      p_validation_start_date	=> p_validation_start_date,
801      p_validation_end_date	=> p_validation_end_date,
802      p_pl_bnf_ctfn_id		=> p_rec.pl_bnf_ctfn_id);
803   --
804   hr_utility.set_location(' Leaving:'||l_proc, 10);
805 End delete_validate;
806 --
807 --
808 --  ---------------------------------------------------------------------------
809 --  |---------------------< return_legislation_code >-------------------------|
810 --  ---------------------------------------------------------------------------
811 --
812 function return_legislation_code
813   (p_pl_bnf_ctfn_id in number) return varchar2 is
814   --
815   -- Declare cursor
816   --
817   cursor csr_leg_code is
818     select a.legislation_code
819     from   per_business_groups a,
820            ben_pl_bnf_ctfn_f b
821     where b.pl_bnf_ctfn_id      = p_pl_bnf_ctfn_id
822     and   a.business_group_id = b.business_group_id;
823   --
824   -- Declare local variables
825   --
826   l_legislation_code  varchar2(150);
827   l_proc              varchar2(72)  :=  g_package||'return_legislation_code';
828   --
829 begin
830   --
831   hr_utility.set_location('Entering:'|| l_proc, 10);
832   --
833   -- Ensure that all the mandatory parameter are not null
834   --
835   hr_api.mandatory_arg_error(p_api_name       => l_proc,
836                              p_argument       => 'pl_bnf_ctfn_id',
837                              p_argument_value => p_pl_bnf_ctfn_id);
838   --
839   open csr_leg_code;
840     --
841     fetch csr_leg_code into l_legislation_code;
842     --
843     if csr_leg_code%notfound then
844       --
845       close csr_leg_code;
846       --
847       -- The primary key is invalid therefore we must error
848       --
849       fnd_message.set_name('PAY','HR_7220_INVALID_PRIMARY_KEY');
850       fnd_message.raise_error;
851       --
852     end if;
853     --
854   close csr_leg_code;
855   --
856   hr_utility.set_location(' Leaving:'|| l_proc, 20);
857   --
858   return l_legislation_code;
859   --
860 end return_legislation_code;
861 --
862 end ben_pcx_bus;