[Home] [Help]
PACKAGE BODY: APPS.BEN_CBS_BUS
Source
1 Package Body ben_cbs_bus as
2 /* $Header: becbsrhi.pkb 120.1 2006/07/07 06:24:07 gsehgal ship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- | Private Global Definitions |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package varchar2(33) := ' ben_cbs_bus.'; -- Global package name
9 --
10 -- ----------------------------------------------------------------------------
11 -- |------< chk_prem_cstg_by_sgmt_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 -- prem_cstg_by_sgmt_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_prem_cstg_by_sgmt_id(p_prem_cstg_by_sgmt_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_prem_cstg_by_sgmt_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_cbs_shd.api_updating
49 (p_effective_date => p_effective_date,
50 p_prem_cstg_by_sgmt_id => p_prem_cstg_by_sgmt_id,
51 p_object_version_number => p_object_version_number);
52 --
53 if (l_api_updating
54 and nvl(p_prem_cstg_by_sgmt_id,hr_api.g_number)
55 <> ben_cbs_shd.g_old_rec.prem_cstg_by_sgmt_id) then
56 --
57 -- raise error as PK has changed
58 --
59 ben_cbs_shd.constraint_error('BEN_PREM_CSTG_BY_SGMT_PK');
60 --
61 elsif not l_api_updating then
62 --
63 -- check if PK is null
64 --
65 if p_prem_cstg_by_sgmt_id is not null then
66 --
67 -- raise error as PK is not null
68 --
69 ben_cbs_shd.constraint_error('BEN_PREM_CSTG_BY_SGMT_PK');
70 --
71 end if;
72 --
73 end if;
74 --
75 hr_utility.set_location('Leaving:'||l_proc, 10);
76 --
77 End chk_prem_cstg_by_sgmt_id;
78 --
79 -- ----------------------------------------------------------------------------
80 -- |------< chk_sgmt_cstg_mthd_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 -- prem_cstg_by_sgmt_id PK of record being inserted or updated.
91 -- sgmt_cstg_mthd_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_sgmt_cstg_mthd_rl(p_prem_cstg_by_sgmt_id in number,
106 p_sgmt_cstg_mthd_rl in number,
107 p_effective_date in date,
108 p_object_version_number in number) is
109 --
110 l_proc varchar2(72) := g_package||'chk_sgmt_cstg_mthd_rl';
111 l_api_updating boolean;
112 l_dummy varchar2(1);
113 --
114 cursor c1 is
115 select null
116 from ff_formulas_f ff
117 where ff.formula_id = p_sgmt_cstg_mthd_rl
118 and p_effective_date
119 between ff.effective_start_date
120 and ff.effective_end_date;
121 --
122 Begin
123 --
124 hr_utility.set_location('Entering:'||l_proc, 5);
125 --
126 l_api_updating := ben_cbs_shd.api_updating
127 (p_prem_cstg_by_sgmt_id => p_prem_cstg_by_sgmt_id,
128 p_effective_date => p_effective_date,
129 p_object_version_number => p_object_version_number);
130 --
131 if (l_api_updating
132 and nvl(p_sgmt_cstg_mthd_rl,hr_api.g_number)
133 <> ben_cbs_shd.g_old_rec.sgmt_cstg_mthd_rl
134 or not l_api_updating)
135 and p_sgmt_cstg_mthd_rl is not null then
136 --
137 -- check if value of formula rule is valid.
138 --
139 open c1;
140 --
141 -- fetch value from cursor if it returns a record then the
142 -- formula is valid otherwise its invalid
143 --
144 fetch c1 into l_dummy;
145 if c1%notfound then
146 --
147 close c1;
148 --
149 -- raise error
150 --
151 fnd_message.set_name('PAY','FORMULA_DOES_NOT_EXIST');
152 fnd_message.raise_error;
153 --
154 end if;
155 --
156 close c1;
157 --
158 end if;
159 --
160 hr_utility.set_location('Leaving:'||l_proc,10);
161 --
162 end chk_sgmt_cstg_mthd_rl;
163 --
164 -- ----------------------------------------------------------------------------
165 -- |------< chk_sgmt_cstg_mthd_cd >------|
166 -- ----------------------------------------------------------------------------
167 --
168 -- Description
169 -- This procedure is used to check that the lookup value is valid.
170 --
171 -- Pre Conditions
172 -- None.
173 --
174 -- In Parameters
175 -- prem_cstg_by_sgmt_id PK of record being inserted or updated.
176 -- sgmt_cstg_mthd_cd Value of lookup code.
177 -- effective_date effective date
178 -- object_version_number Object version number of record being
179 -- inserted or updated.
180 --
181 -- Post Success
182 -- Processing continues
183 --
184 -- Post Failure
185 -- Error handled by procedure
186 --
187 -- Access Status
188 -- Internal table handler use only.
189 --
190 Procedure chk_sgmt_cstg_mthd_cd(p_prem_cstg_by_sgmt_id in number,
191 p_sgmt_cstg_mthd_cd in varchar2,
192 p_effective_date in date,
193 p_object_version_number in number) is
194 --
195 l_proc varchar2(72) := g_package||'chk_sgmt_cstg_mthd_cd';
196 l_api_updating boolean;
197 --
198 Begin
199 --
200 hr_utility.set_location('Entering:'||l_proc, 5);
201 --
202 l_api_updating := ben_cbs_shd.api_updating
203 (p_prem_cstg_by_sgmt_id => p_prem_cstg_by_sgmt_id,
204 p_effective_date => p_effective_date,
205 p_object_version_number => p_object_version_number);
206 --
207 if (l_api_updating
208 and p_sgmt_cstg_mthd_cd
209 <> nvl(ben_cbs_shd.g_old_rec.sgmt_cstg_mthd_cd,hr_api.g_varchar2)
210 or not l_api_updating) then
211 --
212 -- check if value of lookup falls within lookup type.
213 --
214 --
215 if hr_api.not_exists_in_hr_lookups
216 (p_lookup_type => 'BEN_SGMT_CSTG_MTHD',
217 p_lookup_code => p_sgmt_cstg_mthd_cd,
218 p_effective_date => p_effective_date) then
219 --
220 -- raise error as does not exist as lookup
221 --
222 fnd_message.set_name('BEN','BEN_91628_LOOKUP_TYPE_GENERIC');
223 fnd_message.set_token('FIELD','p_sgmt_cstg_mthd_cd');
224 fnd_message.set_token('TYPE','BEN_SGMT_CSTG_MTHD');
225 fnd_message.raise_error;
226 --
227 end if;
228 --
229 end if;
230 --
231 hr_utility.set_location('Leaving:'||l_proc,10);
232 --
233 end chk_sgmt_cstg_mthd_cd;
234 --
235 -- ----------------------------------------------------------------------------
236 -- |------< chk_code_rule_dpnd >------|
237 -- ----------------------------------------------------------------------------
238 --
239 -- Description
240 -- This procedure is used to check that the Rule is only allowed to
241 -- have a value if the value of the Code = 'Rule', and if code is
242 -- = RL then p_rule must have a value.
243 --
244 -- Pre Conditions
245 -- None.
246 --
247 -- In Parameters
248 -- P_CODE value of code item.
249 -- P_RULE value of rule item
250 --
251 -- Post Success
252 -- Processing continues
253 --
254 -- Post Failure
255 -- Error handled by procedure
256 --
257 -- Access Status -- Internal table handler use only.
258 --
259 Procedure chk_code_rule_dpnd(p_code in varchar2,
260 p_rule in number) is
261 --
262 l_proc varchar2(72) := g_package||'chk_code_rule_dpnd';
263 --
264 Begin
265 --
266 hr_utility.set_location('Entering:'||l_proc, 5);
267 --
268 if p_code <> 'RL' and p_rule is not null then
269 --
270 fnd_message.set_name('BEN','BEN_91624_CD_RL_2');
271 fnd_message.raise_error;
272 --
273 elsif p_code = 'RL' and p_rule is null then
274 --
275 fnd_message.set_name('BEN','BEN_91623_CD_RL_1');
276 fnd_message.raise_error;
277 end if;
278 -- --
279 hr_utility.set_location('Leaving:'||l_proc,10);
280 --
281 end chk_code_rule_dpnd;
282 -- ---------------------------------------------------------------------------
283 -- |-----------------------< chk_sgmt_num_unique >---------------------------|
284 -- ---------------------------------------------------------------------------
285 --
286 -- Description
287 -- ensure that the Sequence Number is unique
288 -- within business_group
289 --
290 -- Pre Conditions
291 -- None.
292 --
293 -- In Parameters
294 -- p_sgmt_num Sequence Number
295 -- p_prem_cstg_by_sgmt_id Primary Key
296 -- p_actl_prem_id Foreign Key to BEN_ACTL_PREM_F
297 -- p_business_group_id
298 --
299 -- Post Success
300 -- Processing continues
301 --
302 -- Post Failure
303 -- Errors handled by the procedure
304 --
305 -- Access Status
306 -- Internal table handler use only.
307 --
308 -- ----------------------------------------------------------------------------
309 Procedure chk_sgmt_num_unique
310 ( p_prem_cstg_by_sgmt_id in number
311 ,p_actl_prem_id in number
312 ,p_sgmt_num in number
313 ,p_business_group_id in number)
314 is
315 l_proc varchar2(72) := g_package||'chk_sgmt_num_unique';
316 l_dummy char(1);
317 cursor c1 is select null
318 from ben_prem_cstg_by_sgmt_f
319 Where prem_cstg_by_sgmt_id <> nvl(p_prem_cstg_by_sgmt_id,-1)
320 and actl_prem_id = p_actl_prem_id
321 and sgmt_num = p_sgmt_num
322 and business_group_id = p_business_group_id;
323 --
324 Begin
325 hr_utility.set_location('Entering:'||l_proc, 5); --
326 open c1;
327 fetch c1 into l_dummy;
328 if c1%found then
329 close c1;
330 fnd_message.set_name('BEN','BEN_91001_SEQ_NOT_UNIQUE');
331 fnd_message.raise_error;
332 end if;
333 --
334 hr_utility.set_location('Leaving:'||l_proc, 15);
335 End chk_sgmt_num_unique;
336 --
337 -- ----------------------------------------------------------------------------
338 -- |------------------------< chk_sgmt_cstg_asnmt_lvl >-----------------------|
339 -- ----------------------------------------------------------------------------
340 --
341 -- Description
342 -- This procedure is used to check that if the actl_prem.prem_asnmt_cd = ploip
343 -- then the sgmt_cstg_mthd_cd can not equal 'from assignment' codes. 'VFA'
344 --
345 -- Pre Conditions
346 -- None.
347 --
348 -- In Parameters
349 -- actl_prem_id actl_prem_id.
350 -- sgmt_cstg_mthd_cd
351 -- effective_date Session date of record.
352 -- business_group_id Business group id of record being inserted.
353 --
354 -- Post Success
355 -- Processing continues
356 --
357 -- Post Failure
358 -- Errors handled by the procedure
359 --
360 -- Access Status
361 -- Internal table handler use only.
362 --
363 Procedure chk_sgmt_cstg_asnmt_lvl(p_actl_prem_id in number,
364 p_sgmt_cstg_mthd_cd in varchar2,
365 p_effective_date in date,
366 p_business_group_id in number) is
367 --
368 l_proc varchar2(72) := g_package||'chk_sgmt_cstg_asnmt_lvl' ;
369 l_api_updating boolean;
370 l_prem_asnmt_lvl_cd hr_lookups.lookup_code%TYPE; -- UTF8varchar2(30);
371 --
372 cursor c1 is
373 select prem_asnmt_lvl_cd from ben_actl_prem_f a
374 where a.business_group_id +0 = p_business_group_id
375 and a.actl_prem_id = p_actl_prem_id
376 and p_effective_date
377 between a.effective_start_date
378 and a.effective_end_date;
379 --
380 Begin
381 --
382 hr_utility.set_location('Entering:'||l_proc, 5);
383 --
384 if p_sgmt_cstg_mthd_cd = 'VFA' then
385 --
386 -- Check if prem_asnmt_lvl_cd is 'PLOIPL'.
387 --
388 open c1;
389 --
390 fetch c1 into l_prem_asnmt_lvl_cd ;
391 if c1%found and l_prem_asnmt_lvl_cd = 'PLOIPL' then
392 --
393 close c1;
394 --
395 -- raise an error as this p_sgmt_cstg_mthd_cd can't = 'VFA'
396 --
397 fnd_message.set_name('BEN','BEN_92257_SGMT_CSTG_ASNMT_LVL');
398 fnd_message.raise_error;
399 --
400 end if;
401 --
402 close c1;
403 --
404 end if;
405 --
406 hr_utility.set_location('Leaving:'||l_proc, 10);
407 --
408 End chk_sgmt_cstg_asnmt_lvl;
409 --
410 -- ----------------------------------------------------------------------------
411 -- |------------------------< chk_parent_data >-------------------------------|
412 -- ----------------------------------------------------------------------------
413 --
414 -- Description
415 -- This procedure is used to check that
416 -- 1) If parent actual premium has PREM_ASNMT_CD=PROC, then no row can be
417 -- inserted in the child table.
418 --
419 -- 2) No row can be inserted if default costing in parent is null.
420 --
421 -- Pre Conditions
422 -- None.
423 --
424 -- In Parameters
425 -- actl_prem_id actl_prem_id.
426 -- business_group_id Business group id of record being inserted.
427 --
428 -- Post Success
429 -- Processing continues
430 --
431 -- Post Failure
432 -- Errors handled by the procedure
433 --
434 -- Access Status
435 -- Internal table handler use only.
436 --
437 Procedure chk_parent_data(p_actl_prem_id in number,
438 p_business_group_id in number,
439 -- bug 5376303
440 p_effective_date in date ) is
441
442 l_proc varchar2(72) := g_package||'chk_parent_data' ;
443 l_prem_asnmt_cd hr_lookups.lookup_code%TYPE; -- UTF8 varchar2(30);
444 l_cost_alloc_cd number(15);
445 --
446 cursor c1 is
447 select a.prem_asnmt_cd,a.cost_allocation_keyflex_id from ben_actl_prem_f a
448 where a.business_group_id +0 = p_business_group_id
449 and a.actl_prem_id = p_actl_prem_id
450 -- bug 5376303
451 and p_effective_date between a.effective_start_date
452 and a.effective_end_date;
453 --
454 Begin
455 --
456 hr_utility.set_location('Entering:'||l_proc, 5);
457 --
458 open c1;
459 --
460 fetch c1 into l_prem_asnmt_cd,l_cost_alloc_cd ;
461 --
462 -- Check if prem_asnmt_cd is 'PROC'.
463 --
464 if c1%found and l_prem_asnmt_cd = 'PROC' then
465 --
466 close c1;
467 --
468 -- raise an error
469 --
470 fnd_message.set_name('BEN','BEN_92529_NO_COST');
471 fnd_message.raise_error;
472 --
473 end if;
474 --
475 if c1%found and l_cost_alloc_cd is null then
476 --
477 close c1;
478 --
479 -- raise an error
480 --
481 fnd_message.set_name('BEN','BEN_92530_DFLT_RQD');
482 fnd_message.raise_error;
483 --
484 end if;
485
486 close c1;
487 --
488 hr_utility.set_location('Leaving:'||l_proc, 10);
489 --
490 End chk_parent_data;
491 -- ----------------------------------------------------------------------------
492 -- |--------------------------< dt_update_validate >--------------------------|
493 -- ----------------------------------------------------------------------------
494 -- {Start Of Comments}
495 --
496 -- Description:
497 -- This procedure is used for referential integrity of datetracked
498 -- parent entities when a datetrack update operation is taking place
499 -- and where there is no cascading of update defined for this entity.
500 --
501 -- Prerequisites:
502 -- This procedure is called from the update_validate.
503 --
504 -- In Parameters:
505 --
506 -- Post Success:
507 -- Processing continues.
508 --
509 -- Post Failure:
510 --
511 -- Developer Implementation Notes:
512 -- This procedure should not need maintenance unless the HR Schema model
513 -- changes.
514 --
515 -- Access Status:
516 -- Internal Row Handler Use Only.
517 --
518 -- {End Of Comments}
519 -- ----------------------------------------------------------------------------
520 Procedure dt_update_validate
521 (p_actl_prem_id in number default hr_api.g_number,
522 p_datetrack_mode in varchar2,
523 p_validation_start_date in date,
524 p_validation_end_date in date) Is
525 --
526 l_proc varchar2(72) := g_package||'dt_update_validate';
527 l_integrity_error Exception;
528 l_table_name all_tables.table_name%TYPE;
529 --
530 Begin
531 hr_utility.set_location('Entering:'||l_proc, 5);
532 --
533 -- Ensure that the p_datetrack_mode argument is not null
534 --
535 hr_api.mandatory_arg_error
536 (p_api_name => l_proc,
537 p_argument => 'datetrack_mode',
538 p_argument_value => p_datetrack_mode);
539 --
540 -- Only perform the validation if the datetrack update mode is valid
541 --
542 If (dt_api.validate_dt_upd_mode(p_datetrack_mode => p_datetrack_mode)) then
543 --
544 --
545 -- Ensure the arguments are not null
546 --
547 hr_api.mandatory_arg_error
548 (p_api_name => l_proc,
549 p_argument => 'validation_start_date',
550 p_argument_value => p_validation_start_date);
551 --
552 hr_api.mandatory_arg_error
553 (p_api_name => l_proc,
554 p_argument => 'validation_end_date',
555 p_argument_value => p_validation_end_date);
556 --
557 If ((nvl(p_actl_prem_id, hr_api.g_number) <> hr_api.g_number) and
558 NOT (dt_api.check_min_max_dates
559 (p_base_table_name => 'ben_actl_prem_f',
560 p_base_key_column => 'actl_prem_id',
561 p_base_key_value => p_actl_prem_id,
562 p_from_date => p_validation_start_date,
563 p_to_date => p_validation_end_date))) Then
564 l_table_name := 'ben_actl_prem_f';
565 Raise l_integrity_error;
566 End If;
567 --
568 End If;
569 --
570 hr_utility.set_location(' Leaving:'||l_proc, 10);
571 Exception
572 When l_integrity_error Then
573 --
574 -- A referential integrity check was violated therefore
575 -- we must error
576 --
577 ben_utility.parent_integrity_error(p_table_name => l_table_name);
578 When Others Then
579 --
580 -- An unhandled or unexpected error has occurred which
581 -- we must report
582 --
583 fnd_message.set_name('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
584 fnd_message.set_token('PROCEDURE', l_proc);
585 fnd_message.set_token('STEP','15');
586 fnd_message.raise_error;
587 End dt_update_validate;
588 --
589 -- ----------------------------------------------------------------------------
590 -- |--------------------------< dt_delete_validate >--------------------------|
591 -- ----------------------------------------------------------------------------
592 -- {Start Of Comments}
593 --
594 -- Description:
595 -- This procedure is used for referential integrity of datetracked
596 -- child entities when either a datetrack DELETE or ZAP is in operation
597 -- and where there is no cascading of delete defined for this entity.
598 -- For the datetrack mode of DELETE or ZAP we must ensure that no
599 -- datetracked child rows exist between the validation start and end
600 -- dates.
601 --
602 -- Prerequisites:
603 -- This procedure is called from the delete_validate.
604 --
605 -- In Parameters:
606 --
607 -- Post Success:
608 -- Processing continues.
609 --
610 -- Post Failure:
611 -- If a row exists by determining the returning Boolean value from the
612 -- generic dt_api.rows_exist function then we must supply an error via
613 -- the use of the local exception handler l_rows_exist.
614 --
615 -- Developer Implementation Notes:
616 -- This procedure should not need maintenance unless the HR Schema model
617 -- changes.
618 --
619 -- Access Status:
620 -- Internal Row Handler Use Only.
621 --
622 -- {End Of Comments}
623 -- ----------------------------------------------------------------------------
624 Procedure dt_delete_validate
625 (p_prem_cstg_by_sgmt_id in number,
626 p_datetrack_mode in varchar2,
627 p_validation_start_date in date,
628 p_validation_end_date in date) Is
629 --
630 l_proc varchar2(72) := g_package||'dt_delete_validate';
631 l_rows_exist Exception;
632 l_table_name all_tables.table_name%TYPE;
633 --
634 Begin
635 hr_utility.set_location('Entering:'||l_proc, 5);
636 --
637 -- Ensure that the p_datetrack_mode argument is not null
638 --
639 hr_api.mandatory_arg_error
640 (p_api_name => l_proc,
641 p_argument => 'datetrack_mode',
642 p_argument_value => p_datetrack_mode);
643 --
644 -- Only perform the validation if the datetrack mode is either
645 -- DELETE or ZAP
646 --
647 If (p_datetrack_mode = 'DELETE' or
648 p_datetrack_mode = 'ZAP') then
649 --
650 --
651 -- Ensure the arguments are not null
652 --
653 hr_api.mandatory_arg_error
654 (p_api_name => l_proc,
655 p_argument => 'validation_start_date',
656 p_argument_value => p_validation_start_date);
657 --
658 hr_api.mandatory_arg_error
659 (p_api_name => l_proc,
660 p_argument => 'validation_end_date',
661 p_argument_value => p_validation_end_date);
662 --
663 hr_api.mandatory_arg_error
664 (p_api_name => l_proc,
665 p_argument => 'prem_cstg_by_sgmt_id',
666 p_argument_value => p_prem_cstg_by_sgmt_id);
667 --
668 --
669 --
670 End If;
671 --
672 hr_utility.set_location(' Leaving:'||l_proc, 10);
673 Exception
674 When l_rows_exist Then
675 --
676 -- A referential integrity check was violated therefore
677 -- we must error
678 --
679 fnd_message.set_name('PAY', 'HR_7215_DT_CHILD_EXISTS');
680 fnd_message.set_token('TABLE_NAME', l_table_name);
681 fnd_message.raise_error;
682 When Others Then
683 --
684 -- An unhandled or unexpected error has occurred which
685 -- we must report
686 --
687 fnd_message.set_name('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
688 fnd_message.set_token('PROCEDURE', l_proc);
689 fnd_message.set_token('STEP','15');
690 fnd_message.raise_error;
691 End dt_delete_validate;
692 --
693 -- ----------------------------------------------------------------------------
694 -- |---------------------------< insert_validate >----------------------------|
695 -- ----------------------------------------------------------------------------
696 Procedure insert_validate
697 (p_rec in ben_cbs_shd.g_rec_type,
698 p_effective_date in date,
699 p_datetrack_mode in varchar2,
700 p_validation_start_date in date,
701 p_validation_end_date in date) is
702 --
703 l_proc varchar2(72) := g_package||'insert_validate';
704 --
705 Begin
706 hr_utility.set_location('Entering:'||l_proc, 5);
707 --
708 -- Call all supporting business operations
709 --
710 --
711 hr_api.validate_bus_grp_id(p_rec.business_group_id); -- Validate Bus Grp
712 --
713 chk_prem_cstg_by_sgmt_id
714 (p_prem_cstg_by_sgmt_id => p_rec.prem_cstg_by_sgmt_id,
715 p_effective_date => p_effective_date,
716 p_object_version_number => p_rec.object_version_number);
717 --
718 chk_sgmt_cstg_mthd_rl
719 (p_prem_cstg_by_sgmt_id => p_rec.prem_cstg_by_sgmt_id,
720 p_sgmt_cstg_mthd_rl => p_rec.sgmt_cstg_mthd_rl,
721 p_effective_date => p_effective_date,
722 p_object_version_number => p_rec.object_version_number);
723 --
724 chk_sgmt_cstg_mthd_cd
725 (p_prem_cstg_by_sgmt_id => p_rec.prem_cstg_by_sgmt_id,
726 p_sgmt_cstg_mthd_cd => p_rec.sgmt_cstg_mthd_cd,
727 p_effective_date => p_effective_date,
728 p_object_version_number => p_rec.object_version_number);
729 --
730 chk_code_rule_dpnd
731 (p_code => p_rec.sgmt_cstg_mthd_cd,
732 p_rule => p_rec.sgmt_cstg_mthd_rl);
733 --
734 chk_sgmt_num_unique
735 (p_prem_cstg_by_sgmt_id => p_rec.prem_cstg_by_sgmt_id,
736 p_actl_prem_id => p_rec.actl_prem_id,
737 p_sgmt_num => p_rec.sgmt_num,
738 p_business_group_id => p_rec.business_group_id);
739 --
740 chk_sgmt_cstg_asnmt_lvl
741 (p_actl_prem_id => p_rec.actl_prem_id,
742 p_sgmt_cstg_mthd_cd => p_rec.sgmt_cstg_mthd_cd,
743 p_effective_date => p_effective_date,
744 p_business_group_id => p_rec.business_group_id);
745 --
746 chk_parent_data
747 (p_actl_prem_id =>p_rec.actl_prem_id,
748 p_business_group_id => p_rec.business_group_id,
749 p_effective_date => p_effective_date );
750 --
751
752 hr_utility.set_location(' Leaving:'||l_proc, 10);
753 End insert_validate;
754 --
755 -- ----------------------------------------------------------------------------
756 -- |---------------------------< update_validate >----------------------------|
757 -- ----------------------------------------------------------------------------
758 Procedure update_validate
759 (p_rec in ben_cbs_shd.g_rec_type,
760 p_effective_date in date,
761 p_datetrack_mode in varchar2,
762 p_validation_start_date in date,
763 p_validation_end_date in date) is
764 --
765 l_proc varchar2(72) := g_package||'update_validate';
766 --
767 Begin
768 hr_utility.set_location('Entering:'||l_proc, 5);
769 --
770 -- Call all supporting business operations
771 --
772 --
773 hr_api.validate_bus_grp_id(p_rec.business_group_id); -- Validate Bus Grp
774 --
775 chk_prem_cstg_by_sgmt_id
776 (p_prem_cstg_by_sgmt_id => p_rec.prem_cstg_by_sgmt_id,
777 p_effective_date => p_effective_date,
778 p_object_version_number => p_rec.object_version_number);
779 --
780 chk_sgmt_cstg_mthd_rl
781 (p_prem_cstg_by_sgmt_id => p_rec.prem_cstg_by_sgmt_id,
782 p_sgmt_cstg_mthd_rl => p_rec.sgmt_cstg_mthd_rl,
783 p_effective_date => p_effective_date,
784 p_object_version_number => p_rec.object_version_number);
785 --
786 chk_sgmt_cstg_mthd_cd
787 (p_prem_cstg_by_sgmt_id => p_rec.prem_cstg_by_sgmt_id,
788 p_sgmt_cstg_mthd_cd => p_rec.sgmt_cstg_mthd_cd,
789 p_effective_date => p_effective_date,
790 p_object_version_number => p_rec.object_version_number);
791 --
792 chk_code_rule_dpnd
793 (p_code => p_rec.sgmt_cstg_mthd_cd,
794 p_rule => p_rec.sgmt_cstg_mthd_rl);
795 --
796 chk_sgmt_num_unique
797 (p_prem_cstg_by_sgmt_id => p_rec.prem_cstg_by_sgmt_id,
798 p_actl_prem_id => p_rec.actl_prem_id,
799 p_sgmt_num => p_rec.sgmt_num,
800 p_business_group_id => p_rec.business_group_id);
801 --
802 chk_sgmt_cstg_asnmt_lvl
803 (p_actl_prem_id => p_rec.actl_prem_id,
804 p_sgmt_cstg_mthd_cd => p_rec.sgmt_cstg_mthd_cd,
805 p_effective_date => p_effective_date,
806 p_business_group_id => p_rec.business_group_id);
807 --
808 chk_parent_data
809 (p_actl_prem_id =>p_rec.actl_prem_id,
810 p_business_group_id => p_rec.business_group_id,
811 p_effective_date => p_effective_date);
812 --
813 -- Call the datetrack update integrity operation
814 --
815 dt_update_validate
816 (p_actl_prem_id => p_rec.actl_prem_id,
817 p_datetrack_mode => p_datetrack_mode,
818 p_validation_start_date => p_validation_start_date,
819 p_validation_end_date => p_validation_end_date);
820 --
821 hr_utility.set_location(' Leaving:'||l_proc, 10);
822 End update_validate;
823 --
824 -- ----------------------------------------------------------------------------
825 -- |---------------------------< delete_validate >----------------------------|
826 -- ----------------------------------------------------------------------------
827 Procedure delete_validate
828 (p_rec in ben_cbs_shd.g_rec_type,
829 p_effective_date in date,
830 p_datetrack_mode in varchar2,
831 p_validation_start_date in date,
832 p_validation_end_date in date) is
833 --
834 l_proc varchar2(72) := g_package||'delete_validate';
835 --
836 Begin
837 hr_utility.set_location('Entering:'||l_proc, 5);
838 --
839 -- Call all supporting business operations
840 --
841 dt_delete_validate
842 (p_datetrack_mode => p_datetrack_mode,
843 p_validation_start_date => p_validation_start_date,
844 p_validation_end_date => p_validation_end_date,
845 p_prem_cstg_by_sgmt_id => p_rec.prem_cstg_by_sgmt_id);
846 --
847 hr_utility.set_location(' Leaving:'||l_proc, 10);
848 End delete_validate;
849 --
850 --
851 -- ---------------------------------------------------------------------------
852 -- |---------------------< return_legislation_code >-------------------------|
853 -- ---------------------------------------------------------------------------
854 --
855 function return_legislation_code
856 (p_prem_cstg_by_sgmt_id in number) return varchar2 is
857 --
858 -- Declare cursor
859 --
860 cursor csr_leg_code is
861 select a.legislation_code
862 from per_business_groups a,
863 ben_prem_cstg_by_sgmt_f b
864 where b.prem_cstg_by_sgmt_id = p_prem_cstg_by_sgmt_id
865 and a.business_group_id = b.business_group_id;
866 --
867 -- Declare local variables
868 --
869 l_legislation_code varchar2(150);
870 l_proc varchar2(72) := g_package||'return_legislation_code';
871 --
872 begin
873 --
874 hr_utility.set_location('Entering:'|| l_proc, 10);
875 --
876 -- Ensure that all the mandatory parameter are not null
877 --
878 hr_api.mandatory_arg_error(p_api_name => l_proc,
879 p_argument => 'prem_cstg_by_sgmt_id',
880 p_argument_value => p_prem_cstg_by_sgmt_id);
881 --
882 open csr_leg_code;
883 --
884 fetch csr_leg_code into l_legislation_code;
885 --
886 if csr_leg_code%notfound then
887 --
888 close csr_leg_code;
889 --
890 -- The primary key is invalid therefore we must error
891 --
892 fnd_message.set_name('PAY','HR_7220_INVALID_PRIMARY_KEY');
893 fnd_message.raise_error;
894 --
895 end if;
896 --
897 close csr_leg_code;
898 --
899 hr_utility.set_location(' Leaving:'|| l_proc, 20);
900 --
901 return l_legislation_code;
902 --
903 end return_legislation_code;
904 --
905 end ben_cbs_bus;