DBA Data[Home] [Help]

PACKAGE BODY: APPS.BEN_EEI_BUS

Source


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