DBA Data[Home] [Help]

PACKAGE BODY: APPS.BEN_PST_BUS

Source


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