DBA Data[Home] [Help]

PACKAGE BODY: APPS.BEN_PRB_BUS

Source


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