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