[Home] [Help]
PACKAGE BODY: APPS.BEN_XIC_BUS
Source
1 Package Body ben_xic_bus as
2 /* $Header: bexicrhi.pkb 120.2 2006/03/20 13:02:22 tjesumic noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- | Private Global Definitions |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package varchar2(33) := ' ben_xic_bus.'; -- Global package name
9 -- ---------------------------------------------------------------------------
10 -- |----------------------< set_security_group_id >--------------------------|
11 -- ---------------------------------------------------------------------------
12 --
13 -- ----------------------------------------------------------------------------
14 -- |----------------------< not_exists_in_hr_lookups >------------------------|
15 -- ----------------------------------------------------------------------------
16 --
17 function not_exists_in_hr_lookups
18 (p_effective_date in date
19 ,p_lookup_type in varchar2
20 ,p_lookup_code in varchar2
21 ) return boolean is
22 --
23 -- Declare Local Variables
24 --
25 l_exists varchar2(1);
26 --
27 -- Declare Local cursors
28 --
29 cursor csr_hr_look is
30 select null
31 from hr_lookups
32 where lookup_code = p_lookup_code
33 and lookup_type = p_lookup_type
34 and p_effective_date between
35 nvl(start_date_active, p_effective_date)
36 and nvl(end_date_active, p_effective_date);
37 --
38 begin
39 --
40 -- When the lookup_type is YES_NO attempt to validate without
41 -- executing the cursor. This is to reduce checking time for
42 -- valid values in row handlers which have a lot of Yes No flags.
43 --
44 if p_lookup_type = 'YES_NO' then
45 if p_lookup_code = 'Y' or p_lookup_code = 'N' then
46 return false;
47 end if;
48 -- If the value is not known then go onto check against the
49 -- hr_lookups view. Just in case there has been a change to
50 -- the system defined lookup.
51 end if;
52 hr_utility.set_location(hr_api.g_package||'not_exists_in_hr_lookups', 10);
53 --
54 open csr_hr_look;
55 fetch csr_hr_look into l_exists;
56 if csr_hr_look%notfound then
57 close csr_hr_look;
58 return true;
59 else
60 close csr_hr_look;
61 return false;
62 end if;
63 end not_exists_in_hr_lookups;
64 --
65 -- ----------------------------------------------------------------------------
66 -- |---------------------< not_exists_in_hrstanlookups >----------------------|
67 -- ----------------------------------------------------------------------------
68 --
69 function not_exists_in_hrstanlookups
70 (p_effective_date in date
71 ,p_lookup_type in varchar2
72 ,p_lookup_code in varchar2
73 ) return boolean is
74 --
75 -- Declare Local Variables
76 --
77 l_exists varchar2(1);
78 --
79 -- Declare Local cursors
80 --
81 cursor csr_hr_look is
82 select null
83 from hr_standard_lookups
84 where lookup_code = p_lookup_code
85 and lookup_type = p_lookup_type
86 and p_effective_date between
87 nvl(start_date_active, p_effective_date)
88 and nvl(end_date_active, p_effective_date);
89 --
90 begin
91 --
92 -- When the lookup_type is YES_NO attempt to validate without
93 -- executing the cursor. This is to reduce checking time for
94 -- valid values in row handlers which have a lot of Yes No flags.
95 --
96 if p_lookup_type = 'YES_NO' then
97 if p_lookup_code = 'Y' or p_lookup_code = 'N' then
98 return false;
99 end if;
100 -- If the value is not known then go onto check against the
101 -- hr_lookups view. Just in case there has been a change to
102 -- the system defined lookup.
103 end if;
104 hr_utility.set_location(hr_api.g_package||'not_exists_in_hrstanlookups', 10);
105 --
106 open csr_hr_look;
107 fetch csr_hr_look into l_exists;
108 if csr_hr_look%notfound then
109 close csr_hr_look;
110 return true;
111 else
112 close csr_hr_look;
113 return false;
114 end if;
115
116 end not_exists_in_hrstanlookups;
117
118 --
119
120 Procedure set_security_group_id
121 (p_ext_incl_chg_id in number
122 ) is
123 --
124 -- Declare cursor
125 --
126 cursor csr_sec_grp is
127 select pbg.security_group_id
128 from per_business_groups_perf pbg
129 , ben_ext_incl_chg xic
130 where xic.ext_incl_chg_id = p_ext_incl_chg_id
131 and pbg.business_group_id = xic.business_group_id;
132 --
133 -- Declare local variables
134 --
135 l_security_group_id number;
136 l_proc varchar2(72) := g_package||'set_security_group_id';
137 --
138 begin
139 --
140 hr_utility.set_location('Entering:'|| l_proc, 10);
141 --
142 -- Ensure that all the mandatory parameter are not null
143 --
144 hr_api.mandatory_arg_error
145 (p_api_name => l_proc
146 ,p_argument => 'ext_incl_chg_id'
147 ,p_argument_value => p_ext_incl_chg_id
148 );
149 --
150 open csr_sec_grp;
151 fetch csr_sec_grp into l_security_group_id;
152 --
153 if csr_sec_grp%notfound then
154 --
155 close csr_sec_grp;
156 --
157 -- The primary key is invalid therefore we must error
158 --
159 fnd_message.set_name('PAY','HR_7220_INVALID_PRIMARY_KEY');
160 fnd_message.raise_error;
161 --
162 end if;
163 close csr_sec_grp;
164 --
165 -- Set the security_group_id in CLIENT_INFO
166 --
167 hr_api.set_security_group_id
168 (p_security_group_id => l_security_group_id
169 );
170 --
171 hr_utility.set_location(' Leaving:'|| l_proc, 20);
172 --
173 end set_security_group_id;
174 --
175 --
176 -- ----------------------------------------------------------------------------
177 -- |------< chk_ext_incl_chg_id >------|
178 -- ----------------------------------------------------------------------------
179 --
180 -- Description
181 -- This procedure is used to check that the primary key for the table
182 -- is created properly. It should be null on insert and
183 -- should not be able to be updated.
184 --
185 -- Pre Conditions
186 -- None.
187 --
188 -- In Parameters
189 -- ext_incl_chg_id PK of record being inserted or updated.
190 -- object_version_number Object version number of record being
191 -- inserted or updated.
192 --
193 -- Post Success
194 -- Processing continues
195 --
196 -- Post Failure
197 -- Errors handled by the procedure
198 --
199 -- Access Status
200 -- Internal table handler use only.
201 --
202 Procedure chk_ext_incl_chg_id(p_ext_incl_chg_id in number,
203 p_object_version_number in number) is
204 --
205 l_proc varchar2(72) := g_package||'chk_ext_incl_chg_id';
206 l_api_updating boolean;
207 --
208 Begin
209 --
210 hr_utility.set_location('Entering:'||l_proc, 5);
211 --
212 l_api_updating := ben_xic_shd.api_updating
213 (p_ext_incl_chg_id => p_ext_incl_chg_id,
214 p_object_version_number => p_object_version_number);
215 --
216 if (l_api_updating
217 and nvl(p_ext_incl_chg_id,hr_api.g_number)
218 <> ben_xic_shd.g_old_rec.ext_incl_chg_id) then
219 --
220 -- raise error as PK has changed
221 --
222 ben_xic_shd.constraint_error('BEN_EXT_INCL_CHG_PK');
223 --
224 elsif not l_api_updating then
225 --
226 -- check if PK is null
227 --
228 if p_ext_incl_chg_id is not null then
229 --
230 -- raise error as PK is not null
231 --
232 ben_xic_shd.constraint_error('BEN_EXT_INCL_CHG_PK');
233 --
234 end if;
235 --
236 end if;
237 --
238 hr_utility.set_location('Leaving:'||l_proc, 10);
239 --
240 End chk_ext_incl_chg_id;
241 --
242 -- ----------------------------------------------------------------------------
243 -- |------< chk_ext_rcd_in_file_id >------|
244 -- ----------------------------------------------------------------------------
245 --
246 -- Description
247 -- This procedure checks that a referenced foreign key actually exists
248 -- in the referenced table.
249 --
250 -- Pre-Conditions
251 -- None.
252 --
253 -- In Parameters
254 -- p_ext_incl_chg_id PK
255 -- p_ext_rcd_in_file_id ID of FK column
256 -- p_object_version_number object version number
257 --
258 -- Post Success
259 -- Processing continues
260 --
261 -- Post Failure
262 -- Error raised.
263 --
264 -- Access Status
265 -- Internal table handler use only.
266 --
267 Procedure chk_ext_rcd_in_file_id (p_ext_incl_chg_id in number,
268 p_ext_rcd_in_file_id in number,
269 p_object_version_number in number) is
270 --
271 l_proc varchar2(72) := g_package||'chk_ext_rcd_in_file_id';
272 l_api_updating boolean;
273 l_dummy varchar2(1);
274 --
275 cursor c1 is
276 select null
277 from ben_ext_rcd_in_file a
278 where a.ext_rcd_in_file_id = p_ext_rcd_in_file_id;
279 --
280 Begin
281 --
282 hr_utility.set_location('Entering:'||l_proc,5);
283 --
284 l_api_updating := ben_xic_shd.api_updating
285 (p_ext_incl_chg_id => p_ext_incl_chg_id,
286 p_object_version_number => p_object_version_number);
287 --
288 if (l_api_updating
289 and nvl(p_ext_rcd_in_file_id,hr_api.g_number)
290 <> nvl(ben_xic_shd.g_old_rec.ext_rcd_in_file_id,hr_api.g_number)
291 or not l_api_updating) and
292 p_ext_rcd_in_file_id is not null then
293 --
294 -- check if ext_rcd_in_file_id value exists in ben_ext_rcd_in_file table
295 --
296 open c1;
297 --
298 fetch c1 into l_dummy;
299 if c1%notfound then
300 --
301 close c1;
302 --
303 -- raise error as FK does not relate to PK in ben_ext_rcd_in_file
304 -- table.
305 --
306 ben_xic_shd.constraint_error('BEN_EXT_INCL_CHG_FK2');
307 --
308 end if;
309 --
310 close c1;
311 --
312 end if;
313 --
314 hr_utility.set_location('Leaving:'||l_proc,10);
315 --
316 End chk_ext_rcd_in_file_id;
317 --
318 -- ----------------------------------------------------------------------------
319 -- |------< chk_ext_data_elmt_in_rcd_id >------|
320 -- ----------------------------------------------------------------------------
321 --
322 -- Description
323 -- This procedure checks that a referenced foreign key actually exists
324 -- in the referenced table.
325 --
326 -- Pre-Conditions
327 -- None.
328 --
329 -- In Parameters
330 -- p_ext_incl_chg_id PK
331 -- p_ext_data_elmt_in_rcd_id ID of FK column
332 -- p_object_version_number object version number
333 --
334 -- Post Success
335 -- Processing continues
336 --
337 -- Post Failure
338 -- Error raised.
339 --
340 -- Access Status
341 -- Internal table handler use only.
342 --
343 Procedure chk_ext_data_elmt_in_rcd_id (p_ext_incl_chg_id in number,
344 p_ext_data_elmt_in_rcd_id in number,
345 p_object_version_number in number) is
346 --
347 l_proc varchar2(72) := g_package||'chk_ext_data_elmt_in_rcd_id';
348 l_api_updating boolean;
349 l_dummy varchar2(1);
350 --
351 cursor c1 is
352 select null
353 from ben_ext_data_elmt_in_rcd a
354 where a.ext_data_elmt_in_rcd_id = p_ext_data_elmt_in_rcd_id;
355 --
356 Begin
357 --
358 hr_utility.set_location('Entering:'||l_proc,5);
359 --
360 l_api_updating := ben_xic_shd.api_updating
361 (p_ext_incl_chg_id => p_ext_incl_chg_id,
362 p_object_version_number => p_object_version_number);
363 --
364 if (l_api_updating
365 and nvl(p_ext_data_elmt_in_rcd_id,hr_api.g_number)
366 <> nvl(ben_xic_shd.g_old_rec.ext_data_elmt_in_rcd_id,hr_api.g_number)
367 or not l_api_updating) and
368 p_ext_data_elmt_in_rcd_id is not null then
369 --
370 -- check if ext_data_elmt_in_rcd_id value exists in ben_ext_data_elmt_in_rcd table
371 --
372 open c1;
373 --
374 fetch c1 into l_dummy;
375 if c1%notfound then
376 --
377 close c1;
378 --
379 -- raise error as FK does not relate to PK in ben_ext_data_elmt_in_rcd
380 -- table.
381 --
382 ben_xic_shd.constraint_error('BEN_EXT_INCL_CHG_FK1');
383 --
384 end if;
385 --
386 close c1;
387 --
388 end if;
389 --
390 hr_utility.set_location('Leaving:'||l_proc,10);
391 --
392 End chk_ext_data_elmt_in_rcd_id;
393 --
394 -- ----------------------------------------------------------------------------
395 -- |------< chk_chg_evt_cd >------|
396 -- ----------------------------------------------------------------------------
397 --
398 -- Description
399 -- This procedure is used to check that the lookup value is valid.
400 --
401 -- Pre Conditions
402 -- None.
403 --
404 -- In Parameters
405 -- ext_incl_chg_id PK of record being inserted or updated.
406 -- chg_evt_cd Value of lookup code.
407 -- effective_date effective date
408 -- object_version_number Object version number of record being
409 -- inserted or updated.
410 --
411 -- Post Success
412 -- Processing continues
413 --
414 -- Post Failure
415 -- Error handled by procedure
416 --
417 -- Access Status
418 -- Internal table handler use only.
419 --
420 Procedure chk_chg_evt_cd(p_ext_incl_chg_id in number,
421 p_ext_rcd_in_file_id in number,
422 p_ext_data_elmt_in_rcd_id in number,
423 p_chg_evt_cd in varchar2,
424 p_chg_evt_source in varchar2,
425 p_effective_date in date,
426 p_business_group_id in number,
427 p_object_version_number in number) is
428 --
429 l_proc varchar2(72) := g_package||'chk_chg_evt_cd';
430 l_api_updating boolean;
431 --
432 cursor c1 is select sprs_cd
433 from ben_ext_rcd_in_file
434 where ext_rcd_in_file_id = p_ext_rcd_in_file_id;
435 cursor c2 is select sprs_cd
436 from ben_ext_data_elmt_in_rcd
437 where ext_data_elmt_in_rcd_id = p_ext_data_elmt_in_rcd_id;
438
439 cursor c3 is
440 select 'x'
441 from pay_event_groups
442 where event_group_id = p_chg_evt_cd
443 ;
444 l_dummy varchar2(1) ;
445 Begin
446 --
447 hr_utility.set_location('Entering:'||l_proc, 5);
448 hr_utility.set_location('Inside .hrstanlookups..'||l_proc||' '||p_chg_evt_cd, 8);
449 --
450 l_api_updating := ben_xic_shd.api_updating
451 (p_ext_incl_chg_id => p_ext_incl_chg_id,
452 p_object_version_number => p_object_version_number);
453 --
454 if (l_api_updating
455 and p_chg_evt_cd
456 <> nvl(ben_xic_shd.g_old_rec.chg_evt_cd,hr_api.g_varchar2)
457 or not l_api_updating)
458 and p_chg_evt_cd is not null then
459 --
460 -- check if value of lookup falls within lookup type.
461 --
462 if p_chg_evt_source is null or p_chg_evt_source = 'BEN' then
463 if p_business_group_id is not null then
464 if hr_api.not_exists_in_hr_lookups
465 (p_lookup_type => 'BEN_EXT_CHG_EVT',
466 p_lookup_code => p_chg_evt_cd,
467 p_effective_date => p_effective_date) then
468 --
469 -- raise error as does not exist as lookup
470 --
471
472 fnd_message.set_name('BEN','BEN_91628_LOOKUP_TYPE_GENERIC');
473 -- Commented for Bug 2493525
474 /*
475 fnd_message.set_token('FIELD','p_chg_evt_cd');
476 fnd_message.set_token('TYPE','BEN_EXT_CHG_EVT');
477 */
478 fnd_message.set_token('VALUE',p_chg_evt_cd);
479 fnd_message.set_token('FIELD','Value');
480 fnd_message.set_token('TYPE','BEN_EXT_CHG_EVT');
481 -- End of Bug 2493525
482
483 fnd_message.raise_error;
484 --
485 end if;
486 --
487 else
488 if not_exists_in_hrstanlookups
489 (p_lookup_type => 'BEN_EXT_CHG_EVT',
490 p_lookup_code => p_chg_evt_cd,
491 p_effective_date => p_effective_date) then
492 --
493 -- raise error as does not exist as lookup
494 --
495
496 fnd_message.set_name('BEN','BEN_91628_LOOKUP_TYPE_GENERIC');
497 -- Commented for Bug 2493525
498 /*
499 fnd_message.set_token('FIELD','p_chg_evt_cd');
500 fnd_message.set_token('TYPE','BEN_EXT_CHG_EVT');
501 */
502 fnd_message.set_token('VALUE',p_chg_evt_cd);
503 fnd_message.set_token('FIELD','Value');
504 fnd_message.set_token('TYPE','BEN_EXT_CHG_EVT');
505 -- End of Bug 2493525
506 fnd_message.raise_error;
507 --
508 end if;
509 --
510 end if;
511 end if ;
512 --- pay roll change event
513 if p_chg_evt_source = 'PAY' then
514 open c3 ;
515 fetch c3 into l_dummy ;
516 if c3%notfound then
517 close c3 ;
518 fnd_message.set_token('VALUE',p_chg_evt_cd);
519 fnd_message.set_token('FIELD','Value');
520 fnd_message.set_token('TYPE','BEN_EXT_CHG_EVT');
521 end if ;
522 close c3 ;
523
524 end if ;
525 --
526 /*if p_ext_rcd_in_file_id is not null then
527 for crec in c1 loop
528 if (p_chg_evt_cd is null and crec.sprs_cd= 'C') or
529 (p_chg_evt_cd is not null and crec.sprs_cd='A') then
530 fnd_message.set_name('BEN','BEN_91869_CHG_EVT_NULL');
531 fnd_message.raise_error;
532 end if;
533 end loop;
534 end if;
535
536 if p_ext_data_elmt_in_rcd_id is not null then
537 for crec in c2 loop
538 if (p_chg_evt_cd is null and crec.sprs_cd= 'C') or
539 (p_chg_evt_cd is not null and crec.sprs_cd='A') then
540 fnd_message.set_name('BEN','BEN_91869_CHG_EVT_NULL');
541 fnd_message.raise_error;
542 end if;
543 end loop;
544 end if;*/
545 end if;
546 --
547 hr_utility.set_location('Leaving:'||l_proc,10);
548 --
549 end chk_chg_evt_cd;
550 --
551 --
552
553
554 Procedure chk_unique_chg_evt_cd(p_ext_incl_chg_id in number,
555 p_ext_rcd_in_file_id in number,
556 p_ext_data_elmt_in_rcd_id in number,
557 p_chg_evt_cd in varchar2,
558 p_chg_evt_source in varchar2,
559 p_effective_date in date,
560 p_business_group_id in number,
561 p_object_version_number in number) is
562 --
563 l_proc varchar2(72) := g_package||'chk_unique_chg_evt_cd';
564 l_api_updating boolean;
565 --
566 cursor c1 is select 'x'
567 from ben_ext_incl_chg
568 where ext_rcd_in_file_id = p_ext_rcd_in_file_id
569 and chg_evt_cd = p_chg_evt_cd
570 and (p_ext_incl_chg_id <> ext_incl_chg_id or p_ext_incl_chg_id is null ) ;
571
572
573 cursor c2 is select 'x'
574 from ben_ext_incl_chg
575 where ext_data_elmt_in_rcd_id = p_ext_data_elmt_in_rcd_id
576 and chg_evt_cd = p_chg_evt_cd
577 and (p_ext_incl_chg_id <> ext_incl_chg_id or p_ext_incl_chg_id is null ) ;
578 l_dummy varchar2(1) ;
579 Begin
580 --
581 hr_utility.set_location('Entering:'||l_proc, 5);
582 hr_utility.set_location('Inside .hrstanlookups..'||l_proc||' '||p_chg_evt_cd, 8);
583 --
584 if p_ext_rcd_in_file_id is not null then
585 open c1 ;
586 fetch c1 into l_dummy ;
587 if c1%found then
588 close c1 ;
589 fnd_message.set_name('BEN','BEN_91912_EXT_VAL1_NOT_UNIQUE');
590 fnd_message.raise_error;
591 end if ;
592 close c1 ;
593
594 end if ;
595
596 if p_ext_data_elmt_in_rcd_id is not null then
597 open c2 ;
598 fetch c2 into l_dummy ;
599 if c2%found then
600 close c2 ;
601 fnd_message.set_name('BEN','BEN_91912_EXT_VAL1_NOT_UNIQUE');
602 fnd_message.raise_error;
603
604 end if ;
605 close c2 ;
606 end if ;
607
608 --
609 hr_utility.set_location('Leaving:'||l_proc,10);
610 --
611 end chk_unique_chg_evt_cd;
612 --
613
614
615 -- ----------------------------------------------------------------------------
616 -- |----------------------< chk_startup_action >------------------------------|
617 -- ----------------------------------------------------------------------------
618 --
619 -- Description:
620 -- This procedure will check that the current action is allowed according
621 -- to the current startup mode.
622 --
623 -- ----------------------------------------------------------------------------
624 PROCEDURE chk_startup_action
625 (p_insert IN boolean
626 ,p_business_group_id IN number
627 ,p_legislation_code IN varchar2
628 ,p_legislation_subgroup IN varchar2 DEFAULT NULL) IS
629 --
630 BEGIN
631 --
632 -- Call the supporting procedure to check startup mode
633 --
634 IF (p_insert) THEN
635 --
636 -- Call procedure to check startup_action for inserts.
637 --
638 hr_startup_data_api_support.chk_startup_action
639 (p_generic_allowed => TRUE
640 ,p_startup_allowed => TRUE
641 ,p_user_allowed => TRUE
642 ,p_business_group_id => p_business_group_id
643 ,p_legislation_code => p_legislation_code
644 ,p_legislation_subgroup => p_legislation_subgroup
645 );
646 ELSE
647 --
648 -- Call procedure to check startup_action for updates and deletes.
649 --
650 hr_startup_data_api_support.chk_upd_del_startup_action
651 (p_generic_allowed => TRUE
652 ,p_startup_allowed => TRUE
653 ,p_user_allowed => TRUE
654 ,p_business_group_id => p_business_group_id
655 ,p_legislation_code => p_legislation_code
656 ,p_legislation_subgroup => p_legislation_subgroup
657 );
658 END IF;
659 --
660 END chk_startup_action;
661 --
662 -- ----------------------------------------------------------------------------
663 -- |---------------------------< insert_validate >----------------------------|
664 -- ----------------------------------------------------------------------------
665 Procedure insert_validate(p_rec in ben_xic_shd.g_rec_type
666 ,p_effective_date in date) is
667 --
668 l_proc varchar2(72) := g_package||'insert_validate';
669 --
670 Begin
671 hr_utility.set_location('Entering:'||l_proc, 5);
672 --
673 -- Call all supporting business operations
674 --
675 --
676 chk_startup_action(True
677 ,p_rec.business_group_id
678 ,p_rec.legislation_code);
679 IF hr_startup_data_api_support.g_startup_mode NOT IN ('GENERIC','STARTUP') THEN
680 hr_api.validate_bus_grp_id(p_rec.business_group_id); -- Validate bus_grp
681 END IF;
682 --
683 chk_ext_incl_chg_id
684 (p_ext_incl_chg_id => p_rec.ext_incl_chg_id,
685 p_object_version_number => p_rec.object_version_number);
686 --
687 chk_ext_rcd_in_file_id
688 (p_ext_incl_chg_id => p_rec.ext_incl_chg_id,
689 p_ext_rcd_in_file_id => p_rec.ext_rcd_in_file_id,
690 p_object_version_number => p_rec.object_version_number);
691 --
692 chk_ext_data_elmt_in_rcd_id
693 (p_ext_incl_chg_id => p_rec.ext_incl_chg_id,
694 p_ext_data_elmt_in_rcd_id => p_rec.ext_data_elmt_in_rcd_id,
695 p_object_version_number => p_rec.object_version_number);
696 --
697 chk_chg_evt_cd
698 (p_ext_incl_chg_id => p_rec.ext_incl_chg_id,
699 p_ext_rcd_in_file_id =>p_rec.ext_rcd_in_file_id,
700 p_ext_data_elmt_in_rcd_id =>p_rec.ext_data_elmt_in_rcd_id,
701 p_chg_evt_cd => p_rec.chg_evt_cd,
702 p_chg_evt_source => p_rec.chg_evt_source,
703 p_effective_date => p_effective_date,
704 p_business_group_id => p_rec.business_group_id,
705 p_object_version_number => p_rec.object_version_number);
706 --
707 chk_unique_chg_evt_cd
708 (p_ext_incl_chg_id => p_rec.ext_incl_chg_id,
709 p_ext_rcd_in_file_id =>p_rec.ext_rcd_in_file_id,
710 p_ext_data_elmt_in_rcd_id =>p_rec.ext_data_elmt_in_rcd_id,
711 p_chg_evt_cd => p_rec.chg_evt_cd,
712 p_chg_evt_source => p_rec.chg_evt_source,
713 p_effective_date => p_effective_date,
714 p_business_group_id => p_rec.business_group_id,
715 p_object_version_number => p_rec.object_version_number);
716 hr_utility.set_location(' Leaving:'||l_proc, 10);
717 End insert_validate;
718 --
719 -- ----------------------------------------------------------------------------
720 -- |---------------------------< update_validate >----------------------------|
721 -- ----------------------------------------------------------------------------
722 Procedure update_validate(p_rec in ben_xic_shd.g_rec_type
723 ,p_effective_date in date) is
724 --
725 l_proc varchar2(72) := g_package||'update_validate';
726 --
727 Begin
728 hr_utility.set_location('Entering:'||l_proc, 5);
729 --
730 -- Call all supporting business operations
731 --
732 --
733 chk_startup_action(False
734 ,p_rec.business_group_id
735 ,p_rec.legislation_code);
736 IF hr_startup_data_api_support.g_startup_mode NOT IN ('GENERIC','STARTUP') THEN
737 hr_api.validate_bus_grp_id(p_rec.business_group_id); -- Validate bus_grp
738 END IF;
739 --
740 chk_ext_incl_chg_id
741 (p_ext_incl_chg_id => p_rec.ext_incl_chg_id,
742 p_object_version_number => p_rec.object_version_number);
743 --
744 chk_ext_rcd_in_file_id
745 (p_ext_incl_chg_id => p_rec.ext_incl_chg_id,
746 p_ext_rcd_in_file_id => p_rec.ext_rcd_in_file_id,
747 p_object_version_number => p_rec.object_version_number);
748 --
749 chk_ext_data_elmt_in_rcd_id
750 (p_ext_incl_chg_id => p_rec.ext_incl_chg_id,
751 p_ext_data_elmt_in_rcd_id => p_rec.ext_data_elmt_in_rcd_id,
752 p_object_version_number => p_rec.object_version_number);
753 --
754 chk_chg_evt_cd
755 (p_ext_incl_chg_id => p_rec.ext_incl_chg_id,
756 p_ext_rcd_in_file_id =>p_rec.ext_rcd_in_file_id,
757 p_ext_data_elmt_in_rcd_id =>p_rec.ext_data_elmt_in_rcd_id,
758 p_chg_evt_cd => p_rec.chg_evt_cd,
759 p_chg_evt_source => p_rec.chg_evt_source,
760 p_effective_date => p_effective_date,
761 p_business_group_id => p_rec.business_group_id,
762 p_object_version_number => p_rec.object_version_number);
763 --
764 chk_unique_chg_evt_cd
765 (p_ext_incl_chg_id => p_rec.ext_incl_chg_id,
766 p_ext_rcd_in_file_id =>p_rec.ext_rcd_in_file_id,
767 p_ext_data_elmt_in_rcd_id =>p_rec.ext_data_elmt_in_rcd_id,
768 p_chg_evt_cd => p_rec.chg_evt_cd,
769 p_chg_evt_source => p_rec.chg_evt_source,
770 p_effective_date => p_effective_date,
771 p_business_group_id => p_rec.business_group_id,
772 p_object_version_number => p_rec.object_version_number);
773 hr_utility.set_location(' Leaving:'||l_proc, 10);
774 End update_validate;
775 --
776 -- ----------------------------------------------------------------------------
777 -- |---------------------------< delete_validate >----------------------------|
778 -- ----------------------------------------------------------------------------
779 Procedure delete_validate(p_rec in ben_xic_shd.g_rec_type
780 ,p_effective_date in date) is
781 --
782 l_proc varchar2(72) := g_package||'delete_validate';
783 --
784 Begin
785 hr_utility.set_location('Entering:'||l_proc, 5);
786 --
787 -- Call all supporting business operations
788 --
789 --
790 chk_startup_action(False
791 ,ben_xic_shd.g_old_rec.business_group_id
792 ,ben_xic_shd.g_old_rec.legislation_code);
793 --
794 hr_utility.set_location(' Leaving:'||l_proc, 10);
795 End delete_validate;
796 --
797 --
798 -- ---------------------------------------------------------------------------
799 -- |---------------------< return_legislation_code >-------------------------|
800 -- ---------------------------------------------------------------------------
801 --
802 function return_legislation_code
803 (p_ext_incl_chg_id in number) return varchar2 is
804 --
805 -- Declare cursor
806 --
807 cursor csr_leg_code is
808 select b.business_group_id
809 from ben_ext_incl_chg b
810 where b.ext_incl_chg_id = p_ext_incl_chg_id
811 ;
812 --
813 -- Declare local variables
814 --
815 l_legislation_code varchar2(150);
816 l_business_group_id number ;
817 l_proc varchar2(72) := g_package||'return_legislation_code';
818 --
819 begin
820 --
821 hr_utility.set_location('Entering:'|| l_proc, 10);
822 --
823 -- Ensure that all the mandatory parameter are not null
824 --
825 hr_api.mandatory_arg_error(p_api_name => l_proc,
826 p_argument => 'ext_incl_chg_id',
827 p_argument_value => p_ext_incl_chg_id);
828 --
829 open csr_leg_code;
830 --
831 fetch csr_leg_code into l_business_group_id ;
832 --
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 l_legislation_code := hr_api.return_legislation_code(l_business_group_id) ;
845 --
846 close csr_leg_code;
847 --
848 hr_utility.set_location(' Leaving:'|| l_proc, 20);
849 --
850 return l_legislation_code;
851 --
852 end return_legislation_code;
853 --
854 end ben_xic_bus;