1 Package Body ben_yrp_bus as
2 /* $Header: beyrprhi.pkb 120.0 2005/05/28 12:44:45 appldev noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- | Private Global Definitions |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package varchar2(33) := ' ben_yrp_bus.'; -- Global package name
9 --
10 -- ----------------------------------------------------------------------------
11 -- |------< chk_yr_perd_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 -- yr_perd_id PK of record being inserted or updated.
24 -- object_version_number Object version number of record being
25 -- inserted or updated.
26 --
27 -- Post Success
28 -- Processing continues
29 --
30 -- Post Failure
31 -- Errors handled by the procedure
32 --
33 -- Access Status
34 -- Internal table handler use only.
35 --
36 Procedure chk_yr_perd_id(p_yr_perd_id in number,
37 p_object_version_number in number) is
38 --
39 l_proc varchar2(72) := g_package||'chk_yr_perd_id';
40 l_api_updating boolean;
41 --
42 Begin
43 --
44 hr_utility.set_location('Entering:'||l_proc, 5);
45 --
46 l_api_updating := ben_yrp_shd.api_updating
47 (p_yr_perd_id => p_yr_perd_id,
48 p_object_version_number => p_object_version_number);
49 --
50 if (l_api_updating
51 and nvl(p_yr_perd_id,hr_api.g_number)
52 <> ben_yrp_shd.g_old_rec.yr_perd_id) then
53 --
54 -- raise error as PK has changed
55 --
56 ben_yrp_shd.constraint_error('BEN_YR_PERDS_PK');
57 --
58 elsif not l_api_updating then
59 --
60 -- check if PK is null
61 --
62 if p_yr_perd_id is not null then
63 --
64 -- raise error as PK is not null
65 --
66 ben_yrp_shd.constraint_error('BEN_YR_PERDS_PK');
67 --
68 end if;
69 --
70 end if;
71 --
72 hr_utility.set_location('Leaving:'||l_proc, 10);
73 --
74 End chk_yr_perd_id;
75
76 --
77 -- ----------------------------------------------------------------------------
78 -- |------< chk_perd_typ_cd >------|
82 -- This procedure is used to check that the lookup value is valid.
79 -- ----------------------------------------------------------------------------
80 --
81 -- Description
83 --
84 -- Pre Conditions
85 -- None.
86 --
87 -- In Parameters
88 -- yr_perd_id PK of record being inserted or updated.
89 -- perd_typ_cd Value of lookup code.
90 -- effective_date effective date
91 -- object_version_number Object version number of record being
92 -- inserted or updated.
93 --
94 -- Post Success
95 -- Processing continues
96 --
97 -- Post Failure
98 -- Error handled by procedure
99 --
100 -- Access Status
101 -- Internal table handler use only.
102 --
103 Procedure chk_perd_typ_cd( p_yr_perd_id in number,
104 p_perd_typ_cd in varchar2,
105 p_effective_date in date,
106 p_object_version_number in number) is
107 --
108 l_proc varchar2(72) := g_package||'chk_perd_typ_cd';
109 l_api_updating boolean;
110 --
111 Begin
112 --
113 hr_utility.set_location('Entering:'||l_proc, 5);
114 --
115 l_api_updating := ben_yrp_shd.api_updating
116 (p_yr_perd_id => p_yr_perd_id,
117 p_object_version_number => p_object_version_number);
118 --
119 if (l_api_updating
120 and p_perd_typ_cd
121 <> nvl(ben_yrp_shd.g_old_rec.perd_typ_cd,hr_api.g_varchar2)
122 or not l_api_updating)
123 and p_perd_typ_cd is not null then
124 --
125 -- check if value of lookup falls within lookup type.
126 --
127 if hr_api.not_exists_in_hr_lookups
128 (p_lookup_type => 'BEN_PERD_TYP',
129 p_lookup_code => p_perd_typ_cd,
130 p_effective_date => p_effective_date) then
131 --
132 -- raise error as does not exist as lookup
133 --
134 hr_utility.set_message(801, 'BEN_INVALID_BEN_PERD_TYP_CD');
135 hr_utility.set_message_token('BEN_PERD_TYP_CD' , p_perd_typ_cd);
136 hr_utility.raise_error;
137 --
138 end if;
139 --
140 end if;
141 --
142 hr_utility.set_location('Leaving:'||l_proc,10);
143 --
144 end chk_perd_typ_cd;
145
146 --
147 -- ----------------------------------------------------------------------------
148 -- |------< chk_perd_tm_uom_cd >------|
149 -- ----------------------------------------------------------------------------
150 --
151 -- Description
152 -- This procedure is used to check that the lookup value is valid.
153 --
154 -- Pre Conditions
155 -- None.
156 --
157 -- In Parameters
158 -- yr_perd_id PK of record being inserted or updated.
159 -- perd_tm_uom_cd Value of lookup code.
160 -- effective_date effective date
161 -- object_version_number Object version number of record being
162 -- inserted or updated.
163 --
164 -- Post Success
165 -- Processing continues
166 --
167 -- Post Failure
168 -- Error handled by procedure
169 --
170 -- Access Status
171 -- Internal table handler use only.
172 --
173 Procedure chk_perd_tm_uom_cd(p_yr_perd_id in number,
174 p_perd_tm_uom_cd in varchar2,
175 p_effective_date in date,
176 p_object_version_number in number) is
177 --
178 l_proc varchar2(72) := g_package||'chk_perd_tm_uom_cd';
179 l_api_updating boolean;
180 --
181 Begin
182 --
183 hr_utility.set_location('Entering:'||l_proc, 5);
184 --
185 l_api_updating := ben_yrp_shd.api_updating
186 (p_yr_perd_id => p_yr_perd_id,
187 p_object_version_number => p_object_version_number);
188 --
189 if (l_api_updating
190 and p_perd_tm_uom_cd
191 <> nvl(ben_yrp_shd.g_old_rec.perd_tm_uom_cd,hr_api.g_varchar2)
192 or not l_api_updating)
193 and p_perd_tm_uom_cd is not null then
194 --
195 -- check if value of lookup falls within lookup type.
196 --
197 if hr_api.not_exists_in_hr_lookups
198 (p_lookup_type => 'BEN_TM_UOM',
199 p_lookup_code => p_perd_tm_uom_cd,
200 p_effective_date => p_effective_date) then
201 --
202 -- raise error as does not exist as lookup
203 --
204 hr_utility.set_message(801, 'BEN_INVALID_PERD_TM_UOM_CD');
205 hr_utility.set_message_token('PERD_TM_UOM_CD' , p_perd_tm_uom_cd);
206 hr_utility.raise_error;
207 --
208 end if;
209 --
210 end if;
211 --
212 hr_utility.set_location('Leaving:'||l_proc,10);
213 --
214 end chk_perd_tm_uom_cd;
215 --
216 -- ----------------------------------------------------------------------------
217 -- |---------------< chk_start_and_end_dt_unique >------------------------|
218 -- ----------------------------------------------------------------------------
219 --
220 -- Description
221 -- ensure that no two combinations of start and end dates have the same
222 -- dates
223 --
224 -- Pre Conditions
225 -- None.
226 --
227 -- In Parameters
228 -- p_start_date
229 -- p_end_date
230 -- p_business_group_id
231 --
232 -- Post Success
233 -- Processing continues
234 --
235 -- Post Failure
236 -- Errors handled by the procedure
237 --
238 -- Access Status
239 -- Internal table handler use only.
240 --
241 -- ----------------------------------------------------------------------------
242 Procedure chk_start_and_end_dt_unique
243 (p_yr_perd_id in number
244 ,p_start_date in date
245 ,p_end_date in date
246 ,p_business_group_id in number)
247 is
248 l_proc varchar2(72) := g_package||'chk_start_and_end_dt_unique';
249 l_dummy char(1);
250 cursor c1 is select null
251 from ben_yr_perd
252 Where yr_perd_id <> nvl(p_yr_perd_id,-1)
253 and start_date = p_start_date
254 and end_date = p_end_date
255 and business_group_id = p_business_group_id;
256 --
257 Begin
258 hr_utility.set_location('Entering:'||l_proc, 5);
259 --
260 open c1;
261 fetch c1 into l_dummy;
262 if c1%found then
263 close c1;
264 fnd_message.set_name('BEN','BEN_92130_START_END_DT_UNIQUE');
265 fnd_message.raise_error;
266 end if;
267 --
268 hr_utility.set_location('Leaving:'||l_proc, 15);
269 End chk_start_and_end_dt_unique;
270 --
271 -- ----------------------------------------------------------------------------
272 --
273 -- *** <<Addition Business Rules >>
274 --
275 -- ----------------------------------------------------------------------------
276 --
277 -- |------< chk_strt_end_dt_perd_typ >------|
278 -- ----------------------------------------------------------------------------
279 --
280 -- Description
281 -- This procedure is used to check the start date and end date
282 -- are enter properly. The following condition will be checked:
283 -- * Start date and End date is mandatory fields - Can not be null.
284 -- * Start date always preceded End date.
285 -- * If date range is from 01-jan-yyyy to 31-dec-yyyy for the
286 -- same year then the Period Type must be Calendar, otherwise
287 -- the Period Type must be Fiscal.
288 --
289 -- Pre Conditions
290 -- None.
291 --
292 -- In Parameters
293 -- p_Start Date - Program/Plan year period's Start Date
294 -- p_End Date - Program/Plan year period End Date
295 -- p_Perd Typ Cd - Period type code. (calendar year or Fiscal year)
296 --
297 --
298 Procedure chk_strt_end_dt_perd_typ(p_start_date in date,
299 p_end_date in date,
300 p_perd_typ_cd in varchar2) is
301 --
302 l_proc varchar2(72) := g_package||'chk_strt_end_dt_perd_typ';
303 --
304 Begin
305 --
306 hr_utility.set_location('Entering:'||l_proc, 5);
307
308 if (P_start_date is null) or (p_end_date is null) then
309 --
310 -- raise error Start/End Date is null
311 --
312 hr_utility.set_message(805,'BEN_93610_STRT_END_NULL');
313 hr_utility.raise_error;
314 elsif (p_start_date > p_end_date) then
315 --
316 -- raise error Start Date must precede End date
317 --
318 hr_utility.set_message(805,'BEN_93611_STRT_NOT_PRCD_END');
319 hr_utility.set_message_token('START_DATE',to_char(p_start_date,fnd_profile.value('ICX_DATE_FORMAT_MASK')));
320 hr_utility.set_message_token('END_DATE',to_char(p_end_date,fnd_profile.value('ICX_DATE_FORMAT_MASK')));
321 hr_utility.raise_error;
322
323 elsif(p_end_date > add_months(p_start_date,12)-1 ) then
324 --
325 -- Raise error Date range between end data nad start date is
326 -- greater than 1 year.
327 --
328 hr_utility.set_message(805,'BEN_93612_DT_RANG_GT_YR');
329 hr_utility.set_message_token('START_DATE',to_char(p_start_date,fnd_profile.value('ICX_DATE_FORMAT_MASK')));
330 hr_utility.set_message_token('END_DATE',to_char(p_end_date,fnd_profile.value('ICX_DATE_FORMAT_MASK')));
331 hr_utility.raise_error;
332 elsif to_char(p_start_date, 'DDMM') = '0101' and
333 to_char(p_end_date, 'DDMM') = '3112' and
334 p_perd_typ_cd <> 'CLNDR' then
335 --
336 -- Raise error as this is a full Calendar year
337 --
338 fnd_message.set_name('BEN','BEN_91742_YR_PERD_DATES');
339 fnd_message.raise_error;
340 --
341 elsif(to_char(p_start_date, 'DDMM') <> '0101'
342 or to_char(p_end_date, 'DDMM') <> '3112')
343 and p_perd_typ_cd <> 'FISCAL' then
344 --
345 -- Raise error as this is a fiscal year
346 --
347 fnd_message.set_name('BEN','BEN_91742_YR_PERD_DATES');
348 fnd_message.raise_error;
349 --
350 end if;
351 --
352 hr_utility.set_location('Leaving:'||l_proc, 10);
353 --
354 End chk_strt_end_dt_perd_typ;
355
356 -- ----------------------------------------------------------------------------
357 -- |------< chk_Lmt_strt_end_perd_typ_uom >------|
358 -- ----------------------------------------------------------------------------
359 --
360 -- Description
361 -- This procedure is used to check the start date and end date
362 -- are enter properly. The following condition will be checked:
363 -- * Period's Unit of measure, and number of period in year
364 -- will be mandatory fields if Perd_type_cd equal to Calenedar year
365 -- * If Lmt_strt_dt is not NULL, then lmt_end_dt can not be NULL. or vice versa.
366 -- * Limitation Start date always preceded End date if they are not NULL.
367 --
368 -- Pre Conditions
369 -- None.
370 --
371 -- In Parameters
372 -- p_Lmtn_yr_Strt Dt - Limitation year's Start Date
373 -- p_lmtn_yr_End Date - Limitation year's End Date
374 -- p_Perd_Typ Cd - Period type code. (calendar year or Fiscal year)
375 -- p_perds_in_yr_num - Number of period in year.
376 -- p_perd_tm_uom_cd - Period's Unit of measure.
377 --
378 Procedure chk_lmt_strt_end_perd_typ_uom(p_lmtn_yr_strt_dt in date,
379 p_lmtn_yr_end_dt in date,
380 p_perd_typ_cd in varchar2,
381 p_perds_in_yr_num in number,
382 p_perd_tm_uom_cd in varchar2 ) is
383 --
384 l_proc varchar2(72) := g_package||'chk_Lmt_strt_end_perd_typ_uom';
385 --
386 Begin
387 --
388 hr_utility.set_location('Entering:'|| l_proc, 5);
389
390 if ((P_lmtn_yr_strt_dt is not null) and (p_lmtn_yr_end_dt is null) or
391 (P_lmtn_yr_strt_dt is null) and (p_lmtn_yr_end_dt is not null) ) then
392 --
393 -- raise error Limitation year's End Date can not be null if start date is not null
394 --
395 hr_utility.set_message(801,'BEN_INVALID_LMT_STRT_END_DT');
396 hr_utility.set_message_token('ERR_MSG',
397 'lmtn_Start/End_dt is mandatory (if other is not null');
398 hr_utility.set_message_token('LMT_YR_STRT_DT',p_lmtn_yr_strt_dt);
399 hr_utility.set_message_token('LMT_YR_END_DT',p_lmtn_yr_end_dt);
400 hr_utility.raise_error;
401 elsif (p_lmtn_yr_strt_dt is not null and p_lmtn_yr_strt_dt > p_lmtn_yr_end_dt) then
402 --
403 -- raise error if limitation year Start Date not null then it must precede End date
404 --
405 hr_utility.set_message(801,'BEN_INVALID_LMT_STRT_END_DT');
406 hr_utility.set_message_token('ERR_MSG',
407 'If Limitaiton Year start date is not null, then it must precede End date');
411
408 hr_utility.set_message_token('LMT_YR_STRT_DT',p_lmtn_yr_strt_dt);
409 hr_utility.set_message_token('LMT_YR_END_DT',p_lmtn_yr_end_dt);
410 hr_utility.raise_error;
412 hr_utility.raise_error;
413 elsif(upper(nvl(p_perd_typ_cd,'***')) = 'CAL' and
414 ( p_perds_in_yr_num is null or p_perd_tm_uom_cd is null) ) then
415 --
416 -- Raise Error if Perd_typ_cd is Calendar year, then perds_in_yr_num, and perd_tm_uom fields
417 -- will become mandatory fields.
418 --
419 hr_utility.set_message(801,'BEN_INVALID_PERD_TYP_UOM');
420 hr_utility.set_message_token('ERR_MSG',
421 'perd_tm_uom_cd and perds_in_yr_num are mandatory fields if perd_typ_cd = Cal yr');
422 hr_utility.set_message_token('PERD_TYP_CD', p_perd_typ_cd);
423 hr_utility.set_message_token('PERDS_IN_YR_NUM', to_char(p_perds_in_yr_num) );
424 hr_utility.set_message_token('PERD_TM_UOM_CD', p_perd_tm_uom_cd);
425
426 hr_utility.raise_error;
427 end if;
428 --
429 hr_utility.set_location('Leaving:'||l_proc, 10);
430 --
431
432 End chk_Lmt_strt_end_perd_typ_uom;
433
434 --
435 -- ----------------------------------------------------------------------------
436 -- |---------------------------< insert_validate >----------------------------|
437 -- ----------------------------------------------------------------------------
438 Procedure insert_validate(p_rec in ben_yrp_shd.g_rec_type
439 ,p_effective_date in date) is
440 --
441 l_proc varchar2(72) := g_package||'insert_validate';
442 --
443 Begin
444 hr_utility.set_location('Entering:'||l_proc, 5);
445 --
446 -- Call all supporting business operations
447 --
448 --
449 hr_api.validate_bus_grp_id(p_rec.business_group_id); -- Validate Bus Grp
450 --
451 chk_yr_perd_id
452 (p_yr_perd_id => p_rec.yr_perd_id,
453 p_object_version_number => p_rec.object_version_number);
454 --
455 chk_perd_typ_cd
456 (p_yr_perd_id => p_rec.yr_perd_id,
457 p_perd_typ_cd => p_rec.perd_typ_cd,
458 p_effective_date => p_effective_date,
459 p_object_version_number => p_rec.object_version_number);
460 --
461 chk_perd_tm_uom_cd
462 (p_yr_perd_id => p_rec.yr_perd_id,
463 p_perd_tm_uom_cd => p_rec.perd_tm_uom_cd,
464 p_effective_date => p_effective_date,
465 p_object_version_number => p_rec.object_version_number);
466 --
467 chk_start_and_end_dt_unique
468 (p_yr_perd_id => p_rec.yr_perd_id,
469 p_start_date => p_rec.start_date,
470 p_end_date => p_rec.end_date,
471 p_business_group_id => p_rec.business_group_id);
472 --
473 chk_strt_end_dt_perd_typ
474 (p_start_date => p_rec.start_date,
475 p_end_date => p_rec.end_date,
476 p_perd_typ_cd => p_rec.perd_typ_cd);
477 --
478 chk_lmt_strt_end_perd_typ_uom
479 (p_lmtn_yr_strt_dt => p_rec.lmtn_yr_strt_dt,
480 p_lmtn_yr_end_dt => p_rec.lmtn_yr_end_dt,
481 p_perd_typ_cd => p_rec.perd_typ_cd,
482 p_perds_in_yr_num => p_rec.perds_in_yr_num,
483 p_perd_tm_uom_cd => p_rec.perd_tm_uom_cd);
484
485 --
486
487
488 hr_utility.set_location(' Leaving:'||l_proc, 10);
489 End insert_validate;
490 --
491 -- ----------------------------------------------------------------------------
492 -- |---------------------------< update_validate >----------------------------|
493 -- ----------------------------------------------------------------------------
494 Procedure update_validate(p_rec in ben_yrp_shd.g_rec_type
495 ,p_effective_date in date) is
496 --
497 l_proc varchar2(72) := g_package||'update_validate';
498 --
499 Begin
500 hr_utility.set_location('Entering:'||l_proc, 5);
501 --
502 -- Call all supporting business operations
503 --
504 --
505 hr_api.validate_bus_grp_id(p_rec.business_group_id); -- Validate Bus Grp
506 --
507 chk_yr_perd_id
508 (p_yr_perd_id => p_rec.yr_perd_id,
509 p_object_version_number => p_rec.object_version_number);
510 --
511 chk_perd_typ_cd
512 (p_yr_perd_id => p_rec.yr_perd_id,
513 p_perd_typ_cd => p_rec.perd_typ_cd,
514 p_effective_date => p_effective_date,
515 p_object_version_number => p_rec.object_version_number);
516 --
517 chk_perd_tm_uom_cd
518 (p_yr_perd_id => p_rec.yr_perd_id,
519 p_perd_tm_uom_cd => p_rec.perd_tm_uom_cd,
520 p_effective_date => p_effective_date,
521 p_object_version_number => p_rec.object_version_number);
522 --
523 chk_start_and_end_dt_unique
524 (p_yr_perd_id => p_rec.yr_perd_id,
525 p_start_date => p_rec.start_date,
526 p_end_date => p_rec.end_date,
527 p_business_group_id => p_rec.business_group_id);
528 --
529 chk_strt_end_dt_perd_typ
530 (p_start_date => p_rec.start_date,
531 p_end_date => p_rec.end_date,
532 p_perd_typ_cd => p_rec.perd_typ_cd);
533 --
534 chk_lmt_strt_end_perd_typ_uom
535 (p_lmtn_yr_strt_dt => p_rec.lmtn_yr_strt_dt,
536 p_lmtn_yr_end_dt => p_rec.lmtn_yr_end_dt,
537 p_perd_typ_cd => p_rec.perd_typ_cd,
538 p_perds_in_yr_num => p_rec.perds_in_yr_num,
539 p_perd_tm_uom_cd => p_rec.perd_tm_uom_cd);
540 --
541 hr_utility.set_location(' Leaving:'||l_proc, 10);
542 End update_validate;
543 --
547 Procedure delete_validate(p_rec in ben_yrp_shd.g_rec_type
544 -- ----------------------------------------------------------------------------
545 -- |---------------------------< delete_validate >----------------------------|
546 -- ----------------------------------------------------------------------------
548 ,p_effective_date in date) is
549 --
550 l_proc varchar2(72) := g_package||'delete_validate';
551 --
552
553 cursor c_popl_yr_exists is
554 select 1
555 from ben_popl_yr_perd
556 where yr_perd_id = p_rec.yr_perd_id ;
557 --
558 l_popl_yr_exists c_popl_yr_exists%rowtype ;
559 --
560 cursor c_enrt_perd is
561 select 1
562 from ben_enrt_perd
563 where yr_perd_id = p_rec.yr_perd_id ;
564 --
565 l_enrt_perd c_enrt_perd%rowtype;
566 --
567 cursor c_wthn_yr_perd is
568 select 1
569 from ben_wthn_yr_perd
570 where yr_perd_id = p_rec.yr_perd_id ;
571 --
572 l_wthn_yr_perd c_wthn_yr_perd%rowtype ;
573 --
574 Begin
575 hr_utility.set_location('Entering:'||l_proc, 5);
576 --
577 -- Call all supporting business operations
578 --
579 open c_popl_yr_exists ;
580 fetch c_popl_yr_exists into l_popl_yr_exists ;
581 if c_popl_yr_exists%found
582 then
583 close c_popl_yr_exists ;
584 fnd_message.set_name('PER', 'HR_7215_DT_CHILD_EXISTS');
585 fnd_message.set_token('TABLE_NAME', 'BEN_POPL_YR_PERD');
586 fnd_message.raise_error;
587 end if ;
588 close c_popl_yr_exists ;
589 --
590 open c_enrt_perd ;
591 fetch c_enrt_perd into l_enrt_perd ;
592 if c_enrt_perd%found
593 then
594 close c_enrt_perd ;
595 fnd_message.set_name('PER', 'HR_7215_DT_CHILD_EXISTS');
596 fnd_message.set_token('TABLE_NAME', 'BEN_ENRT_PERD');
597 fnd_message.raise_error;
598 end if ;
599 close c_enrt_perd ;
600 --
601 open c_wthn_yr_perd ;
602 fetch c_wthn_yr_perd into l_wthn_yr_perd ;
603 if c_wthn_yr_perd%found
604 then
605 close c_wthn_yr_perd ;
606 fnd_message.set_name('PER', 'HR_7215_DT_CHILD_EXISTS');
607 fnd_message.set_token('TABLE_NAME', 'BEN_WTHN_YR_PERD');
608 fnd_message.raise_error;
609 end if ;
610 close c_wthn_yr_perd ;
611 --
612 hr_utility.set_location(' Leaving:'||l_proc, 10);
613 End delete_validate;
614 --
615 --
616 -- ---------------------------------------------------------------------------
617 -- |---------------------< return_legislation_code >-------------------------|
618 -- ---------------------------------------------------------------------------
619 --
620 function return_legislation_code
621 (p_yr_perd_id in number) return varchar2 is
622 --
623 -- Declare cursor
624 --
625 cursor csr_leg_code is
626 select a.legislation_code
627 from per_business_groups a,
628 ben_yr_perd b
629 where b.yr_perd_id = p_yr_perd_id
630 and a.business_group_id = b.business_group_id;
631 --
632 -- Declare local variables
633 --
634 l_legislation_code varchar2(150);
635 l_proc varchar2(72) := g_package||'return_legislation_code';
636 --
637 begin
638 --
639 hr_utility.set_location('Entering:'|| l_proc, 10);
640 --
641 -- Ensure that all the mandatory parameter are not null
642 --
643 hr_api.mandatory_arg_error(p_api_name => l_proc,
644 p_argument => 'yr_perd_id',
645 p_argument_value => p_yr_perd_id);
646 --
647 open csr_leg_code;
648 --
649 fetch csr_leg_code into l_legislation_code;
650 --
651 if csr_leg_code%notfound then
652 --
653 close csr_leg_code;
654 --
655 -- The primary key is invalid therefore we must error
656 --
657 hr_utility.set_message(801,'HR_7220_INVALID_PRIMARY_KEY');
658 hr_utility.raise_error;
659 --
660 end if;
661 --
662 close csr_leg_code;
663 --
664 hr_utility.set_location(' Leaving:'|| l_proc, 20);
665 --
666 return l_legislation_code;
667 --
668 end return_legislation_code;
669 --
670 end ben_yrp_bus;