DBA Data[Home] [Help]

PACKAGE BODY: APPS.BEN_ADE_BUS

Source


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