DBA Data[Home] [Help]

PACKAGE BODY: APPS.BEN_AVA_BUS

Source


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