[Home] [Help]
PACKAGE BODY: APPS.BEN_LRC_BUS
Source
1 Package Body ben_lrc_bus as
2 /* $Header: belrcrhi.pkb 115.9 2004/01/25 00:24:37 hmani ship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- | Private Global Definitions |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package varchar2(33) := ' ben_lrc_bus.'; -- Global package name
9 --
10 -- ----------------------------------------------------------------------------
11 -- |------< chk_ler_rltd_per_cs_ler_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 -- ler_rltd_per_cs_ler_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_ler_rltd_per_cs_ler_id(p_ler_rltd_per_cs_ler_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_ler_rltd_per_cs_ler_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_lrc_shd.api_updating
49 (p_effective_date => p_effective_date,
50 p_ler_rltd_per_cs_ler_id => p_ler_rltd_per_cs_ler_id,
51 p_object_version_number => p_object_version_number);
52 --
53 if (l_api_updating
54 and nvl(p_ler_rltd_per_cs_ler_id,hr_api.g_number)
55 <> ben_lrc_shd.g_old_rec.ler_rltd_per_cs_ler_id) then
56 --
57 -- raise error as PK has changed
58 --
59 ben_lrc_shd.constraint_error('BEN_LER_RTLD_PER_CS_LER_F_PK');
60 --
61 elsif not l_api_updating then
62 --
63 -- check if PK is null
64 --
65 if p_ler_rltd_per_cs_ler_id is not null then
66 --
67 -- raise error as PK is not null
68 --
69 ben_lrc_shd.constraint_error('BEN_LER_RTLD_PER_CS_LER_F_PK');
70 --
71 end if;
72 --
73 end if;
74 --
75 hr_utility.set_location('Leaving:'||l_proc, 10);
76 --
77 End chk_ler_rltd_per_cs_ler_id;
78 --
79 -- ----------------------------------------------------------------------------
80 -- |------< chk_rltd_per_chg_cs_ler_id >------|
81 -- ----------------------------------------------------------------------------
82 --
83 -- Description
84 -- This procedure checks that a referenced foreign key actually exists
85 -- in the referenced table and that the key is entered.
86 --
87 -- Pre-Conditions
88 -- None.
89 --
90 -- In Parameters
91 -- p_ler_rltd_per_cs_ler_id PK
92 -- p_rltd_per_chg_cs_ler_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_rltd_per_chg_cs_ler_id (p_ler_rltd_per_cs_ler_id in number,
106 p_rltd_per_chg_cs_ler_id in number,
107 p_ler_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_rltd_per_chg_cs_ler_id';
115 l_api_updating boolean;
116 l_dummy varchar2(1);
117 --
118 cursor c1 is
119 select null
120 from ben_rltd_per_chg_cs_ler_f a
121 where a.rltd_per_chg_cs_ler_id = p_rltd_per_chg_cs_ler_id
122 and p_effective_date between effective_start_date
123 and effective_end_date;
124 --
125 CURSOR c2 (p_ler_rltd_per_cs_ler_id number
126 ,p_ler_id number
127 ,p_rltd_per_chg_cs_ler_id number
128 ,p_business_group_id number
129 ,p_validation_start_date date
130 ,p_validation_end_date date) IS
131 SELECT 'x'
132 FROM ben_ler_rltd_per_cs_ler_f
133 WHERE ler_rltd_per_cs_ler_id <> nvl(p_ler_rltd_per_cs_ler_id, hr_api.g_number)
134 AND rltd_per_chg_cs_ler_id = p_rltd_per_chg_cs_ler_id
135 AND ler_id = p_ler_id
136 AND business_group_id + 0 = p_business_group_id
137 AND p_validation_start_date <= effective_end_date
138 AND p_validation_end_date >= effective_start_date;
139 --
140 Begin
141 --
142 hr_utility.set_location('Entering:'||l_proc,5);
143
144 if p_rltd_per_chg_cs_ler_id is null then
145 fnd_message.set_name('BEN', 'BEN_91016_PERSON_CHANGE_REQ');
146 fnd_message.raise_error;
147 end if;
148 --
149 l_api_updating := ben_lrc_shd.api_updating
150 (p_ler_rltd_per_cs_ler_id => p_ler_rltd_per_cs_ler_id,
151 p_effective_date => p_effective_date,
152 p_object_version_number => p_object_version_number);
153
154 --
155 if (l_api_updating
156 and nvl(p_rltd_per_chg_cs_ler_id,hr_api.g_number)
157 <> nvl(ben_lrc_shd.g_old_rec.rltd_per_chg_cs_ler_id,hr_api.g_number)
158 or not l_api_updating) then
159 --
160 -- check if rltd_per_chg_cs_ler_id value exists in
161 -- ben_rltd_per_chg_cs_ler_f table
162 --
163 open c1;
164 fetch c1 into l_dummy;
165 if c1%notfound then
166 close c1;
167 -- raise error as FK does not relate to PK in ben_rltd_per_chg_cs_ler_f
168 -- table.
169 ben_lrc_shd.constraint_error('BEN_LER_RLTD_PER_CS_LER_F_FK2');
170 end if;
171 close c1;
172 -- check if the foreign key is unique for this ler.
173 open c2
174 (p_ler_rltd_per_cs_ler_id => p_ler_rltd_per_cs_ler_id
175 ,p_ler_id => p_ler_id
176 ,p_rltd_per_chg_cs_ler_id => p_rltd_per_chg_cs_ler_id
177 ,p_business_group_id => p_business_group_id
178 ,p_validation_start_date => p_validation_start_date
179 ,p_validation_end_date => p_validation_end_date) ;
180
181 fetch c2 into l_dummy;
182 if c2%found then
183 close c2;
184 fnd_message.set_name('BEN', 'BEN_91017_PERSON_CHANGE_UNIQUE');
185 fnd_message.raise_error;
186 end if;
187 close c2;
188 --
189 --
190 end if;
191 --
192 hr_utility.set_location('Leaving:'||l_proc,10);
193 --
194 End chk_rltd_per_chg_cs_ler_id;
195 --
196 -- ----------------------------------------------------------------------------
197 -- |------< chk_ler_rltd_per_cs_chg_rl >------|
198 -- ----------------------------------------------------------------------------
199 --
200 -- Description
201 -- This procedure is used to check that the Formula Rule is valid.
202 --
203 -- Pre Conditions
204 -- None.
205 --
206 -- In Parameters
207 -- ler_rltd_per_cs_ler_id PK of record being inserted or updated.
208 -- ler_rltd_per_cs_chg_rl Value of formula rule id.
209 -- effective_date effective date
210 -- object_version_number Object version number of record being
211 -- inserted or updated.
212 --
213 -- Post Success
214 -- Processing continues
215 --
216 -- Post Failure
217 -- Error handled by procedure
218 --
219 -- Access Status
220 -- Internal table handler use only.
221 --
222 Procedure chk_ler_rltd_per_cs_chg_rl(p_ler_rltd_per_cs_ler_id in number,
223 p_ler_rltd_per_cs_chg_rl in number,
224 p_business_group_id in number,
225 p_effective_date in date,
226 p_object_version_number in number) is
227 --
228 l_proc varchar2(72) := g_package||'chk_ler_rltd_per_cs_chg_rl';
229 l_api_updating boolean;
230 l_dummy varchar2(1);
231 --
232 cursor c1 is
233 select null
234 from ff_formulas_f ff
235 ,per_business_groups pbg
236 where ff.formula_id = p_ler_rltd_per_cs_chg_rl
237 and ff.formula_type_id = -168 -- Person Information Causes Life Event
238 and pbg.business_group_id = p_business_group_id
239 and nvl(ff.business_group_id, p_business_group_id) = p_business_group_id
240 and nvl(ff.legislation_code, pbg.legislation_code) = pbg.legislation_code
241 and p_effective_date
242 between ff.effective_start_date
243 and ff.effective_end_date;
244 --
245 Begin
246 --
247 hr_utility.set_location('Entering:'||l_proc, 5);
248 --
249 l_api_updating := ben_lrc_shd.api_updating
250 (p_ler_rltd_per_cs_ler_id => p_ler_rltd_per_cs_ler_id,
251 p_effective_date => p_effective_date,
252 p_object_version_number => p_object_version_number);
253 --
254 if (l_api_updating
255 and nvl(p_ler_rltd_per_cs_chg_rl,hr_api.g_number)
256 <> ben_lrc_shd.g_old_rec.ler_rltd_per_cs_chg_rl
257 or not l_api_updating)
258 and p_ler_rltd_per_cs_chg_rl is not null then
259 --
260 -- check if value of formula rule is valid.
261 --
262 open c1;
263 --
264 -- fetch value from cursor if it returns a record then the
265 -- formula is valid otherwise its invalid
266 --
267 fetch c1 into l_dummy;
268 if c1%notfound or c1%notfound is null then
269 --
270 close c1;
271 --
272 -- raise error
273 --
274 fnd_message.set_name('BEN','BEN_91007_INVALID_RULE');
275 fnd_message.raise_error;
276 --
277 end if;
278 --
279 close c1;
280 --
281 end if;
282 --
283 hr_utility.set_location('Leaving:'||l_proc,10);
284 --
285 end chk_ler_rltd_per_cs_chg_rl;
286 --
287 -- ----------------------------------------------------------------------------
288 -- |--------------------------< dt_update_validate >--------------------------|
289 -- ----------------------------------------------------------------------------
290 -- {Start Of Comments}
291 --
292 -- Description:
293 -- This procedure is used for referential integrity of datetracked
294 -- parent entities when a datetrack update operation is taking place
295 -- and where there is no cascading of update defined for this entity.
296 --
297 -- Prerequisites:
298 -- This procedure is called from the update_validate.
299 --
300 -- In Parameters:
301 --
302 -- Post Success:
303 -- Processing continues.
304 --
305 -- Post Failure:
306 --
307 -- Developer Implementation Notes:
308 -- This procedure should not need maintenance unless the HR Schema model
309 -- changes.
310 --
311 -- Access Status:
312 -- Internal Row Handler Use Only.
313 --
314 -- {End Of Comments}
315 -- ----------------------------------------------------------------------------
316 Procedure dt_update_validate
317 (p_formula_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_formula_id, hr_api.g_number) <> hr_api.g_number) and
354 NOT (dt_api.check_min_max_dates
355 (p_base_table_name => 'ff_formulas_f',
356 p_base_key_column => 'formula_id',
357 p_base_key_value => p_formula_id,
358 p_from_date => p_validation_start_date,
359 p_to_date => p_validation_end_date))) Then
360 l_table_name := 'ff_formulas_f';
361 Raise l_integrity_error;
362 End If;
363 --
364 End If;
365 --
366 hr_utility.set_location(' Leaving:'||l_proc, 10);
367 Exception
368 When l_integrity_error Then
369 --
370 -- A referential integrity check was violated therefore
371 -- we must error
372 --
373 ben_utility.parent_integrity_error(p_table_name => l_table_name);
374 When Others Then
375 --
376 -- An unhandled or unexpected error has occurred which
377 -- we must report
378 --
379 fnd_message.set_name('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
380 fnd_message.set_token('PROCEDURE', l_proc);
381 fnd_message.set_token('STEP','15');
382 fnd_message.raise_error;
383 End dt_update_validate;
384 --
385 -- ----------------------------------------------------------------------------
386 -- |--------------------------< dt_delete_validate >--------------------------|
387 -- ----------------------------------------------------------------------------
388 -- {Start Of Comments}
389 --
390 -- Description:
391 -- This procedure is used for referential integrity of datetracked
392 -- child entities when either a datetrack DELETE or ZAP is in operation
393 -- and where there is no cascading of delete defined for this entity.
394 -- For the datetrack mode of DELETE or ZAP we must ensure that no
395 -- datetracked child rows exist between the validation start and end
396 -- dates.
397 --
398 -- Prerequisites:
399 -- This procedure is called from the delete_validate.
400 --
401 -- In Parameters:
402 --
403 -- Post Success:
404 -- Processing continues.
405 --
406 -- Post Failure:
407 -- If a row exists by determining the returning Boolean value from the
408 -- generic dt_api.rows_exist function then we must supply an error via
409 -- the use of the local exception handler l_rows_exist.
410 --
411 -- Developer Implementation Notes:
415 -- Access Status:
412 -- This procedure should not need maintenance unless the HR Schema model
413 -- changes.
414 --
416 -- Internal Row Handler Use Only.
417 --
418 -- {End Of Comments}
419 -- ----------------------------------------------------------------------------
420 Procedure dt_delete_validate
421 (p_ler_rltd_per_cs_ler_id in number,
422 p_datetrack_mode in varchar2,
423 p_validation_start_date in date,
424 p_validation_end_date in date) Is
425 --
426 l_proc varchar2(72) := g_package||'dt_delete_validate';
427 l_rows_exist Exception;
428 l_table_name all_tables.table_name%TYPE;
429 --
430 Begin
431 hr_utility.set_location('Entering:'||l_proc, 5);
432 --
433 -- Ensure that the p_datetrack_mode argument is not null
434 --
435 hr_api.mandatory_arg_error
436 (p_api_name => l_proc,
437 p_argument => 'datetrack_mode',
438 p_argument_value => p_datetrack_mode);
439 --
440 -- Only perform the validation if the datetrack mode is either
441 -- DELETE or ZAP
442 --
443 If (p_datetrack_mode = 'DELETE' or
444 p_datetrack_mode = 'ZAP') then
445 --
446 --
447 -- Ensure the arguments are not null
448 --
449 hr_api.mandatory_arg_error
450 (p_api_name => l_proc,
451 p_argument => 'validation_start_date',
452 p_argument_value => p_validation_start_date);
453 --
454 hr_api.mandatory_arg_error
455 (p_api_name => l_proc,
456 p_argument => 'validation_end_date',
457 p_argument_value => p_validation_end_date);
458 --
459 hr_api.mandatory_arg_error
460 (p_api_name => l_proc,
461 p_argument => 'ler_rltd_per_cs_ler_id',
462 p_argument_value => p_ler_rltd_per_cs_ler_id);
463 --
464 --
465 --
466 End If;
467 --
468 hr_utility.set_location(' Leaving:'||l_proc, 10);
469 Exception
470 When l_rows_exist Then
471 --
472 -- A referential integrity check was violated therefore
473 -- we must error
474 --
475 ben_utility.child_exists_error(p_table_name => l_table_name);
476 When Others Then
477 --
478 -- An unhandled or unexpected error has occurred which
479 -- we must report
480 --
481 fnd_message.set_name('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
482 fnd_message.set_token('PROCEDURE', l_proc);
483 fnd_message.set_token('STEP','15');
484 fnd_message.raise_error;
485 End dt_delete_validate;
486 --
487 -- ----------------------------------------------------------------------------
488 -- |---------------------------< insert_validate >----------------------------|
489 -- ----------------------------------------------------------------------------
490 Procedure insert_validate
491 (p_rec in ben_lrc_shd.g_rec_type,
492 p_effective_date in date,
493 p_datetrack_mode in varchar2,
494 p_validation_start_date in date,
495 p_validation_end_date in date) is
496 --
497 l_proc varchar2(72) := g_package||'insert_validate';
498 --
499 Begin
500 hr_utility.set_location('Entering:'||l_proc, 5);
501 --
502 -- Call all supporting business operations
503 --
504 --
505 hr_api.validate_bus_grp_id(p_rec.business_group_id); -- Validate Bus Grp
506 --
507 chk_ler_rltd_per_cs_ler_id
508 (p_ler_rltd_per_cs_ler_id => p_rec.ler_rltd_per_cs_ler_id,
509 p_effective_date => p_effective_date,
510 p_object_version_number => p_rec.object_version_number);
511 --
512 chk_rltd_per_chg_cs_ler_id
513 (p_ler_rltd_per_cs_ler_id => p_rec.ler_rltd_per_cs_ler_id,
514 p_rltd_per_chg_cs_ler_id => p_rec.rltd_per_chg_cs_ler_id,
515 p_ler_id => p_rec.ler_id,
516 p_validation_start_date => p_validation_start_date,
517 p_validation_end_date => p_validation_end_date,
518 p_effective_date => p_effective_date,
519 p_business_group_id => p_rec.business_group_id,
520 p_object_version_number => p_rec.object_version_number);
521 --
522 --
523 -- Ensure that child records are not created for certain delivered ler types.
524 --
525 ben_lpl_bus.chk_ler_id
526 (p_ler_id => p_rec.ler_id,
527 p_validation_start_date => p_validation_start_date,
528 p_validation_end_date => p_validation_end_date,
529 p_effective_date => p_effective_date,
530 p_business_group_id => p_rec.business_group_id,
531 p_object_version_number => p_rec.object_version_number);
532 --
533 ben_lpl_bus.chk_ler_typ_cd
534 (p_ler_id => p_rec.ler_id,
535 p_validation_start_date => p_validation_start_date,
536 p_validation_end_date => p_validation_end_date,
537 p_effective_date => p_effective_date,
538 p_business_group_id => p_rec.business_group_id,
539 p_object_version_number => p_rec.object_version_number);
540 --
541 chk_ler_rltd_per_cs_chg_rl
542 (p_ler_rltd_per_cs_ler_id => p_rec.ler_rltd_per_cs_ler_id,
543 p_ler_rltd_per_cs_chg_rl => p_rec.ler_rltd_per_cs_chg_rl,
544 p_business_group_id => p_rec.business_group_id,
545 p_effective_date => p_effective_date,
549 End insert_validate;
546 p_object_version_number => p_rec.object_version_number);
547 --
548 hr_utility.set_location(' Leaving:'||l_proc, 10);
550 --
551 -- ----------------------------------------------------------------------------
552 -- |---------------------------< update_validate >----------------------------|
553 -- ----------------------------------------------------------------------------
554 Procedure update_validate
555 (p_rec in ben_lrc_shd.g_rec_type,
556 p_effective_date in date,
557 p_datetrack_mode in varchar2,
558 p_validation_start_date in date,
559 p_validation_end_date in date) is
560 --
561 l_proc varchar2(72) := g_package||'update_validate';
562 --
563 Begin
564 hr_utility.set_location('Entering:'||l_proc, 5);
565 --
566 -- Call all supporting business operations
567 --
568 --
569 hr_api.validate_bus_grp_id(p_rec.business_group_id); -- Validate Bus Grp
570 --
571 chk_ler_rltd_per_cs_ler_id
572 (p_ler_rltd_per_cs_ler_id => p_rec.ler_rltd_per_cs_ler_id,
573 p_effective_date => p_effective_date,
574 p_object_version_number => p_rec.object_version_number);
575 --
576 chk_rltd_per_chg_cs_ler_id
577 (p_ler_rltd_per_cs_ler_id => p_rec.ler_rltd_per_cs_ler_id,
578 p_rltd_per_chg_cs_ler_id => p_rec.rltd_per_chg_cs_ler_id,
579 p_ler_id => p_rec.ler_id,
580 p_validation_start_date => p_validation_start_date,
581 p_validation_end_date => p_validation_end_date,
582 p_effective_date => p_effective_date,
583 p_business_group_id => p_rec.business_group_id,
584 p_object_version_number => p_rec.object_version_number);
585 --
586 --
587 -- Ensure that child records are not created for certain delivered ler types.
588 --
589 ben_lpl_bus.chk_ler_id
590 (p_ler_id => p_rec.ler_id,
591 p_validation_start_date => p_validation_start_date,
592 p_validation_end_date => p_validation_end_date,
593 p_effective_date => p_effective_date,
594 p_business_group_id => p_rec.business_group_id,
595 p_object_version_number => p_rec.object_version_number);
596 --
597 chk_ler_rltd_per_cs_chg_rl
598 (p_ler_rltd_per_cs_ler_id => p_rec.ler_rltd_per_cs_ler_id,
599 p_ler_rltd_per_cs_chg_rl => p_rec.ler_rltd_per_cs_chg_rl,
600 p_business_group_id => p_rec.business_group_id,
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_formula_id => p_rec.ler_rltd_per_cs_chg_rl,
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 hr_utility.set_location(' Leaving:'||l_proc, 10);
613 End update_validate;
614 --
615 -- ----------------------------------------------------------------------------
616 -- |---------------------------< delete_validate >----------------------------|
617 -- ----------------------------------------------------------------------------
618 Procedure delete_validate
619 (p_rec in ben_lrc_shd.g_rec_type,
620 p_effective_date in date,
621 p_datetrack_mode in varchar2,
622 p_validation_start_date in date,
623 p_validation_end_date in date) is
624 --
625 l_proc varchar2(72) := g_package||'delete_validate';
626 --
627 Begin
628 hr_utility.set_location('Entering:'||l_proc, 5);
629 --
630 -- Call all supporting business operations
631 --
632 dt_delete_validate
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 p_ler_rltd_per_cs_ler_id => p_rec.ler_rltd_per_cs_ler_id);
637 --
638 hr_utility.set_location(' Leaving:'||l_proc, 10);
639 End delete_validate;
640 --
641 --
642 -- ---------------------------------------------------------------------------
643 -- |---------------------< return_legislation_code >-------------------------|
644 -- ---------------------------------------------------------------------------
645 --
646 function return_legislation_code
647 (p_ler_rltd_per_cs_ler_id in number) return varchar2 is
648 --
649 -- Declare cursor
650 --
651 cursor csr_leg_code is
652 select a.legislation_code
653 from per_business_groups a,
654 ben_ler_rltd_per_cs_ler_f b
655 where b.ler_rltd_per_cs_ler_id = p_ler_rltd_per_cs_ler_id
656 and a.business_group_id = b.business_group_id;
657 --
658 -- Declare local variables
659 --
660 l_legislation_code varchar2(150);
661 l_proc varchar2(72) := g_package||'return_legislation_code';
662 --
663 begin
664 --
665 hr_utility.set_location('Entering:'|| l_proc, 10);
666 --
667 -- Ensure that all the mandatory parameter are not null
668 --
669 hr_api.mandatory_arg_error(p_api_name => l_proc,
670 p_argument => 'ler_rltd_per_cs_ler_id',
671 p_argument_value => p_ler_rltd_per_cs_ler_id);
672 --
673 open csr_leg_code;
674 --
675 fetch csr_leg_code into l_legislation_code;
676 --
677 if csr_leg_code%notfound then
678 --
679 close csr_leg_code;
680 --
681 -- The primary key is invalid therefore we must error
682 --
683 fnd_message.set_name('PAY','HR_7220_INVALID_PRIMARY_KEY');
684 fnd_message.raise_error;
685 --
686 end if;
687 --
688 close csr_leg_code;
689 --
690 hr_utility.set_location(' Leaving:'|| l_proc, 20);
691 --
692 return l_legislation_code;
693 --
694 end return_legislation_code;
695 --
696 end ben_lrc_bus;