DBA Data[Home] [Help]

PACKAGE BODY: APPS.BEN_ESA_BUS

Source


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