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