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