DBA Data[Home] [Help]

PACKAGE BODY: APPS.BEN_ECF_BUS

Source


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