DBA Data[Home] [Help]

PACKAGE BODY: APPS.BEN_ECY_BUS

Source


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