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