DBA Data[Home] [Help]

PACKAGE BODY: APPS.BEN_LBC_BUS

Source


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