DBA Data[Home] [Help]

PACKAGE BODY: APPS.BEN_PCS_BUS

Source


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