DBA Data[Home] [Help]

PACKAGE BODY: APPS.BEN_EPZ_BUS

Source


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