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