DBA Data[Home] [Help]

PACKAGE BODY: APPS.BEN_OPR_BUS

Source


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