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