DBA Data[Home] [Help]

PACKAGE BODY: APPS.BEN_EQG_BUS

Source


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