1 Package Body ben_bnr_bus as
2 /* $Header: bebnrrhi.pkb 120.0 2005/05/28 00:46:03 appldev noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- | Private Global Definitions |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package varchar2(33) := ' ben_bnr_bus.'; -- Global package name
9 --
10 g_dummy number(1);
11 g_business_group_id number(15); -- For validating translation;
12 g_legislation_code varchar2(150); -- For validating translation;
13 --
14 --
15 PROCEDURE set_translation_globals(p_business_group_id IN NUMBER,
16 p_legislation_code IN VARCHAR2) IS
17 BEGIN
18 g_business_group_id := p_business_group_id;
19 g_legislation_code := p_legislation_code;
20 END;
21 --
22 procedure validate_translation(rpt_grp_id IN NUMBER,
23 language IN VARCHAR2,
24 rpt_grp_name IN VARCHAR2,
25 p_business_group_id IN NUMBER DEFAULT NULL,
26 p_legislation_code IN VARCHAR2 DEFAULT null) IS
27 /*
28 This procedure fails if a reporting group translation is already present in
29 the table for a given language. Otherwise, no action is performed. It is
30 used to ensure uniqueness of translated names.
31 */
32
33 --
34 cursor c_translation(p_language IN VARCHAR2,
35 p_rpt_grp_name IN VARCHAR2,
36 p_rpt_grp_id IN NUMBER,
37 p_bus_grp_id in number ,
38 p_leg_code IN VARCHAR2) IS
39 SELECT 1
40 FROM ben_rptg_grp_tl rtl,
41 ben_rptg_grp rgp
42 WHERE upper(rgp.name)= upper(p_rpt_grp_name)
43 AND rgp.rptg_grp_id = rtl.rptg_grp_id
44 AND rtl.language = p_language
45 AND (rtl.rptg_grp_id <> p_rpt_grp_id OR p_rpt_grp_id IS NULL)
46 AND (rgp.business_group_id = p_bus_grp_id OR p_bus_grp_id IS NULL)
47 AND (rgp.legislation_code = p_leg_code OR p_leg_code IS NULL);
48
49 l_package_name VARCHAR2(80) := 'BEN_BNR_BUS.VALIDATE_TRANSLATION';
50 l_business_group_id NUMBER := nvl(p_business_group_id, g_business_group_id);
51 l_legislation_code VARCHAR2(150) := nvl(p_legislation_code, g_legislation_code);
52
53 BEGIN
54 hr_utility.set_location (l_package_name,10);
55 OPEN c_translation(language, rpt_grp_name,rpt_grp_id,l_business_group_id,l_legislation_code );
56 hr_utility.set_location (l_package_name,50);
57 FETCH c_translation INTO g_dummy;
58
59 IF c_translation%NOTFOUND THEN
60 hr_utility.set_location (l_package_name,60);
61 CLOSE c_translation;
62 ELSE
63 hr_utility.set_location (l_package_name,70);
64 CLOSE c_translation;
65 fnd_message.set_name('PAY','HR_TRANSLATION_EXISTS');
66 fnd_message.raise_error;
67 END IF;
68 hr_utility.set_location ('Leaving:'||l_package_name,80);
69 END validate_translation;
70 -- ----------------------------------------------------------------------------
71 -- |------< chk_rptg_grp_id >------|
72 -- ----------------------------------------------------------------------------
73 --
74 -- Description
75 -- This procedure is used to check that the primary key for the table
76 -- is created properly. It should be null on insert and
77 -- should not be able to be updated.
78 --
79 -- Pre Conditions
80 -- None.
81 --
82 -- In Parameters
83 -- rptg_grp_id PK of record being inserted or updated.
84 -- object_version_number Object version number of record being
85 -- inserted or updated.
86 --
87 -- Post Success
88 -- Processing continues
89 --
90 -- Post Failure
91 -- Errors handled by the procedure
92 --
93 -- Access Status
94 -- Internal table handler use only.
95 --
96 Procedure chk_rptg_grp_id(p_rptg_grp_id in number,
97 p_object_version_number in number) is
98 --
99 l_proc varchar2(72) := g_package||'chk_rptg_grp_id';
100 l_api_updating boolean;
101 --
102 Begin
103 --
104 hr_utility.set_location('Entering:'||l_proc, 5);
105 --
106 l_api_updating := ben_bnr_shd.api_updating
107 (p_rptg_grp_id => p_rptg_grp_id,
108 p_object_version_number => p_object_version_number);
109 --
110 if (l_api_updating
111 and nvl(p_rptg_grp_id,hr_api.g_number)
112 <> ben_bnr_shd.g_old_rec.rptg_grp_id) then
113 --
114 -- raise error as PK has changed
115 --
116 ben_bnr_shd.constraint_error('BEN_RPTG_GRP_PK');
117 --
118 elsif not l_api_updating then
119 --
120 -- check if PK is null
121 --
122 if p_rptg_grp_id is not null then
123 --
124 -- raise error as PK is not null
125 --
126 ben_bnr_shd.constraint_error('BEN_RPTG_GRP_PK');
127 --
128 end if;
129 --
130 end if;
131 --
132 hr_utility.set_location('Leaving:'||l_proc, 10);
133 --
134 End chk_rptg_grp_id;
135 --
136 -- ----------------------------------------------------------------------------
137 -- |------< chk_rptg_prps_cd >------|
138 -- ----------------------------------------------------------------------------
139 --
140 -- Description
141 -- This procedure is used to check that the lookup value is valid.
142 --
143 -- Pre Conditions
144 -- None.
145 --
146 -- In Parameters
147 -- rptg_grp_id PK of record being inserted or updated.
148 -- rptg_prps_cd Value of lookup code.
149 -- effective_date effective date
150 -- object_version_number Object version number of record being
151 -- inserted or updated.
152 --
153 -- Post Success
154 -- Processing continues
155 --
156 -- Post Failure
157 -- Error handled by procedure
158 --
159 -- Access Status
160 -- Internal table handler use only.
161 --
162 Procedure chk_rptg_prps_cd(p_rptg_grp_id in number,
163 p_rptg_prps_cd in varchar2,
164 p_effective_date in date,
165 p_object_version_number in number) is
166 --
167 l_proc varchar2(72) := g_package||'chk_rptg_prps_cd';
168 l_api_updating boolean;
169 --
170 Begin
171 --
172 hr_utility.set_location('Entering:'||l_proc, 5);
173 --
174 l_api_updating := ben_bnr_shd.api_updating
175 (p_rptg_grp_id => p_rptg_grp_id,
176 p_object_version_number => p_object_version_number);
177 --
178 if (l_api_updating
179 and p_rptg_prps_cd
180 <> nvl(ben_bnr_shd.g_old_rec.rptg_prps_cd,hr_api.g_varchar2)
181 or not l_api_updating)
182 and p_rptg_prps_cd is not null then
183 --
184 -- check if value of lookup falls within lookup type.
185 --
186 if hr_api.not_exists_in_hr_lookups
187 (p_lookup_type => 'BEN_RPTG_PRPS',
188 p_lookup_code => p_rptg_prps_cd,
189 p_effective_date => p_effective_date) then
190 --
191 -- raise error as does not exist as lookup
192 --
193 fnd_message.set_name('BEN','BEN_91087_INVLD_RPTG_PRPS_CD');
194 fnd_message.raise_error;
195 --
196 end if;
197 --
198 end if;
199 --
200 hr_utility.set_location('Leaving:'||l_proc,10);
201 --
202 end chk_rptg_prps_cd;
203 --
204 --
205 --
206 -- ----------------------------------------------------------------------------
207 -- |---------------------------< chk_irec_plans >-----------------------------|
208 -- ----------------------------------------------------------------------------
209 --
210 -- Description
211 -- This procedure is used to ensure that when purpose of reporting group is changed
212 -- to iRecruitment, none of the Plans attached to the reporting group should be
213 -- of Option Type other than "Individual Compensation Distribution"
214 -- Called from update_validate.
215 --
216 -- Pre Conditions
217 -- None.
218 --
219 -- In Parameters
220 -- rptg_grp_id PK of record being inserted or updated.
221 -- rptg_prps_cd Reporting Group Purpose Code
222 -- effective_date effective date
223 -- business_group_id business group id (null value indicated global reporting group)
224 -- object_version_number Object version number of record being
225 -- inserted or updated.
226 --
227 -- Post Success
228 -- Processing continues
229 --
230 -- Post Failure
231 -- Error handled by procedure
232 --
233 -- Access Status
234 -- Internal table handler use only.
235 --
236 Procedure chk_irec_plans ( p_rptg_grp_id in number,
237 p_rptg_prps_cd in varchar2,
238 p_business_group_id in number,
239 p_effective_date in date,
240 p_object_version_number in number) is
241 --
242 cursor c1 is
243 select null
244 from ben_popl_rptg_grp_f rgr, ben_pl_f pln, ben_pl_typ_f ptp
245 where rgr.rptg_grp_id = p_rptg_grp_id
246 and rgr.pl_id = pln.pl_id
247 and rgr.effective_start_date <= pln.effective_end_date
248 and rgr.effective_end_date >= pln.effective_start_date
249 and pln.pl_typ_id = ptp.pl_typ_id
250 and ptp.business_group_id = rgr.business_group_id
251 and greatest(rgr.effective_start_date, pln.effective_start_date) <= ptp.effective_end_date
252 and least(rgr.effective_end_date, pln.effective_end_date) >= ptp.effective_start_date
253 and ptp.opt_typ_cd <> 'COMP';
254 --
255 cursor c2 is
256 select null
257 from ben_popl_rptg_grp_f rgr
258 where rgr.rptg_grp_id = p_rptg_grp_id
259 and rgr.pgm_id is not null;
260 --
261 l_proc varchar2(72) := g_package||'chk_irec_plans ';
262 l_api_updating boolean;
263 l_dummy varchar2(1);
264 --
265 Begin
266 --
267 hr_utility.set_location('Entering:'||l_proc, 5);
268 --
269 l_api_updating := ben_bnr_shd.api_updating
270 (p_rptg_grp_id => p_rptg_grp_id,
271 p_object_version_number => p_object_version_number);
272 --
273 if (l_api_updating
274 and p_rptg_prps_cd
275 <> nvl(ben_bnr_shd.g_old_rec.rptg_prps_cd,hr_api.g_varchar2))
276 and p_rptg_prps_cd is not null then
277 --
278 if p_rptg_prps_cd = 'IREC' then
279 --
280 if p_business_group_id is null then
281 --
282 -- Raise error message : to uncheck the Global flag and then change purpose to IREC
283 --
284 fnd_message.set_name ('BEN','BEN_93918_RPTG_GRP_GLOBAL');
285 fnd_message.raise_error;
286 --
287 end if;
288 --
289 open c1;
290 fetch c1 into l_dummy;
291 if c1%found
292 then
293 --
294 close c1;
295 -- Raise error : as non iRec plans are attached to current reporting group
296 --
297 fnd_message.set_name('BEN','BEN_93920_RPTG_IREC_NONICD_PLN');
298 fnd_message.raise_error;
299 --
300 end if;
301 --
302 close c1;
303 --
304 open c2;
305 fetch c2 into l_dummy;
306 if c2%found
307 then
308 --
309 close c2;
310 --Raise error : as programs are also attached to the current reporting group
311 --
312 fnd_message.set_name('BEN','BEN_93919_RPTG_IREC_PGM_EXIST');
313 fnd_message.raise_error;
314 --
315 end if;
316 close c2;
317 --
318 end if;
319 --
320 end if;
321 --
322 --
323 hr_utility.set_location('Leaving:'||l_proc,10);
324 --
325 end chk_irec_plans ;
326 --
327 ------------------------------------------------------------------------
328 ----
329 -- |------< chk_name >------|
330 --
331 ------------------------------------------------------------------------
332 ----
333 --
334 -- Description
335 -- This procedure is used to check that the Name is unique in a business
336 -- group.
337 --
338 -- Pre Conditions
339 -- None.
340 --
341 -- In Parameters
342 -- rptg_grp_id PK of record being inserted or updated.
343 -- name Value of Name.
344 -- effective_date effective date
345 -- object_version_number Object version number of record being
346 -- inserted or updated.
347 --
348 -- Post Success
349 -- Processing continues
350 --
351 -- Post Failure
352 -- Error handled by procedure
353 --
354 -- Access Status
355 -- Internal table handler use only.
356 --
357 Procedure chk_name(p_rptg_grp_id in number,
358 p_business_group_id in number,
359 p_name in varchar2,
360 p_effective_date in date,
361 p_object_version_number in number) is
362 --
363 l_proc varchar2(72):= g_package||'chk_name';
364 l_api_updating boolean;
365 l_dummy varchar2(1);
366 --
367 -- added nvl for CWB Changes
368 cursor c1 is
369 select null
370 from ben_rptg_grp bnr
371 ------ business group valiadted for global and non global
372 where nvl(bnr.business_group_id,nvl(p_business_group_id,-1)) =
373 nvl(p_business_group_id,nvl(bnr.business_group_id,-1))
374 --- changes of busienss group from non glbaol to gloabl
375 --- without changes in name may violate the uniqness
376 --- so allway chke the id
377 and bnr.rptg_grp_id <> nvl( p_rptg_grp_id , -1)
378 and bnr.name = p_name;
379 Begin
380 --
381 hr_utility.set_location('Entering:'||l_proc, 5);
382 hr_utility.set_location('business:'||p_business_group_id, 5);
383 --
384 l_api_updating := ben_bnr_shd.api_updating
385 (p_rptg_grp_id => p_rptg_grp_id,
386 -- p_effective_date => p_effective_date,
387 p_object_version_number => p_object_version_number);
388 --
389 -- Check whether name is null
390 --
391 hr_api.mandatory_arg_error(p_api_name => l_proc,
392 p_argument => 'name',
393 p_argument_value => p_name);
394 --
395
396 if ((l_api_updating
397 and nvl(p_name,hr_api.g_varchar2)
398 <> ben_bnr_shd.g_old_rec.name
399 or not l_api_updating)
400 OR
401 (l_api_updating
402 and nvl(p_business_group_id,hr_api.g_number)
403 <> ben_bnr_shd.g_old_rec.business_group_id
404 or not l_api_updating)
405 )
406 and p_name is not null then
407 --
408 -- check if name already used.
409 --
410 open c1;
411 --
412 --
413 -- fetch value from cursor if it returns a record then the
414 -- name is invalid otherwise its valid
415 --
416 hr_utility.set_location(' comming for update ' || p_rptg_grp_id, 99 );
417 fetch c1 into l_dummy;
418 if c1%found then
419 --
420 close c1;
421 --
422 -- raise error
423 --
424 fnd_message.set_name('BEN','BEN_91009_NAME_NOT_UNIQUE');
425 fnd_message.raise_error;
426 --
427 end if;
428 --
429 close c1;
433 --
430 end if;
431 --
432 hr_utility.set_location('Leaving:'||l_proc,10);
434 end chk_name;
435 --
436 ----
437 -- |------< chk_child_exist_in_other_bg >------|
438 --
439 ------------------------------------------------------------------------
440 ----
441 --
442 -- Description
443 -- This procedure is used to check that there are no child records exist for
444 -- for the Record in other business group ONLY if the business_group_id is
445 -- not null ( CWB Changes )
446 --
447 -- Pre Conditions
448 -- None.
449 --
450 -- In Parameters
451 -- rptg_grp_id PK of record being inserted or updated.
452 -- business_group_id may be null
453 -- effective_date effective date
454 -- object_version_number Object version number of record being
455 -- inserted or updated.
456 --
457 -- Post Success
458 -- Processing continues
459 --
460 -- Post Failure
461 -- Error handled by procedure
462 --
463 -- Access Status
464 -- Internal table handler use only.
465 --
466 Procedure chk_child_exist_in_other_bg
467 (p_rptg_grp_id in number,
468 p_business_group_id in number,
469 p_effective_date in date,
470 p_object_version_number in number) is
471 --
472 l_proc varchar2(72):= g_package||'chk_child_exist_in_other_bg';
473 l_api_updating boolean;
474 l_dummy varchar2(1);
475 --
476 cursor c1 is
477 select null
478 from ben_popl_rptg_grp prg
479 where prg.business_group_id <> p_business_group_id
480 and prg.rptg_grp_id = p_rptg_grp_id
481 union
482 select null
483 from ben_pl_regy_bod_f prb
484 where prb.business_group_id <> p_business_group_id
485 and prb.rptg_grp_id = p_rptg_grp_id
486 union
487 select null
488 from ben_pl_regn_f pre
489 where pre.business_group_id <> p_business_group_id
490 and pre.rptg_grp_id = p_rptg_grp_id;
491 Begin
492 --
493 hr_utility.set_location('Entering:'||l_proc, 5);
494 --
495 if p_business_group_id is not null then
496 --
497 open c1;
498 --
499 -- fetch value from cursor if it returns a record then the
500 --
501 fetch c1 into l_dummy;
502 if c1%found then
503 --
504 close c1;
505 --
506 -- raise error
507 -- Change this message
508 fnd_message.set_name('BEN','BEN_92775_CHILD_REC_EXISTS');
509 fnd_message.raise_error;
510 --
511 end if;
512 --
513 close c1;
514 --
515 end if;
516 hr_utility.set_location('Leaving:'||l_proc,10);
517 --
518 end chk_child_exist_in_other_bg;
519 --
520 --
521 -- ----------------------------------------------------------------------------
522 -- |--------------------------< dt_delete_validate >--------------------------|
523 -- ----------------------------------------------------------------------------
524 -- {Start Of Comments}
525 --
526 -- Description:
527 -- This procedure is used for referential integrity of datetracked
528 -- child entities when either a datetrack DELETE or ZAP is in operation
529 -- and where there is no cascading of delete defined for this entity.
530 -- For the datetrack mode of DELETE or ZAP we must ensure that no
531 -- datetracked child rows exist between the validation start and end
532 -- dates.
533 --
534 -- Prerequisites:
535 -- This procedure is called from the delete_validate.
536 --
537 -- In Parameters:
538 --
539 -- Post Success:
540 -- Processing continues.
541 --
542 -- Post Failure:
543 -- If a row exists by determining the returning Boolean value from the
544 -- generic dt_api.rows_exist function then we must supply an error via
545 -- the use of the local exception handler l_rows_exist.
546 --
547 -- Developer Implementation Notes:
548 -- This procedure should not need maintenance unless the HR Schema model
549 -- changes.
550 --
551 -- Access Status:
552 -- Internal Row Handler Use Only.
553 --
554 -- {End Of Comments}
555 -- ----------------------------------------------------------------------------
556 Procedure dt_delete_validate
557 (p_rptg_grp_id in number,
558 p_datetrack_mode in varchar2,
559 p_validation_start_date in date,
560 p_validation_end_date in date) Is
561 --
562 l_proc varchar2(72) := g_package||'dt_delete_validate';
563 l_rows_exist Exception;
564 l_table_name all_tables.table_name%TYPE;
565
566 --
567 Begin
568 hr_utility.set_location('Entering:'||l_proc, 5);
569 --
570 -- Ensure that the p_datetrack_mode argument is not null
571
572 --
573 hr_api.mandatory_arg_error
574 (p_api_name => l_proc,
575 p_argument => 'datetrack_mode',
576 p_argument_value => p_datetrack_mode);
577 --
578 -- Only perform the validation if the datetrack mode is either
579 -- DELETE or ZAP
580 --
581 If (p_datetrack_mode = 'DELETE' or
582 p_datetrack_mode = 'ZAP') then
583 --
584 --
585 -- Ensure the arguments are not null
586 --
587
588 hr_api.mandatory_arg_error
589 (p_api_name => l_proc,
590 p_argument => 'validation_start_date',
591 p_argument_value => p_validation_start_date);
592 --
593 hr_api.mandatory_arg_error
594 (p_api_name => l_proc,
595 p_argument => 'validation_end_date',
596 p_argument_value => p_validation_end_date);
597 --
598 hr_api.mandatory_arg_error
599 (p_api_name => l_proc,
600 p_argument => 'rptg_grp_id',
601 p_argument_value => p_rptg_grp_id);
602
603
604 --
605 If (dt_api.rows_exist
606 (p_base_table_name => 'ben_pl_regn_f',
607 p_base_key_column => 'rptg_grp_id',
608 p_base_key_value => p_rptg_grp_id,
609 p_from_date => p_validation_start_date,
610 p_to_date => p_validation_end_date)) Then
611
612 l_table_name := 'ben_pl_regn_f';
613 Raise l_rows_exist;
614 End If;
615
616 If (dt_api.rows_exist
617 (p_base_table_name => 'ben_pl_regy_bod_f',
618 p_base_key_column => 'rptg_grp_id',
619 p_base_key_value => p_rptg_grp_id,
620 p_from_date => p_validation_start_date,
621 p_to_date => p_validation_end_date)) Then
622 l_table_name := 'ben_pl_regy_bod_f';
623 Raise l_rows_exist;
624 End If;
625
626 If (dt_api.rows_exist
627 (p_base_table_name => 'ben_popl_rptg_grp_f',
628 p_base_key_column => 'rptg_grp_id',
629 p_base_key_value => p_rptg_grp_id,
630 p_from_date => p_validation_start_date,
631 p_to_date => p_validation_end_date)) Then
632 l_table_name := 'ben_popl_rptg_grp_f';
633 Raise l_rows_exist;
634 End If;
635
636 --
637 End If;
638 --
639 hr_utility.set_location(' Leaving:'||l_proc, 10);
640 Exception
641 When l_rows_exist Then
642 --
643 -- A referential integrity check was violated therefore
644 -- we must error
645 --
646 ben_utility.child_exists_error(p_table_name => l_table_name);
647
648 --
649
650 When Others Then
651 --
652 -- An unhandled or unexpected error has occurred which
653 -- we must report
654 --
655 fnd_message.set_name('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
656 fnd_message.set_token('PROCEDURE', sqlerrm);
657 fnd_message.set_token('STEP','15');
658 fnd_message.raise_error;
659 End dt_delete_validate;
660 --
661 -- ----------------------------------------------------------------------------
662 -- |---------------------------< insert_validate >----------------------------|
663 -- ----------------------------------------------------------------------------
664 Procedure insert_validate(p_rec in ben_bnr_shd.g_rec_type
665 ,p_effective_date in date) is
666 --
667 l_proc varchar2(72) := g_package||'insert_validate';
668 --
669 Begin
670 hr_utility.set_location('Entering:'||l_proc, 5);
671 --
672 -- Call all supporting business operations
673 --
674 -- CWB Changes
675 if p_rec.business_group_id is not null then
676 --
677 hr_api.validate_bus_grp_id(p_rec.business_group_id); -- Validate Bus Grp
678 --
679 end if;
680 --
681 chk_rptg_grp_id
682 (p_rptg_grp_id => p_rec.rptg_grp_id,
683 p_object_version_number => p_rec.object_version_number);
684 --
685 chk_name
686 (p_rptg_grp_id => p_rec.rptg_grp_id,
687 p_business_group_id => p_rec.business_group_id,
688 p_name => p_rec.name,
689 p_effective_date => p_effective_date,
690 p_object_version_number => p_rec.object_version_number);
691 --
692
693 chk_rptg_prps_cd
694 (p_rptg_grp_id => p_rec.rptg_grp_id,
695 p_rptg_prps_cd => p_rec.rptg_prps_cd,
696 p_effective_date => p_effective_date,
697 p_object_version_number => p_rec.object_version_number);
698 --
699 chk_child_exist_in_other_bg
700 (p_rptg_grp_id => p_rec.rptg_grp_id,
701 p_business_group_id => p_rec.business_group_id,
702 p_effective_date => p_effective_date,
703 p_object_version_number => p_rec.object_version_number) ;
704 --
705 hr_utility.set_location(' Leaving:'||l_proc, 10);
706 End insert_validate;
707 --
708 -- ----------------------------------------------------------------------------
709 -- |---------------------------< update_validate >----------------------------|
710 -- ----------------------------------------------------------------------------
711 Procedure update_validate(p_rec in ben_bnr_shd.g_rec_type
712 ,p_effective_date in date) is
713 --
717 hr_utility.set_location('Entering:'||l_proc, 5);
714 l_proc varchar2(72) := g_package||'update_validate';
715 --
716 Begin
718 --
719 -- Call all supporting business operations
720 --
721 --
722 if p_rec.business_group_id is not null then
723 --
724 hr_api.validate_bus_grp_id(p_rec.business_group_id); -- Validate Bus Grp
725 --
726 end if;
727 --
728 chk_rptg_grp_id
729 (p_rptg_grp_id => p_rec.rptg_grp_id,
730 p_object_version_number => p_rec.object_version_number);
731 --
732 chk_name
733 (p_rptg_grp_id => p_rec.rptg_grp_id,
737 p_object_version_number => p_rec.object_version_number);
734 p_business_group_id => p_rec.business_group_id,
735 p_name => p_rec.name,
736 p_effective_date => p_effective_date,
738 --
739 --
740 chk_rptg_prps_cd
741 (p_rptg_grp_id => p_rec.rptg_grp_id,
742 p_rptg_prps_cd => p_rec.rptg_prps_cd,
743 p_effective_date => p_effective_date,
744 p_object_version_number => p_rec.object_version_number);
745 --
746 --iRec
747 chk_irec_plans
748 (p_rptg_grp_id => p_rec.rptg_grp_id,
749 p_rptg_prps_cd => p_rec.rptg_prps_cd,
750 p_effective_date => p_effective_date,
751 p_business_group_id => p_rec.business_group_id,
752 p_object_version_number => p_rec.object_version_number);
753 --iRec
754 --
755 chk_child_exist_in_other_bg
756 (p_rptg_grp_id => p_rec.rptg_grp_id,
757 p_business_group_id => p_rec.business_group_id,
758 p_effective_date => p_effective_date,
759 p_object_version_number => p_rec.object_version_number) ;
760
761 --
762 hr_utility.set_location(' Leaving:'||l_proc, 10);
763 End update_validate;
764 --
765 -- ----------------------------------------------------------------------------
766 -- |---------------------------< delete_validate >----------------------------|
767 -- ----------------------------------------------------------------------------
768 Procedure delete_validate(p_rec in ben_bnr_shd.g_rec_type
769 ,p_effective_date in date) is
770 --
771 l_proc varchar2(72) := g_package||'delete_validate';
772 --
773 Begin
774 hr_utility.set_location('Entering:'||l_proc, 5);
775 --
776 -- Call all supporting business operations
777
778 -- Bug 2660590
779
780 /* Checking the child record exist or not
781 BEN_PRTG_GRP is not date tracked. So using ZAP for date track mode
782 and 01-JAN-1900 and 31-DEC-4712 as parameters */
783
784 dt_delete_validate
785 (p_rptg_grp_id => p_rec.rptg_grp_id,
786 p_datetrack_mode => 'ZAP',
787 p_validation_start_date => to_date('01/01/1900','DD/MM/YYYY'),
788 p_validation_end_date => to_date('31/12/4712','DD/MM/YYYY'));
789
790 -- End of Bug 2660590
791
792 --
793 hr_utility.set_location(' Leaving:'||l_proc, 10);
794 End delete_validate;
795 --
796 --
797 -- ---------------------------------------------------------------------------
798 -- |---------------------< return_legislation_code >-------------------------|
799 -- ---------------------------------------------------------------------------
800 --
801 function return_legislation_code
802 (p_rptg_grp_id in number) return varchar2 is
803 --
804 -- Declare cursor
805 --
806 cursor csr_leg_code is
807 select a.legislation_code
808 from per_business_groups a,
809 ben_rptg_grp b
810 where b.rptg_grp_id = p_rptg_grp_id
811 and a.business_group_id = b.business_group_id;
812 --
813 -- Declare local variables
814 --
815 l_legislation_code varchar2(150);
816 l_proc varchar2(72) := g_package||'return_legislation_code';
817 --
818 begin
819 --
820 hr_utility.set_location('Entering:'|| l_proc, 10);
821 --
822 -- Ensure that all the mandatory parameter are not null
823 --
824 hr_api.mandatory_arg_error(p_api_name => l_proc,
825 p_argument => 'rptg_grp_id',
826 p_argument_value => p_rptg_grp_id);
827 --
828 open csr_leg_code;
829 --
830 fetch csr_leg_code into l_legislation_code;
831 --
832 /** CWB Changes
833 if csr_leg_code%notfound then
834 --
835 close csr_leg_code;
836 --
837 -- The primary key is invalid therefore we must error
838 --
839 fnd_message.set_name('PAY','HR_7220_INVALID_PRIMARY_KEY');
840 fnd_message.raise_error;
841 --
842 end if;
843 */
844 --
845 close csr_leg_code;
846 --
847 hr_utility.set_location(' Leaving:'|| l_proc, 20);
848 --
849 return l_legislation_code;
850 --
851 end return_legislation_code;
852 --
853 end ben_bnr_bus;