DBA Data[Home] [Help]

PACKAGE BODY: APPS.BEN_WCN_BUS

Source


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