[Home] [Help]
PACKAGE BODY: APPS.BEN_PAP_BUS
Source
1 Package Body ben_pap_bus as
2 /* $Header: bepaprhi.pkb 120.2 2006/03/31 00:01:01 gsehgal noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- | Private Global Definitions |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package varchar2(33) := ' ben_pap_bus.'; -- Global package name
9 --
10 -- ----------------------------------------------------------------------------
11 -- |------< chk_prtt_anthr_pl_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 -- prtt_anthr_pl_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_prtt_anthr_pl_rt_id(p_prtt_anthr_pl_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_prtt_anthr_pl_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_pap_shd.api_updating
49 (p_effective_date => p_effective_date,
50 p_prtt_anthr_pl_rt_id => p_prtt_anthr_pl_rt_id,
51 p_object_version_number => p_object_version_number);
52 --
53 if (l_api_updating
54 and nvl(p_prtt_anthr_pl_rt_id,hr_api.g_number)
55 <> ben_pap_shd.g_old_rec.prtt_anthr_pl_rt_id) then
56 --
57 -- raise error as PK has changed
58 --
59 ben_pap_shd.constraint_error('BEN_PRTT_ANTHR_PL_RT_PK');
60 --
61 elsif not l_api_updating then
62 --
63 -- check if PK is null
64 --
65 if p_prtt_anthr_pl_rt_id is not null then
66 --
67 -- raise error as PK is not null
68 --
69 ben_pap_shd.constraint_error('BEN_PRTT_ANTHR_PL_RT_PK');
70 --
71 end if;
72 --
73 end if;
74 --
75 hr_utility.set_location('Leaving:'||l_proc, 10);
76 --
77 End chk_prtt_anthr_pl_rt_id;
78
79 -- ----------------------------------------------------------------------------
80 -- |------< chk_dup_record >------|
81 -- ----------------------------------------------------------------------------
82 --
83 -- Description
84 -- This procedure is used to check that there is no duplicate record
85 --
86 -- Pre Conditions
87 -- None.
88 --
89 -- In Parameters
90 -- p_prtt_anthr_pl_rt_id PK of record being inserted or updated.
91 -- p_pl_id Value of FK
92 -- p_vrbl_rt_prfl_id FK of the record
93 -- p_effective_date effective date
94 -- p_object_version_number Object version number of record being
95 -- inserted or updated.
96 -- p_business_group_id business_group_id of the record
97 -- p_validation_start_date validation_start_date of record
98 -- p_validation_end_date validation_end_date of record
99 --
100 -- Post Success
101 -- Processing continues
102 --
103 -- Post Failure
104 -- Error handled by procedure
105 --
106 -- Access Status
107 -- Internal table handler use only.
108 --
109 Procedure chk_dup_record
110 (p_prtt_anthr_pl_rt_id in number,
111 p_pl_id in number,
112 p_vrbl_rt_prfl_id in number,
113 p_effective_date in date,
114 p_object_version_number in number,
115 p_business_group_id in number,
116 p_validation_start_date in date,
117 p_validation_end_date in date )
118 is
119 --
120 l_proc varchar2(72) := g_package||'chk_dup_record';
121 l_api_updating boolean;
122 l_exists varchar2(1);
123 --
124 cursor c_dup is
125 select null
126 from ben_prtt_anthr_pl_rt_f
127 where pl_id = p_pl_id
128 and vrbl_rt_prfl_id = p_vrbl_rt_prfl_id
129 and prtt_anthr_pl_rt_id <> nvl(p_prtt_anthr_pl_rt_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 BEGIN
135 --
136 hr_utility.set_location('Entering:'||l_proc, 5);
137 --
138 l_api_updating := ben_pap_shd.api_updating
139 (p_prtt_anthr_pl_rt_id => p_prtt_anthr_pl_rt_id,
140 p_effective_date => p_effective_date,
141 p_object_version_number => p_object_version_number);
142 --
143 if (l_api_updating
144 and p_pl_id <> nvl(ben_pap_shd.g_old_rec.pl_id,hr_api.g_number)
145 or not l_api_updating) then
146
147 open c_dup;
148 fetch c_dup into l_exists;
149 if c_dup%found then
150 close c_dup;
151 --
152 -- raise error as this Eligible for Another Plan criteria already exists for this profile
153 --
154 fnd_message.set_name('BEN', 'BEN_92992_DUPS_ROW');
155 fnd_message.set_token('VAR1','Eligible for Another Plan criteria',TRUE);
156 fnd_message.set_token('VAR2','Variable Rate Profile',TRUE);
157 fnd_message.raise_error;
158 --
159 end if;
160 close c_dup;
161 --
162 end if;
163 hr_utility.set_location('Leaving:'||l_proc,10);
164 --
165 END chk_dup_record;
166 --
167
168 --
169 -- ----------------------------------------------------------------------------
170 -- |------< chk_excld_flag >------|
171 -- ----------------------------------------------------------------------------
172 --
173 -- Description
174 -- This procedure is used to check that the lookup value is valid.
175 --
176 -- Pre Conditions
177 -- None.
178 --
179 -- In Parameters
180 -- prtt_anthr_pl_rt_id PK of record being inserted or updated.
181 -- excld_flag Value of lookup code.
182 -- effective_date effective date
183 -- object_version_number Object version number of record being
184 -- inserted or updated.
185 --
186 -- Post Success
187 -- Processing continues
188 --
189 -- Post Failure
190 -- Error handled by procedure
191 --
192 -- Access Status
193 -- Internal table handler use only.
194 --
195 Procedure chk_excld_flag(p_prtt_anthr_pl_rt_id in number,
196 p_excld_flag in varchar2,
197 p_effective_date in date,
198 p_object_version_number in number) is
199 --
200 l_proc varchar2(72) := g_package||'chk_excld_flag';
201 l_api_updating boolean;
202 --
203 Begin
204 --
205 hr_utility.set_location('Entering:'||l_proc, 5);
206 --
207 l_api_updating := ben_pap_shd.api_updating
208 (p_prtt_anthr_pl_rt_id => p_prtt_anthr_pl_rt_id,
209 p_effective_date => p_effective_date,
210 p_object_version_number => p_object_version_number);
211 --
212 if (l_api_updating
213 and p_excld_flag
214 <> nvl(ben_pap_shd.g_old_rec.excld_flag,hr_api.g_varchar2)
215 or not l_api_updating) then
216 --
217 -- check if value of lookup falls within lookup type.
218 --
219 --
220 if hr_api.not_exists_in_hr_lookups
221 (p_lookup_type => 'YES_NO',
222 p_lookup_code => p_excld_flag,
223 p_effective_date => p_effective_date) then
224 --
225 -- raise error as does not exist as lookup
226 --
227 hr_utility.set_message(801,'HR_LOOKUP_DOES_NOT_EXIST');
228 hr_utility.raise_error;
229 --
230 end if;
231 --
232 end if;
233 --
234 hr_utility.set_location('Leaving:'||l_proc,10);
235 --
236 end chk_excld_flag;
237 --
238 --
239 -- added for Bug 5078478 .. add this procedure to check the duplicate seq no
240 -- |--------------------< chk_duplicate_ordr_num >----------------------------|
241 -- ----------------------------------------------------------------------------
242 --
243 -- Description
244 --
245 -- Pre Conditions
246 -- None.
247 --
248 -- In Parameters
249 -- p_prtt_anthr_pl_rt_id
250 -- p_vrbl_rt_prfl_id
251 -- p_ordr_num
252 -- p_effective_date
253 -- p_business_group_id
254 --
255 -- Post Success
256 -- Processing continues
257 --
258 -- Post Failure
259 -- Errors handled by the procedure
260 --
261 -- Access Status
262 -- Internal table handler use only.
263 --
264 -- ----------------------------------------------------------------------------
265
266
267 procedure chk_duplicate_ordr_num
268 (p_vrbl_rt_prfl_id in number
269 ,p_prtt_anthr_pl_rt_id in number
270 ,p_ordr_num in number
271 ,p_validation_start_date in date
272 ,p_validation_end_date in date
273 ,p_business_group_id in number)
274 is
275 l_proc varchar2(72) := g_package||' chk_duplicate_ordr_num ';
276 l_dummy char(1);
277 cursor c1 is select null
278 from ben_prtt_anthr_pl_rt_f
279 where vrbl_rt_prfl_id = p_vrbl_rt_prfl_id
280 -- changed against bug: 5113011
281 and prtt_anthr_pl_rt_id <> nvl(p_prtt_anthr_pl_rt_id ,-1)
282 -- and pl_id <> nvl(p_pl_id ,-1)
283 --and p_effective_date between effective_start_date
284 -- and effective_end_date
285 and p_validation_start_date <= effective_end_date
286 and p_validation_end_date >= effective_start_date
287 and business_group_id + 0 = p_business_group_id
288 and ordr_num = p_ordr_num;
289 --
290 Begin
291 hr_utility.set_location('Entering:'||l_proc, 5);
292
293 --
294 open c1;
295 fetch c1 into l_dummy;
296 --
297 if c1%found then
298 fnd_message.set_name('BEN','BEN_91001_SEQ_NOT_UNIQUE');
299 fnd_message.raise_error;
300 end if;
301 close c1;
302 --
303 hr_utility.set_location('Leaving:'||l_proc, 15);
304 End chk_duplicate_ordr_num;
305
306
307
308 -- ----------------------------------------------------------------------------
309 -- |--------------------------< dt_update_validate >--------------------------|
310 -- ----------------------------------------------------------------------------
311 -- {Start Of Comments}
312 --
313 -- Description:
314 -- This procedure is used for referential integrity of datetracked
315 -- parent entities when a datetrack update operation is taking place
316 -- and where there is no cascading of update defined for this entity.
317 --
318 -- Prerequisites:
319 -- This procedure is called from the update_validate.
320 --
321 -- In Parameters:
322 --
323 -- Post Success:
324 -- Processing continues.
325 --
326 -- Post Failure:
327 --
328 -- Developer Implementation Notes:
329 -- This procedure should not need maintenance unless the HR Schema model
330 -- changes.
331 --
332 -- Access Status:
333 -- Internal Row Handler Use Only.
334 --
335 -- {End Of Comments}
336 -- ----------------------------------------------------------------------------
337 Procedure dt_update_validate
338 (p_vrbl_rt_prfl_id in number default hr_api.g_number,
339 p_datetrack_mode in varchar2,
340 p_validation_start_date in date,
341 p_validation_end_date in date) Is
342 --
343 l_proc varchar2(72) := g_package||'dt_update_validate';
344 l_integrity_error Exception;
345 l_table_name all_tables.table_name%TYPE;
346 --
347 Begin
348 hr_utility.set_location('Entering:'||l_proc, 5);
349 --
350 -- Ensure that the p_datetrack_mode argument is not null
351 --
352 hr_api.mandatory_arg_error
353 (p_api_name => l_proc,
354 p_argument => 'datetrack_mode',
355 p_argument_value => p_datetrack_mode);
356 --
357 -- Only perform the validation if the datetrack update mode is valid
358 --
359 If (dt_api.validate_dt_upd_mode(p_datetrack_mode => p_datetrack_mode)) then
360 --
361 --
362 -- Ensure the arguments are not null
363 --
364 hr_api.mandatory_arg_error
365 (p_api_name => l_proc,
366 p_argument => 'validation_start_date',
367 p_argument_value => p_validation_start_date);
368 --
369 hr_api.mandatory_arg_error
370 (p_api_name => l_proc,
371 p_argument => 'validation_end_date',
372 p_argument_value => p_validation_end_date);
373 --
374 If ((nvl(p_vrbl_rt_prfl_id, hr_api.g_number) <> hr_api.g_number) and
375 NOT (dt_api.check_min_max_dates
376 (p_base_table_name => 'ben_vrbl_rt_prfl_f',
377 p_base_key_column => 'vrbl_rt_prfl_id',
378 p_base_key_value => p_vrbl_rt_prfl_id,
379 p_from_date => p_validation_start_date,
380 p_to_date => p_validation_end_date))) Then
381 l_table_name := 'ben_vrbl_rt_prfl_f';
382 Raise l_integrity_error;
383 End If;
384 --
385 End If;
386 --
387 hr_utility.set_location(' Leaving:'||l_proc, 10);
388 Exception
389 When l_integrity_error Then
390 --
391 -- A referential integrity check was violated therefore
392 -- we must error
393 --
394 hr_utility.set_message(801, 'HR_7216_DT_UPD_INTEGRITY_ERR');
395 hr_utility.set_message_token('TABLE_NAME', l_table_name);
396 hr_utility.raise_error;
397 When Others Then
398 --
399 -- An unhandled or unexpected error has occurred which
400 -- we must report
401 --
402 hr_utility.set_message(801, 'HR_6153_ALL_PROCEDURE_FAIL');
403 hr_utility.set_message_token('PROCEDURE', l_proc);
404 hr_utility.set_message_token('STEP','15');
405 hr_utility.raise_error;
406 End dt_update_validate;
407 --
408 -- ----------------------------------------------------------------------------
409 -- |--------------------------< dt_delete_validate >--------------------------|
410 -- ----------------------------------------------------------------------------
411 -- {Start Of Comments}
412 --
413 -- Description:
414 -- This procedure is used for referential integrity of datetracked
415 -- child entities when either a datetrack DELETE or ZAP is in operation
416 -- and where there is no cascading of delete defined for this entity.
417 -- For the datetrack mode of DELETE or ZAP we must ensure that no
418 -- datetracked child rows exist between the validation start and end
419 -- dates.
420 --
421 -- Prerequisites:
422 -- This procedure is called from the delete_validate.
423 --
424 -- In Parameters:
425 --
426 -- Post Success:
427 -- Processing continues.
428 --
429 -- Post Failure:
430 -- If a row exists by determining the returning Boolean value from the
431 -- generic dt_api.rows_exist function then we must supply an error via
432 -- the use of the local exception handler l_rows_exist.
433 --
434 -- Developer Implementation Notes:
435 -- This procedure should not need maintenance unless the HR Schema model
436 -- changes.
437 --
438 -- Access Status:
439 -- Internal Row Handler Use Only.
440 --
441 -- {End Of Comments}
442 -- ----------------------------------------------------------------------------
443 Procedure dt_delete_validate
444 (p_prtt_anthr_pl_rt_id in number,
445 p_datetrack_mode in varchar2,
446 p_validation_start_date in date,
447 p_validation_end_date in date) Is
448 --
449 l_proc varchar2(72) := g_package||'dt_delete_validate';
450 l_rows_exist Exception;
451 l_table_name all_tables.table_name%TYPE;
452 --
453 Begin
454 hr_utility.set_location('Entering:'||l_proc, 5);
455 --
456 -- Ensure that the p_datetrack_mode argument is not null
457 --
458 hr_api.mandatory_arg_error
459 (p_api_name => l_proc,
460 p_argument => 'datetrack_mode',
461 p_argument_value => p_datetrack_mode);
462 --
463 -- Only perform the validation if the datetrack mode is either
464 -- DELETE or ZAP
465 --
466 If (p_datetrack_mode = 'DELETE' or
467 p_datetrack_mode = 'ZAP') then
468 --
469 --
470 -- Ensure the arguments are not null
471 --
472 hr_api.mandatory_arg_error
473 (p_api_name => l_proc,
474 p_argument => 'validation_start_date',
475 p_argument_value => p_validation_start_date);
476 --
477 hr_api.mandatory_arg_error
478 (p_api_name => l_proc,
479 p_argument => 'validation_end_date',
480 p_argument_value => p_validation_end_date);
481 --
482 hr_api.mandatory_arg_error
483 (p_api_name => l_proc,
484 p_argument => 'prtt_anthr_pl_rt_id',
485 p_argument_value => p_prtt_anthr_pl_rt_id);
486 --
487 --
488 --
489 End If;
490 --
491 hr_utility.set_location(' Leaving:'||l_proc, 10);
492 Exception
493 When l_rows_exist Then
494 --
495 -- A referential integrity check was violated therefore
496 -- we must error
497 --
498 hr_utility.set_message(801, 'HR_7215_DT_CHILD_EXISTS');
499 hr_utility.set_message_token('TABLE_NAME', l_table_name);
500 hr_utility.raise_error;
501 When Others Then
502 --
503 -- An unhandled or unexpected error has occurred which
504 -- we must report
505 --
506 hr_utility.set_message(801, 'HR_6153_ALL_PROCEDURE_FAIL');
507 hr_utility.set_message_token('PROCEDURE', l_proc);
508 hr_utility.set_message_token('STEP','15');
509 hr_utility.raise_error;
510 End dt_delete_validate;
511 --
512 -- ----------------------------------------------------------------------------
513 -- |---------------------------< insert_validate >----------------------------|
514 -- ----------------------------------------------------------------------------
515 Procedure insert_validate
516 (p_rec in ben_pap_shd.g_rec_type,
517 p_effective_date in date,
518 p_datetrack_mode in varchar2,
519 p_validation_start_date in date,
520 p_validation_end_date in date) is
521 --
522 l_proc varchar2(72) := g_package||'insert_validate';
523 --
524 Begin
525 hr_utility.set_location('Entering:'||l_proc, 5);
526 --
527 -- Call all supporting business operations
528 --
529 --
530 hr_api.validate_bus_grp_id(p_rec.business_group_id); -- Validate Bus Grp
531 --
532 chk_prtt_anthr_pl_rt_id
533 (p_prtt_anthr_pl_rt_id => p_rec.prtt_anthr_pl_rt_id,
534 p_effective_date => p_effective_date,
535 p_object_version_number => p_rec.object_version_number);
536 --
537 chk_dup_record
538 (p_prtt_anthr_pl_rt_id => p_rec.prtt_anthr_pl_rt_id,
539 p_pl_id => p_rec.pl_id,
540 p_vrbl_rt_prfl_id => p_rec.vrbl_rt_prfl_id,
541 p_effective_date => p_effective_date,
542 p_object_version_number => p_rec.object_version_number,
543 p_business_group_id => p_rec.business_group_id,
544 p_validation_start_date => p_validation_start_date,
545 p_validation_end_date => p_validation_end_date);
546 --
547 chk_excld_flag
548 (p_prtt_anthr_pl_rt_id => p_rec.prtt_anthr_pl_rt_id,
549 p_excld_flag => p_rec.excld_flag,
550 p_effective_date => p_effective_date,
551 p_object_version_number => p_rec.object_version_number);
552 -- added for Bug 5078478 .. add this procedure to check the duplicate seq no
553 chk_duplicate_ordr_num
554 (p_vrbl_rt_prfl_id => p_rec.vrbl_rt_prfl_id
555 ,p_prtt_anthr_pl_rt_id => p_rec.prtt_anthr_pl_rt_id
556 ,p_ordr_num => p_rec.ordr_num
557 ,p_validation_start_date => p_validation_start_date
558 ,p_validation_end_date => p_validation_end_date
559 ,p_business_group_id => p_rec.business_group_id);
560
561 --
562 hr_utility.set_location(' Leaving:'||l_proc, 10);
563 End insert_validate;
564 --
565 -- ----------------------------------------------------------------------------
566 -- |---------------------------< update_validate >----------------------------|
567 -- ----------------------------------------------------------------------------
568 Procedure update_validate
569 (p_rec in ben_pap_shd.g_rec_type,
570 p_effective_date in date,
571 p_datetrack_mode in varchar2,
572 p_validation_start_date in date,
573 p_validation_end_date in date) is
574 --
575 l_proc varchar2(72) := g_package||'update_validate';
576 --
577 Begin
578 hr_utility.set_location('Entering:'||l_proc, 5);
579 --
580 -- Call all supporting business operations
581 --
582 --
583 hr_api.validate_bus_grp_id(p_rec.business_group_id); -- Validate Bus Grp
584 --
585 chk_prtt_anthr_pl_rt_id
586 (p_prtt_anthr_pl_rt_id => p_rec.prtt_anthr_pl_rt_id,
587 p_effective_date => p_effective_date,
588 p_object_version_number => p_rec.object_version_number);
589 --
590 chk_dup_record
591 (p_prtt_anthr_pl_rt_id => p_rec.prtt_anthr_pl_rt_id,
592 p_pl_id => p_rec.pl_id,
593 p_vrbl_rt_prfl_id => p_rec.vrbl_rt_prfl_id,
594 p_effective_date => p_effective_date,
595 p_object_version_number => p_rec.object_version_number,
596 p_business_group_id => p_rec.business_group_id,
597 p_validation_start_date => p_validation_start_date,
598 p_validation_end_date => p_validation_end_date);
599 --
600 chk_excld_flag
601 (p_prtt_anthr_pl_rt_id => p_rec.prtt_anthr_pl_rt_id,
602 p_excld_flag => p_rec.excld_flag,
603 p_effective_date => p_effective_date,
604 p_object_version_number => p_rec.object_version_number);
605 --
606 -- added for Bug 5078478 .. add this procedure to check the duplicate seq no
607 chk_duplicate_ordr_num
608 (p_vrbl_rt_prfl_id => p_rec.vrbl_rt_prfl_id
609 ,p_prtt_anthr_pl_rt_id => p_rec.prtt_anthr_pl_rt_id
610 ,p_ordr_num => p_rec.ordr_num
611 ,p_validation_start_date => p_validation_start_date
612 ,p_validation_end_date => p_validation_end_date
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_vrbl_rt_prfl_id => p_rec.vrbl_rt_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
633 p_validation_start_date in date,
630 (p_rec in ben_pap_shd.g_rec_type,
631 p_effective_date in date,
632 p_datetrack_mode in varchar2,
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_prtt_anthr_pl_rt_id => p_rec.prtt_anthr_pl_rt_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_prtt_anthr_pl_rt_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_prtt_anthr_pl_rt_f b
666 where b.prtt_anthr_pl_rt_id = p_prtt_anthr_pl_rt_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 => 'prtt_anthr_pl_rt_id',
682 p_argument_value => p_prtt_anthr_pl_rt_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 hr_utility.set_message(801,'HR_7220_INVALID_PRIMARY_KEY');
695 hr_utility.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_pap_bus;