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