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