DBA Data[Home] [Help]

PACKAGE BODY: APPS.BEN_EOU_BUS

Source


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