DBA Data[Home] [Help]

PACKAGE BODY: APPS.BEN_ERG_BUS

Source


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