DBA Data[Home] [Help]

PACKAGE BODY: APPS.BEN_ETW_BUS

Source


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