DBA Data[Home] [Help]

PACKAGE BODY: APPS.BEN_EDG_BUS

Source


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