DBA Data[Home] [Help]

PACKAGE BODY: APPS.BEN_EAR_BUS

Source


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