DBA Data[Home] [Help]

PACKAGE BODY: APPS.BEN_PRR_BUS

Source


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