DBA Data[Home] [Help]

PACKAGE BODY: APPS.BEN_LOR_BUS

Source


1 Package Body ben_lor_bus as
2 /* $Header: belorrhi.pkb 115.8 2002/12/13 06:19:10 hmani ship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33)	:= '  ben_lor_bus.';  -- Global package name
9 --
10 -- ----------------------------------------------------------------------------
11 -- |------< chk_ler_chg_plip_enrt_rl_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_chg_plip_enrt_rl_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_chg_plip_enrt_rl_id(p_ler_chg_plip_enrt_rl_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_chg_plip_enrt_rl_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_lor_shd.api_updating
49     (p_effective_date              => p_effective_date,
50      p_ler_chg_plip_enrt_rl_id                => p_ler_chg_plip_enrt_rl_id,
51      p_object_version_number       => p_object_version_number);
52   --
53   if (l_api_updating
54      and nvl(p_ler_chg_plip_enrt_rl_id,hr_api.g_number)
55      <>  ben_lor_shd.g_old_rec.ler_chg_plip_enrt_rl_id) then
56     --
57     -- raise error as PK has changed
58     --
59     ben_lor_shd.constraint_error('BEN_LER_CHG_PLIP_EN_RL_PK');
60     --
61   elsif not l_api_updating then
62     --
63     -- check if PK is null
64     --
65     if p_ler_chg_plip_enrt_rl_id is not null then
66       --
67       -- raise error as PK is not null
68       --
69       ben_lor_shd.constraint_error('BEN_LER_CHG_PLIP_EN_RL_PK');
70       --
71     end if;
72     --
73   end if;
74   --
75   hr_utility.set_location('Leaving:'||l_proc, 10);
76   --
77 End chk_ler_chg_plip_enrt_rl_id;
78 --
79 -- ----------------------------------------------------------------------------
80 -- |------< chk_ordr_to_aply_num >------|
81 -- ----------------------------------------------------------------------------
82 --
83 -- Description
84 --   This procedure is used to ensure that the value is unique within parent
85 --   and within bus grp.
86 --
87 -- Pre Conditions
88 --   None.
89 --
90 -- In Parameters
91 --   effective_date effective date
92 --   object_version_number Object version number of record being
93 --                         inserted or updated.
94 --
95 -- Post Success
96 --   Processing continues
97 --
98 -- Post Failure
99 --   Error handled by procedure
100 --
101 -- Access Status
102 --   Internal table handler use only.
103 --
104 Procedure chk_ordr_to_aply_num(p_ler_chg_plip_enrt_rl_id    in number,
105                             p_ler_chg_plip_enrt_id    in number,
106                             p_ordr_to_aply_num              in number,
107                             p_effective_date              in date,
108 				    p_validation_start_date         in date,
109                             p_validation_end_date           in date,
110                             p_business_group_id           in number,
111                             p_object_version_number       in number) is
112 
113 
114  --
115   l_proc         varchar2(72) := g_package||'chk_ler_id';
116   l_api_updating boolean;
117   l_exists       varchar2(1);
118   --
119   -- unique in bg, parent, and eff dates
120   --
121   cursor chk_unique is
122      select null
123         from ben_ler_chg_plip_enrt_rl_f
124         where ordr_to_aply_num = p_ordr_to_aply_num
125           and ler_chg_plip_enrt_rl_id <> nvl(p_ler_chg_plip_enrt_rl_id, hr_api.g_number)
126           and ler_chg_plip_enrt_id = p_ler_chg_plip_enrt_id  --parent
127           and business_group_id + 0 = p_business_group_id
128           and p_validation_start_date <= effective_end_date
129           and p_validation_end_date >= effective_start_date;
130   --
131 Begin
132   --
133   hr_utility.set_location('Entering:'||l_proc, 5);
134   --
135   l_api_updating := ben_lor_shd.api_updating
136     (p_ler_chg_plip_enrt_rl_id   => p_ler_chg_plip_enrt_rl_id  ,
137      p_effective_date              => p_effective_date,
138      p_object_version_number       => p_object_version_number);
139   --
140   if (l_api_updating
141       and p_ordr_to_aply_num
142       <> nvl(ben_lor_shd.g_old_rec.ordr_to_aply_num,hr_api.g_number)
143       or not l_api_updating) then
144     --
145     -- this value must be unique
146     --
147     open chk_unique;
148     fetch chk_unique into l_exists;
149     if chk_unique%found then
150       close chk_unique;
151       --
152       -- raise error as UK1 is violated
153       --
154       fnd_message.set_name('PAY','VALUE IS NOT UNIQUE');
155       fnd_message.raise_error;
156       --
157     end if;
158     --
159     close chk_unique;
160     --
161   end if;
162   --
163   hr_utility.set_location('Leaving:'||l_proc,10);
164   --
165 end chk_ordr_to_aply_num;
166 --
167 -- ----------------------------------------------------------------------------
168 -- |------< chk_formula_id >------|
169 -- ----------------------------------------------------------------------------
170 --
171 -- Description
172 --   This procedure is used to ensure that the value is unique within parent
173 --   and within bus grp.
174 --
175 -- Pre Conditions
176 --   None.
177 --
178 -- In Parameters
179 --   effective_date effective date
180 --   object_version_number Object version number of record being
181 --                         inserted or updated.
182 --
183 -- Post Success
184 --   Processing continues
185 --
186 -- Post Failure
187 --   Error handled by procedure
188 --
189 -- Access Status
190 --   Internal table handler use only.
191 --
192 Procedure chk_formula_id(p_ler_chg_plip_enrt_rl_id    in number,
193                             p_ler_chg_plip_enrt_id    in number,
194                             p_formula_id              in number,
195                             p_effective_date              in date,
196 				    p_validation_start_date         in date,
197                             p_validation_end_date           in date,
198                             p_business_group_id           in number,
199                             p_object_version_number       in number) is
200 
201 
202  --
203   l_proc         varchar2(72) := g_package||'chk_ler_id';
204   l_api_updating boolean;
205   l_exists       varchar2(1);
206   --
207   -- unique in bg, parent, and eff dates
208   --
209   cursor chk_unique is
210      select null
211         from ben_ler_chg_plip_enrt_rl_f
212         where formula_id = p_formula_id
213           and ler_chg_plip_enrt_rl_id <> nvl(p_ler_chg_plip_enrt_rl_id, hr_api.g_number)
214           and ler_chg_plip_enrt_id = p_ler_chg_plip_enrt_id  --parent
215           and business_group_id + 0 = p_business_group_id
216           and p_validation_start_date <= effective_end_date
217           and p_validation_end_date >= effective_start_date;
218   --
219 Begin
220   --
221   hr_utility.set_location('Entering:'||l_proc, 5);
222   --
223   l_api_updating := ben_lor_shd.api_updating
224     (p_ler_chg_plip_enrt_rl_id   => p_ler_chg_plip_enrt_rl_id  ,
225      p_effective_date              => p_effective_date,
226      p_object_version_number       => p_object_version_number);
227   --
228   if (l_api_updating
229       and p_formula_id
230       <> nvl(ben_lor_shd.g_old_rec.formula_id,hr_api.g_number)
231       or not l_api_updating) then
232     --
233     -- check if value of lookup falls within lookup type.
234     --
235     -- this value must be unique
236     --
237     open chk_unique;
238     fetch chk_unique into l_exists;
239     if chk_unique%found then
240       close chk_unique;
241       --
242       -- raise error as UK1 is violated
243       --
244       fnd_message.set_name('PAY','VALUE IS NOT UNIQUE');
245       fnd_message.raise_error;
246       --
247     end if;
248     --
249     close chk_unique;
250     --
251   end if;
252   --
253   hr_utility.set_location('Leaving:'||l_proc,10);
254   --
255 end chk_formula_id;
256 --
257 -- ----------------------------------------------------------------------------
258 -- |--------------------< chk_valid_formula_id >----------------------------|
259 -- ----------------------------------------------------------------------------
260 --
261 -- Description
262 --   This procedure is used to check that the Formula Rule is valid.
263 --
264 -- Pre Conditions
265 --   None.
266 --
267 -- In Parameters
268 --   ler_chg_plip_enrt_rl_id      PK of record being inserted or updated.
269 --   formula_id                   Value of formula rule id.
270 --   effective_date               effective date
271 --   object_version_number        Object version number of record being
272 --                                 inserted or updated.
273 --
274 -- Post Success
275 --   Processing continues
276 --
277 -- Post Failure
278 --   Error handled by procedure
279 --
280 -- Access Status
281 --   Internal table handler use only.
285                                  p_formula_id                  in number,
282 --
283 Procedure chk_valid_formula_id(p_ler_chg_plip_enrt_rl_id       in number,
284                                  p_business_group_id           in number,
286                                  p_effective_date              in date,
287                                  p_object_version_number       in number) is
288   --
289   l_proc         varchar2(72) := g_package||'chk_valid_formula_id';
290   l_api_updating boolean;
291   l_dummy        varchar2(1);
292   --
293   cursor c1 is
294     select null
295     from   ff_formulas_f ff
296            ,per_business_groups pbg
297     where  ff.formula_id = p_formula_id
298     and    ff.formula_type_id = -393
299     and    pbg.business_group_id = p_business_group_id
300     and    nvl(ff.business_group_id, p_business_group_id) =
301                p_business_group_id
302     and    nvl(ff.legislation_code, pbg.legislation_code) =
303                pbg.legislation_code
304     and    p_effective_date
305            between ff.effective_start_date
306            and     ff.effective_end_date;
307   --
308 Begin
309   --
310   hr_utility.set_location('Entering:'||l_proc, 5);
311   --
312   l_api_updating := ben_lor_shd.api_updating
313     (p_ler_chg_plip_enrt_rl_id     => p_ler_chg_plip_enrt_rl_id,
314      p_effective_date              => p_effective_date,
315      p_object_version_number       => p_object_version_number);
316   --
317   if (l_api_updating
318       and nvl(p_formula_id ,hr_api.g_number)
319       <> ben_lor_shd.g_old_rec.formula_id
320       or not l_api_updating)
321       and p_formula_id  is not null then
322     --
323     -- check if value of formula rule is valid.
324     --
325     open c1;
326       --
327       -- fetch value from cursor if it returns a record then the
328       -- formula is valid otherwise its invalid
329       --
330       fetch c1 into l_dummy;
331       if c1%notfound then
332         --
333         close c1;
334         --
335         -- raise error
336         --
337         fnd_message.set_name('BEN','BEN_91007_INVALID_RULE');
338         fnd_message.raise_error;
339         --
340       end if;
341       --
342     close c1;
343     --
344   end if;
345   --
346   hr_utility.set_location('Leaving:'||l_proc,10);
347   --
348 end chk_valid_formula_id ;
349 --
350 -- ----------------------------------------------------------------------------
351 -- |--------------------------< dt_update_validate >--------------------------|
352 -- ----------------------------------------------------------------------------
353 -- {Start Of Comments}
354 --
355 -- Description:
356 --   This procedure is used for referential integrity of datetracked
357 --   parent entities when a datetrack update operation is taking place
358 --   and where there is no cascading of update defined for this entity.
359 --
360 -- Prerequisites:
361 --   This procedure is called from the update_validate.
362 --
363 -- In Parameters:
364 --
365 -- Post Success:
366 --   Processing continues.
367 --
368 -- Post Failure:
369 --
370 -- Developer Implementation Notes:
371 --   This procedure should not need maintenance unless the HR Schema model
372 --   changes.
373 --
374 -- Access Status:
375 --   Internal Row Handler Use Only.
376 --
377 -- {End Of Comments}
378 -- ----------------------------------------------------------------------------
379 Procedure dt_update_validate
380             (p_formula_id           in number default hr_api.g_number,
381              p_ler_chg_plip_enrt_id          in number default hr_api.g_number,
382 	     p_datetrack_mode		     in varchar2,
383              p_validation_start_date	     in date,
384 	     p_validation_end_date	     in date) Is
385 --
386   l_proc	    varchar2(72) := g_package||'dt_update_validate';
387   l_integrity_error Exception;
388   l_table_name	    all_tables.table_name%TYPE;
389 --
390 Begin
391   hr_utility.set_location('Entering:'||l_proc, 5);
392   --
393   -- Ensure that the p_datetrack_mode argument is not null
394   --
395   hr_api.mandatory_arg_error
396     (p_api_name       => l_proc,
397      p_argument       => 'datetrack_mode',
398      p_argument_value => p_datetrack_mode);
399   --
400   -- Only perform the validation if the datetrack update mode is valid
401   --
402   If (dt_api.validate_dt_upd_mode(p_datetrack_mode => p_datetrack_mode)) then
403     --
404     --
405     -- Ensure the arguments are not null
406     --
407     hr_api.mandatory_arg_error
408       (p_api_name       => l_proc,
409        p_argument       => 'validation_start_date',
410        p_argument_value => p_validation_start_date);
411     --
412     hr_api.mandatory_arg_error
413       (p_api_name       => l_proc,
414        p_argument       => 'validation_end_date',
415        p_argument_value => p_validation_end_date);
416     --
417     If ((nvl(p_formula_id, hr_api.g_number) <> hr_api.g_number) and
418       NOT (dt_api.check_min_max_dates
419             (p_base_table_name => 'ff_formulas_f',
420              p_base_key_column => 'formula_id',
421              p_base_key_value  => p_formula_id,
422              p_from_date       => p_validation_start_date,
423              p_to_date         => p_validation_end_date)))  Then
424       l_table_name := 'ff_formulas_f';
425       Raise l_integrity_error;
426     End If;
427     If ((nvl(p_ler_chg_plip_enrt_id, hr_api.g_number) <> hr_api.g_number) and
428       NOT (dt_api.check_min_max_dates
429             (p_base_table_name => 'ben_ler_chg_plip_enrt_f',
430              p_base_key_column => 'ler_chg_plip_enrt_id',
431              p_base_key_value  => p_ler_chg_plip_enrt_id,
432              p_from_date       => p_validation_start_date,
433              p_to_date         => p_validation_end_date)))  Then
434       l_table_name := 'ben_ler_chg_plip_enrt_f';
435       Raise l_integrity_error;
436     End If;
437     --
438   End If;
439   --
440   hr_utility.set_location(' Leaving:'||l_proc, 10);
441 Exception
442   When l_integrity_error Then
443     --
444     -- A referential integrity check was violated therefore
445     -- we must error
446     --
447     ben_utility.parent_integrity_error(p_table_name => l_table_name);
448   When Others Then
449     --
450     -- An unhandled or unexpected error has occurred which
451     -- we must report
452     --
453     fnd_message.set_name('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
454     fnd_message.set_token('PROCEDURE', l_proc);
455     fnd_message.set_token('STEP','15');
456     fnd_message.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_chg_plip_enrt_rl_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_chg_plip_enrt_rl_id',
536        p_argument_value => p_ler_chg_plip_enrt_rl_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     ben_utility.child_exists_error(p_table_name => l_table_name);
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_lor_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_chg_plip_enrt_rl_id
582   (p_ler_chg_plip_enrt_rl_id          => p_rec.ler_chg_plip_enrt_rl_id,
583    p_effective_date        => p_effective_date,
584    p_object_version_number => p_rec.object_version_number);
585  --
586   chk_ordr_to_aply_num
587   (p_ler_chg_plip_enrt_rl_id     => p_rec.ler_chg_plip_enrt_rl_id,
588    p_ler_chg_plip_enrt_id     => p_rec.ler_chg_plip_enrt_id,
589    p_ordr_to_aply_num        => p_rec.ordr_to_aply_num,
590    p_effective_date        => p_effective_date,
591    p_validation_start_date  =>    p_validation_start_date,
592    p_validation_end_date      =>  p_validation_end_date,
593    p_business_group_id        =>  p_rec.business_group_id,
594    p_object_version_number => p_rec.object_version_number);
595   --
596   chk_formula_id
597   (p_ler_chg_plip_enrt_rl_id     => p_rec.ler_chg_plip_enrt_rl_id,
598    p_ler_chg_plip_enrt_id     => p_rec.ler_chg_plip_enrt_id,
599    p_formula_id        => p_rec.formula_id,
600    p_effective_date        => p_effective_date,
601    p_validation_start_date  =>    p_validation_start_date,
602    p_validation_end_date      =>  p_validation_end_date,
603    p_business_group_id        =>  p_rec.business_group_id,
604    p_object_version_number => p_rec.object_version_number);
605   --
606   chk_valid_formula_id
607   (p_ler_chg_plip_enrt_rl_id     => p_rec.ler_chg_plip_enrt_rl_id,
608    p_business_group_id           => p_rec.business_group_id,
612   --
609    p_formula_id                  => p_rec.formula_id,
610    p_effective_date              => p_effective_date,
611    p_object_version_number       => p_rec.object_version_number);
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_lor_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_chg_plip_enrt_rl_id
637   (p_ler_chg_plip_enrt_rl_id          => p_rec.ler_chg_plip_enrt_rl_id,
638    p_effective_date        => p_effective_date,
639    p_object_version_number => p_rec.object_version_number);
640  --
641   chk_ordr_to_aply_num
642   (p_ler_chg_plip_enrt_rl_id     => p_rec.ler_chg_plip_enrt_rl_id,
643    p_ler_chg_plip_enrt_id     => p_rec.ler_chg_plip_enrt_id,
644    p_ordr_to_aply_num        => p_rec.ordr_to_aply_num,
645    p_effective_date        => p_effective_date,
646    p_validation_start_date  =>    p_validation_start_date,
647    p_validation_end_date      =>  p_validation_end_date,
648    p_business_group_id        =>  p_rec.business_group_id,
649    p_object_version_number => p_rec.object_version_number);
650   --
651   chk_formula_id
652   (p_ler_chg_plip_enrt_rl_id     => p_rec.ler_chg_plip_enrt_rl_id,
653    p_ler_chg_plip_enrt_id     => p_rec.ler_chg_plip_enrt_id,
654    p_formula_id        => p_rec.formula_id,
655    p_effective_date        => p_effective_date,
656    p_validation_start_date  =>    p_validation_start_date,
657    p_validation_end_date      =>  p_validation_end_date,
658    p_business_group_id        =>  p_rec.business_group_id,
659    p_object_version_number => p_rec.object_version_number);
660   --
661   chk_valid_formula_id
662   (p_ler_chg_plip_enrt_rl_id     => p_rec.ler_chg_plip_enrt_rl_id,
663    p_business_group_id           => p_rec.business_group_id,
664    p_formula_id                  => p_rec.formula_id,
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_formula_id           => p_rec.formula_id,
672              p_ler_chg_plip_enrt_id          => p_rec.ler_chg_plip_enrt_id,
673      p_datetrack_mode                => p_datetrack_mode,
674      p_validation_start_date	     => p_validation_start_date,
675      p_validation_end_date	     => p_validation_end_date);
676   --
677   hr_utility.set_location(' Leaving:'||l_proc, 10);
678 End update_validate;
679 --
680 -- ----------------------------------------------------------------------------
681 -- |---------------------------< delete_validate >----------------------------|
682 -- ----------------------------------------------------------------------------
683 Procedure delete_validate
684 	(p_rec 			 in ben_lor_shd.g_rec_type,
685 	 p_effective_date	 in date,
686 	 p_datetrack_mode	 in varchar2,
687 	 p_validation_start_date in date,
688 	 p_validation_end_date	 in date) is
689 --
690   l_proc	varchar2(72) := g_package||'delete_validate';
691 --
692 Begin
693   hr_utility.set_location('Entering:'||l_proc, 5);
694   --
695   -- Call all supporting business operations
696   --
697   dt_delete_validate
698     (p_datetrack_mode		=> p_datetrack_mode,
699      p_validation_start_date	=> p_validation_start_date,
700      p_validation_end_date	=> p_validation_end_date,
701      p_ler_chg_plip_enrt_rl_id		=> p_rec.ler_chg_plip_enrt_rl_id);
702   --
703   hr_utility.set_location(' Leaving:'||l_proc, 10);
704 End delete_validate;
705 --
706 --
707 --  ---------------------------------------------------------------------------
708 --  |---------------------< return_legislation_code >-------------------------|
709 --  ---------------------------------------------------------------------------
710 --
711 function return_legislation_code
712   (p_ler_chg_plip_enrt_rl_id in number) return varchar2 is
713   --
714   -- Declare cursor
715   --
716   cursor csr_leg_code is
717     select a.legislation_code
718     from   per_business_groups a,
719            ben_ler_chg_plip_enrt_rl_f b
720     where b.ler_chg_plip_enrt_rl_id      = p_ler_chg_plip_enrt_rl_id
721     and   a.business_group_id = b.business_group_id;
722   --
723   -- Declare local variables
724   --
725   l_legislation_code  varchar2(150);
726   l_proc              varchar2(72)  :=  g_package||'return_legislation_code';
727   --
728 begin
729   --
730   hr_utility.set_location('Entering:'|| l_proc, 10);
731   --
732   -- Ensure that all the mandatory parameter are not null
733   --
734   hr_api.mandatory_arg_error(p_api_name       => l_proc,
735                              p_argument       => 'ler_chg_plip_enrt_rl_id',
736                              p_argument_value => p_ler_chg_plip_enrt_rl_id);
737   --
738   open csr_leg_code;
739     --
740     fetch csr_leg_code into l_legislation_code;
741     --
742     if csr_leg_code%notfound then
743       --
744       close csr_leg_code;
745       --
746       -- The primary key is invalid therefore we must error
747       --
748       fnd_message.set_name('PAY','HR_7220_INVALID_PRIMARY_KEY');
749       fnd_message.raise_error;
750       --
751     end if;
752     --
753   close csr_leg_code;
754   --
755   hr_utility.set_location(' Leaving:'|| l_proc, 20);
756   --
757   return l_legislation_code;
758   --
759 end return_legislation_code;
760 --
761 end ben_lor_bus;