DBA Data[Home] [Help]

PACKAGE BODY: APPS.BEN_ADS_BUS

Source


1 Package Body ben_ads_bus as
2 /* $Header: beadsrhi.pkb 120.0.12010000.3 2008/08/25 14:01:51 ppentapa ship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33)	:= '  ben_ads_bus.';  -- Global package name
9 --
10 -- ----------------------------------------------------------------------------
11 -- |------< chk_acty_rt_ded_sched_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 --   acty_rt_ded_sched_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_acty_rt_ded_sched_id(p_acty_rt_ded_sched_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_acty_rt_ded_sched_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_ads_shd.api_updating
49     (p_effective_date              => p_effective_date,
50      p_acty_rt_ded_sched_id                => p_acty_rt_ded_sched_id,
51      p_object_version_number       => p_object_version_number);
52   --
53   if (l_api_updating
54      and nvl(p_acty_rt_ded_sched_id,hr_api.g_number)
55      <>  ben_ads_shd.g_old_rec.acty_rt_ded_sched_id) then
56     --
57     -- raise error as PK has changed
58     --
59     ben_ads_shd.constraint_error('BEN_ACTY_RT_DED_SCHED_F_PK');
60     --
61   elsif not l_api_updating then
62     --
63     -- check if PK is null
64     --
65     if p_acty_rt_ded_sched_id is not null then
66       --
67       -- raise error as PK is not null
68       --
69       ben_ads_shd.constraint_error('BEN_ACTY_RT_DED_SCHED_F_PK');
70       --
71     end if;
72     --
73   end if;
74   --
75   hr_utility.set_location('Leaving:'||l_proc, 10);
76   --
77 End chk_acty_rt_ded_sched_id;
78 --
79 -- ----------------------------------------------------------------------------
80 -- |------< chk_ded_sched_py_freq_id >------|
81 -- ----------------------------------------------------------------------------
82 --
83 -- Description
84 --   This procedure checks that a referenced foreign key actually exists
85 --   in the referenced table.
86 --
87 -- Pre-Conditions
88 --   None.
89 --
90 -- In Parameters
91 --   p_acty_rt_ded_sched_id PK
92 --   p_ded_sched_py_freq_id ID of FK column
93 --   p_effective_date session date
94 --   p_object_version_number object version number
95 --
96 -- Post Success
97 --   Processing continues
98 --
99 -- Post Failure
100 --   Error raised.
101 --
102 -- Access Status
103 --   Internal table handler use only.
104 --
105 Procedure chk_ded_sched_py_freq_id (p_acty_rt_ded_sched_id          in number,
106                             p_ded_sched_py_freq_id          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_ded_sched_py_freq_id';
111   l_api_updating boolean;
112   l_dummy        varchar2(1);
113   --
114   cursor c1 is
115     select null
116     from   ben_ded_sched_py_freq a
117     where  a.ded_sched_py_freq_id = p_ded_sched_py_freq_id;
118   --
119 Begin
120   --
121   hr_utility.set_location('Entering:'||l_proc,5);
122   --
123   l_api_updating := ben_ads_shd.api_updating
124      (p_acty_rt_ded_sched_id            => p_acty_rt_ded_sched_id,
125       p_effective_date          => p_effective_date,
126       p_object_version_number   => p_object_version_number);
127   --
128   if (l_api_updating
129      and nvl(p_ded_sched_py_freq_id,hr_api.g_number)
130      <> nvl(ben_ads_shd.g_old_rec.ded_sched_py_freq_id,hr_api.g_number)
131      or not l_api_updating) then
132     --
133     -- check if ded_sched_py_freq_id value exists in ben_ded_sched_py_freq table
134     --
135     if p_ded_sched_py_freq_id is not null then
136        open c1;
137          --
138          fetch c1 into l_dummy;
139          if c1%notfound then
140            --
141            close c1;
142            --
143            -- raise error as FK does not relate to PK in ben_ded_sched_py_freq
144            -- table.
145            --
146            ben_ads_shd.constraint_error('BEN_ACTY_RT_DED_SCHED_FK2');
147            --
148          end if;
149          --
150        close c1;
151     end if;
152     --
153   end if;
154   --
155   hr_utility.set_location('Leaving:'||l_proc,10);
156   --
157 End chk_ded_sched_py_freq_id;
158 --
159 -- ----------------------------------------------------------------------------
160 -- |------< chk_ded_sched_cd >------|
161 -- ----------------------------------------------------------------------------
162 --
163 -- Description
164 --   This procedure is used to check that the lookup value is valid.
165 --
166 -- Pre Conditions
167 --   None.
168 --
169 -- In Parameters
170 --   acty_rt_ded_sched_id PK of record being inserted or updated.
171 --   ded_sched_cd Value of lookup code.
172 --   effective_date effective date
173 --   object_version_number Object version number of record being
174 --                         inserted or updated.
175 --
176 -- Post Success
177 --   Processing continues
178 --
179 -- Post Failure
180 --   Error handled by procedure
181 --
182 -- Access Status
183 --   Internal table handler use only.
184 --
185 Procedure chk_ded_sched_cd(p_acty_rt_ded_sched_id                in number,
186                             p_ded_sched_cd               in varchar2,
187                             p_effective_date              in date,
188                             p_object_version_number       in number) is
189   --
190   l_proc         varchar2(72) := g_package||'chk_ded_sched_cd';
191   l_api_updating boolean;
192   --
193 Begin
194   --
195   hr_utility.set_location('Entering:'||l_proc, 5);
196   --
197   l_api_updating := ben_ads_shd.api_updating
198     (p_acty_rt_ded_sched_id                => p_acty_rt_ded_sched_id,
199      p_effective_date              => p_effective_date,
200      p_object_version_number       => p_object_version_number);
201   --
202   if (l_api_updating
203       and p_ded_sched_cd
204       <> nvl(ben_ads_shd.g_old_rec.ded_sched_cd,hr_api.g_varchar2)
205       or not l_api_updating) then
206     --
207     -- check if value of lookup falls within lookup type.
208     --
209     --
210     if hr_api.not_exists_in_hr_lookups
211           (p_lookup_type    => 'BEN_DED_SCHED',
212            p_lookup_code    => p_ded_sched_cd,
213            p_effective_date => p_effective_date) then
214       --
215       -- raise error as does not exist as lookup
216       --
217       fnd_message.set_name('PAY','HR_LOOKUP_DOES_NOT_EXIST');
218       fnd_message.raise_error;
219       --
220     end if;
221     --
222   end if;
223   --
224   hr_utility.set_location('Leaving:'||l_proc,10);
225   --
226 end chk_ded_sched_cd;
227 --
228 -- ----------------------------------------------------------------------------
229 -- |------< chk_ded_sched_rl >------|
230 -- ----------------------------------------------------------------------------
231 --
232 -- Description
233 --   This procedure is used to check that the Formula Rule is valid.
234 --
235 -- Pre Conditions
236 --   None.
237 --
238 -- In Parameters
239 --   acty_rt_ded_sched_id PK of record being inserted or updated.
240 --   ded_sched_rl Value of formula rule id.
241 --   effective_date effective date
242 --   object_version_number Object version number of record being
243 --                         inserted or updated.
244 --
245 -- Post Success
246 --   Processing continues
247 --
248 -- Post Failure
249 --   Error handled by procedure
250 --
251 -- Access Status
252 --   Internal table handler use only.
253 --
254 Procedure chk_ded_sched_rl(p_acty_rt_ded_sched_id          in number,
255                              p_ded_sched_rl                in number,
256                              p_business_group_id           in number,
257                              p_effective_date              in date,
258                              p_object_version_number       in number) is
259   --
260   l_proc         varchar2(72) := g_package||'chk_ded_sched_rl';
261   l_api_updating boolean;
262   l_dummy        varchar2(1);
263   --
264   cursor c1 is
265     select null
266     from   ff_formulas_f ff
267            ,per_business_groups pbg
268     where  ff.formula_id = p_ded_sched_rl
269     and    ff.formula_type_id = -151
270     and    pbg.business_group_id = p_business_group_id
271     and    nvl(ff.business_group_id, p_business_group_id) =
272                p_business_group_id
273     and    nvl(ff.legislation_code, pbg.legislation_code) =
274                pbg.legislation_code
275     and    p_effective_date
276            between ff.effective_start_date
277            and     ff.effective_end_date;
278   --
279 Begin
280   --
281   hr_utility.set_location('Entering:'||l_proc, 5);
282   --
283   l_api_updating := ben_ads_shd.api_updating
284     (p_acty_rt_ded_sched_id                => p_acty_rt_ded_sched_id,
285      p_effective_date              => p_effective_date,
286      p_object_version_number       => p_object_version_number);
287   --
288   if (l_api_updating
289       and nvl(p_ded_sched_rl,hr_api.g_number)
290       <> ben_ads_shd.g_old_rec.ded_sched_rl
291       or not l_api_updating)
292       and p_ded_sched_rl is not null then
293     --
294     -- check if value of formula rule is valid.
295     --
296     open c1;
297       --
298       -- fetch value from cursor if it returns a record then the
299       -- formula is valid otherwise its invalid
300       --
301       fetch c1 into l_dummy;
302       if c1%notfound then
303         --
304         close c1;
305         --
306         -- raise error
307         --
308         fnd_message.set_name('BEN','BEN_91471_FORMULA_NOT_FOUND');
309         fnd_message.set_token('ID',p_ded_sched_rl);
310         fnd_message.set_token('TYPE_ID',-151);
311         fnd_message.raise_error;
312         --
313       end if;
314       --
315     close c1;
316     --
317   end if;
318   --
319   hr_utility.set_location('Leaving:'||l_proc,10);
320   --
321 end chk_ded_sched_rl;
322 --
323 -- ----------------------------------------------------------------------------
324 -- |------------------< chk_dsq_rows_exist >------------------------|
325 -- ----------------------------------------------------------------------------
326 --
327 -- Description
328 --   This procedure is used to check for the existence of non date-tracked
329 --    child rows.
330 --
331 -- Pre Conditions
332 --   None.
333 --
334 -- In Parameters
335 --   acty_rt_ded_sched_id PK of record being inserted or updated.
336 --
337 -- Post Success
338 --   Processing continues
339 --
340 -- Post Failure
341 --   Error handled by procedure
342 --
343 -- Access Status
344 --   Internal table handler use only.
345 --
346 Function  chk_dsq_rows_exist(p_acty_rt_ded_sched_id  in number) Return Boolean
347   is
348   --
349   l_proc         varchar2(72) := g_package||'chk_dsq_rows_exist';
350   l_dummy        varchar2(1);
351   --
352   cursor c1 is
353     select null
354     from ben_ded_sched_py_freq a
355     where a.acty_rt_ded_sched_id = p_acty_rt_ded_sched_id;
356   --
357 Begin
358   --
359   hr_utility.set_location('Entering:'||l_proc,5);
360   --
361   -- check if child rows exist in ben_ded_sched_py_freq
362   --
363   open c1;
364   --
365   fetch c1 into l_dummy;
366   if c1%found then
367         --
368         close c1;
369         -- raise error as child rows exist.
370         --
371         Return(true);
372         -- ben_dsq_shd.constraint_error('BEN_DED_SCHED_PY_FREQ_DT1');
373         --
374   Else
375         --
376         close c1;
377         --
378         Return(false);
379   End if;
380   --
381   hr_utility.set_location('Leaving:'||l_proc,10);
382   --
383 End chk_dsq_rows_exist;
384 --
385 -- ----------------------------------------------------------------------------
386 -- |--------------------------< dt_update_validate >--------------------------|
387 -- ----------------------------------------------------------------------------
388 -- {Start Of Comments}
389 --
390 -- Description:
391 --   This procedure is used for referential integrity of datetracked
392 --   parent entities when a datetrack update operation is taking place
393 --   and where there is no cascading of update defined for this entity.
394 --
395 -- Prerequisites:
396 --   This procedure is called from the update_validate.
397 --
398 -- In Parameters:
399 --
400 -- Post Success:
401 --   Processing continues.
402 --
403 -- Post Failure:
404 --
405 -- Developer Implementation Notes:
406 --   This procedure should not need maintenance unless the HR Schema model
407 --   changes.
408 --
409 -- Access Status:
410 --   Internal Row Handler Use Only.
411 --
412 -- {End Of Comments}
413 -- ----------------------------------------------------------------------------
414 Procedure dt_update_validate
415             (p_acty_base_rt_id               in number default hr_api.g_number,
416 	     p_datetrack_mode		     in varchar2,
417              p_validation_start_date	     in date,
418 	     p_validation_end_date	     in date) Is
419 --
420   l_proc	    varchar2(72) := g_package||'dt_update_validate';
421   l_integrity_error Exception;
422   l_table_name	    all_tables.table_name%TYPE;
423 --
424 Begin
425   hr_utility.set_location('Entering:'||l_proc, 5);
426   --
427   -- Ensure that the p_datetrack_mode argument is not null
428   --
429   hr_api.mandatory_arg_error
430     (p_api_name       => l_proc,
431      p_argument       => 'datetrack_mode',
432      p_argument_value => p_datetrack_mode);
433   --
434   -- Only perform the validation if the datetrack update mode is valid
435   --
436   If (dt_api.validate_dt_upd_mode(p_datetrack_mode => p_datetrack_mode)) then
437     --
438     --
439     -- Ensure the arguments are not null
440     --
441     hr_api.mandatory_arg_error
442       (p_api_name       => l_proc,
443        p_argument       => 'validation_start_date',
444        p_argument_value => p_validation_start_date);
445     --
446     hr_api.mandatory_arg_error
447       (p_api_name       => l_proc,
448        p_argument       => 'validation_end_date',
449        p_argument_value => p_validation_end_date);
450     --
451     If ((nvl(p_acty_base_rt_id, hr_api.g_number) <> hr_api.g_number) and
452       NOT (dt_api.check_min_max_dates
453             (p_base_table_name => 'ben_acty_base_rt_f',
454              p_base_key_column => 'acty_base_rt_id',
455              p_base_key_value  => p_acty_base_rt_id,
456              p_from_date       => p_validation_start_date,
457              p_to_date         => p_validation_end_date)))  Then
458       l_table_name := 'ben_acty_base_rt_f';
459       Raise l_integrity_error;
460     End If;
461     --
462   End If;
463   --
464   hr_utility.set_location(' Leaving:'||l_proc, 10);
465 Exception
466   When l_integrity_error Then
467     --
468     -- A referential integrity check was violated therefore
469     -- we must error
470     --
471        ben_utility.parent_integrity_error(p_table_name => l_table_name);
472     --
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_acty_rt_ded_sched_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       => 'acty_rt_ded_sched_id',
561        p_argument_value => p_acty_rt_ded_sched_id);
562     --
563     If (chk_dsq_rows_exist
564         (p_acty_rt_ded_sched_id => p_acty_rt_ded_sched_id)) Then
565        --
566        l_table_name := 'ben_ded_sched_py_freq';
567        Raise l_rows_exist;
568        --
569     End if;
570     --
571     --
572   End If;
573   --
574   hr_utility.set_location(' Leaving:'||l_proc, 10);
575 Exception
576   When l_rows_exist Then
577     --
578     -- A referential integrity check was violated therefore
579     -- we must error
580     --
581        ben_utility.child_exists_error(p_table_name => l_table_name);
582     --
583   When Others Then
584     --
585     -- An unhandled or unexpected error has occurred which
586     -- we must report
587     --
588     fnd_message.set_name('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
589     fnd_message.set_token('PROCEDURE', l_proc);
593 --
590     fnd_message.set_token('STEP','15');
591     fnd_message.raise_error;
592 End dt_delete_validate;
594 -- ----------------------------------------------------------------------------
595 -- |---------------------------< insert_validate >----------------------------|
596 -- ----------------------------------------------------------------------------
597 Procedure insert_validate
598 	(p_rec 			 in ben_ads_shd.g_rec_type,
599 	 p_effective_date	 in date,
600 	 p_datetrack_mode	 in varchar2,
601 	 p_validation_start_date in date,
602 	 p_validation_end_date	 in date) is
603 --
604   l_proc	varchar2(72) := g_package||'insert_validate';
605 --
606 Begin
607   hr_utility.set_location('Entering:'||l_proc, 5);
608   --
609   -- Call all supporting business operations
610   --
611   --
612   hr_api.validate_bus_grp_id(p_rec.business_group_id);  -- Validate Bus Grp
613   --
614   chk_acty_rt_ded_sched_id
615   (p_acty_rt_ded_sched_id          => p_rec.acty_rt_ded_sched_id,
616    p_effective_date        => p_effective_date,
617    p_object_version_number => p_rec.object_version_number);
618   --
619   chk_ded_sched_py_freq_id
620   (p_acty_rt_ded_sched_id          => p_rec.acty_rt_ded_sched_id,
621    p_ded_sched_py_freq_id          => p_rec.ded_sched_py_freq_id,
622    p_effective_date        => p_effective_date,
623    p_object_version_number => p_rec.object_version_number);
624   --
625   chk_ded_sched_cd
626   (p_acty_rt_ded_sched_id          => p_rec.acty_rt_ded_sched_id,
627    p_ded_sched_cd         => p_rec.ded_sched_cd,
628    p_effective_date        => p_effective_date,
629    p_object_version_number => p_rec.object_version_number);
630   --
631   chk_ded_sched_rl
632   (p_acty_rt_ded_sched_id          => p_rec.acty_rt_ded_sched_id,
633    p_ded_sched_rl        => p_rec.ded_sched_rl,
634    p_business_group_id     => p_rec.business_group_id,
635    p_effective_date        => p_effective_date,
636    p_object_version_number => p_rec.object_version_number);
637   --
638   hr_utility.set_location(' Leaving:'||l_proc, 10);
639 End insert_validate;
640 --
641 -- ----------------------------------------------------------------------------
642 -- |---------------------------< update_validate >----------------------------|
643 -- ----------------------------------------------------------------------------
644 Procedure update_validate
645 	(p_rec 			 in ben_ads_shd.g_rec_type,
646 	 p_effective_date	 in date,
647 	 p_datetrack_mode	 in varchar2,
648 	 p_validation_start_date in date,
649 	 p_validation_end_date	 in date) is
650 --
651   l_proc	varchar2(72) := g_package||'update_validate';
652 --
653 Begin
654   hr_utility.set_location('Entering:'||l_proc, 5);
655   --
656   -- Call all supporting business operations
657   --
658   --
659   hr_api.validate_bus_grp_id(p_rec.business_group_id);  -- Validate Bus Grp
660   --
661   chk_acty_rt_ded_sched_id
662   (p_acty_rt_ded_sched_id          => p_rec.acty_rt_ded_sched_id,
663    p_effective_date        => p_effective_date,
664    p_object_version_number => p_rec.object_version_number);
665   --
666   chk_ded_sched_py_freq_id
667   (p_acty_rt_ded_sched_id          => p_rec.acty_rt_ded_sched_id,
668    p_ded_sched_py_freq_id          => p_rec.ded_sched_py_freq_id,
669    p_effective_date        => p_effective_date,
670    p_object_version_number => p_rec.object_version_number);
671   --
672   chk_ded_sched_cd
673   (p_acty_rt_ded_sched_id          => p_rec.acty_rt_ded_sched_id,
674    p_ded_sched_cd         => p_rec.ded_sched_cd,
675    p_effective_date        => p_effective_date,
676    p_object_version_number => p_rec.object_version_number);
677   --
678   chk_ded_sched_rl
679   (p_acty_rt_ded_sched_id          => p_rec.acty_rt_ded_sched_id,
680    p_ded_sched_rl        => p_rec.ded_sched_rl,
681    p_business_group_id     => p_rec.business_group_id,
682    p_effective_date        => p_effective_date,
683    p_object_version_number => p_rec.object_version_number);
684   --
685   -- Call the datetrack update integrity operation
686   --
687   dt_update_validate
688     (p_acty_base_rt_id               => p_rec.acty_base_rt_id,
689      p_datetrack_mode                => p_datetrack_mode,
690      p_validation_start_date	     => p_validation_start_date,
691      p_validation_end_date	     => p_validation_end_date);
692   --
693   hr_utility.set_location(' Leaving:'||l_proc, 10);
694 End update_validate;
695 --
696 -- ----------------------------------------------------------------------------
697 -- |---------------------------< delete_validate >----------------------------|
698 -- ----------------------------------------------------------------------------
699 Procedure delete_validate
700 	(p_rec 			 in ben_ads_shd.g_rec_type,
701 	 p_effective_date	 in date,
702 	 p_datetrack_mode	 in varchar2,
703 	 p_validation_start_date in date,
704 	 p_validation_end_date	 in date) is
705 --
706   l_proc	varchar2(72) := g_package||'delete_validate';
707 --
708 Begin
709   hr_utility.set_location('Entering:'||l_proc, 5);
710   --
711   -- Call all supporting business operations
712   --
713   dt_delete_validate
714     (p_datetrack_mode		=> p_datetrack_mode,
715      p_validation_start_date	=> p_validation_start_date,
716      p_validation_end_date	=> p_validation_end_date,
717      p_acty_rt_ded_sched_id		=> p_rec.acty_rt_ded_sched_id);
718   --
719   hr_utility.set_location(' Leaving:'||l_proc, 10);
720 End delete_validate;
721 --
722 --
723 --  ---------------------------------------------------------------------------
724 --  |---------------------< return_legislation_code >-------------------------|
725 --  ---------------------------------------------------------------------------
726 --
727 function return_legislation_code
728   (p_acty_rt_ded_sched_id in number) return varchar2 is
729   --
730   -- Declare cursor
731   --
732   cursor csr_leg_code is
733     select a.legislation_code
734     from   per_business_groups a,
735            ben_acty_rt_ded_sched_f b
736     where b.acty_rt_ded_sched_id      = p_acty_rt_ded_sched_id
737     and   a.business_group_id = b.business_group_id;
738   --
739   -- Declare local variables
740   --
741   l_legislation_code  varchar2(150);
742   l_proc              varchar2(72)  :=  g_package||'return_legislation_code';
743   --
744 begin
745   --
746   hr_utility.set_location('Entering:'|| l_proc, 10);
747   --
748   -- Ensure that all the mandatory parameter are not null
749   --
750   hr_api.mandatory_arg_error(p_api_name       => l_proc,
751                              p_argument       => 'acty_rt_ded_sched_id',
752                              p_argument_value => p_acty_rt_ded_sched_id);
753   --
754   open csr_leg_code;
755     --
756     fetch csr_leg_code into l_legislation_code;
757     --
758     if csr_leg_code%notfound then
759       --
760       close csr_leg_code;
761       --
762       -- The primary key is invalid therefore we must error
763       --
764       fnd_message.set_name('PAY','HR_7220_INVALID_PRIMARY_KEY');
765       fnd_message.raise_error;
766       --
767     end if;
768     --
769   close csr_leg_code;
770   --
771   hr_utility.set_location(' Leaving:'|| l_proc, 20);
772   --
773   return l_legislation_code;
774   --
775 end return_legislation_code;
776 --
777 end ben_ads_bus;