DBA Data[Home] [Help]

PACKAGE BODY: APPS.BEN_PCT_BUS

Source


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