DBA Data[Home] [Help]

PACKAGE BODY: APPS.BEN_EWL_BUS

Source


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