DBA Data[Home] [Help]

PACKAGE BODY: APPS.BEN_VRR_BUS

Source


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