DBA Data[Home] [Help]

PACKAGE BODY: APPS.BEN_EOP_BUS

Source


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