DBA Data[Home] [Help]

PACKAGE BODY: APPS.BEN_ECQ_BUS

Source


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