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