DBA Data[Home] [Help]

PACKAGE BODY: APPS.BEN_EHC_BUS

Source


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