DBA Data[Home] [Help]

PACKAGE BODY: APPS.BEN_LNC_BUS

Source


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