DBA Data[Home] [Help]

PACKAGE BODY: APPS.BEN_CPC_BUS

Source


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