DBA Data[Home] [Help]

PACKAGE BODY: APPS.BEN_EBU_BUS

Source


1 Package Body ben_ebu_bus as
2 /* $Header: beeburhi.pkb 120.1 2006/02/27 00:17:54 rtagarra noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33)	:= '  ben_ebu_bus.';  -- Global package name
9 --
10 -- ----------------------------------------------------------------------------
11 -- |------< chk_elig_brgng_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_brgng_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_brgng_unit_prte_id(p_elig_brgng_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_brgng_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_ebu_shd.api_updating
49     (p_effective_date              => p_effective_date,
50      p_elig_brgng_unit_prte_id                => p_elig_brgng_unit_prte_id,
51      p_object_version_number       => p_object_version_number);
52   --
53   if (l_api_updating
54      and nvl(p_elig_brgng_unit_prte_id,hr_api.g_number)
55      <>  ben_ebu_shd.g_old_rec.elig_brgng_unit_prte_id) then
56     --
57     -- raise error as PK has changed
58     --
59     ben_ebu_shd.constraint_error('BEN_ELIG_BRGNG_UNIT_TO_PRTE_PK');
60     --
61   elsif not l_api_updating then
62     --
63     -- check if PK is null
64     --
65     if p_elig_brgng_unit_prte_id is not null then
66       --
67       -- raise error as PK is not null
68       --
69       ben_ebu_shd.constraint_error('BEN_ELIG_BRGNG_UNIT_TO_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_brgng_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_brgng_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_brgng_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_ebu_shd.api_updating
118     (p_elig_brgng_unit_prte_id                => p_elig_brgng_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_ebu_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_brgng_unit_cd >------|
150 -- ----------------------------------------------------------------------------
151 --
152 -- Description
153 --   This procedure is used to check that the lookup value is valid.
154 --
155 -- Pre Conditions
156 --   None.
157 --
158 -- In Parameters
159 --   elig_brgng_unit_prte_id PK of record being inserted or updated.
160 --   brgng_unit_cd Value of lookup code.
161 --   effective_date effective date
162 --   object_version_number Object version number of record being
163 --                         inserted or updated.
164 --
165 -- Post Success
166 --   Processing continues
167 --
168 -- Post Failure
169 --   Error handled by procedure
170 --
171 -- Access Status
172 --   Internal table handler use only.
173 --
174 Procedure chk_brgng_unit_cd(p_elig_brgng_unit_prte_id     in number,
175                             p_brgng_unit_cd               in varchar2,
176                             p_eligy_prfl_id               in number,
177                             p_validation_start_date       in date,
178                             p_validation_end_date         in date,
179                             p_business_group_id           in number,
180                             p_effective_date              in date,
181                             p_object_version_number       in number) is
182   --
183   l_proc         varchar2(72) := g_package||'chk_brgng_unit_cd';
184   l_api_updating boolean;
185   l_exists       varchar2(1);
186   --
187   --
188   cursor c3 is
189      select null
190        from ben_elig_brgng_unit_prte_f
191          where brgng_unit_cd = p_brgng_unit_cd
192            and eligy_prfl_id = p_eligy_prfl_id
193            and elig_brgng_unit_prte_id <> nvl(p_elig_brgng_unit_prte_id,hr_api.g_number)
194            and business_group_id + 0 = p_business_group_id
195            and p_validation_start_date <= effective_end_date
196            and p_validation_end_date >= effective_start_date
197            ;
198   --
199 Begin
200   --
201   hr_utility.set_location('Entering:'||l_proc, 5);
202   --
203   l_api_updating := ben_ebu_shd.api_updating
204     (p_elig_brgng_unit_prte_id                => p_elig_brgng_unit_prte_id,
205      p_effective_date              => p_effective_date,
206      p_object_version_number       => p_object_version_number);
207   --
208   if (l_api_updating
209       and p_brgng_unit_cd
210       <> nvl(ben_ebu_shd.g_old_rec.brgng_unit_cd,hr_api.g_varchar2)
211       or not l_api_updating) then
212     --
213     -- check if value of lookup falls within lookup type.
214     --
215     --
216     if hr_api.not_exists_in_hr_lookups
217           (p_lookup_type    => 'BARGAINING_UNIT_CODE',
218            p_lookup_code    => p_brgng_unit_cd,
219            p_effective_date => p_effective_date) then
220       --
221       -- raise error as does not exist as lookup
222       --
223       fnd_message.set_name('PAY','HR_LOOKUP_DOES_NOT_EXIST');
224       fnd_message.raise_error;
225       --
226     end if;
227     --
228 --
229     open c3;
230     fetch c3 into l_exists;
231     if c3%found then
232       close c3;
233       --
234       -- raise error as this criteria already exists for this profile
235     --
236      fnd_message.set_name('BEN', 'BEN_91349_DUP_ELIG_CRITERIA');
237      fnd_message.raise_error;
238     --
239     end if;
240     close c3;
241     --
242   end if;
243   --
244   hr_utility.set_location('Leaving:'||l_proc,10);
245   --
246 end chk_brgng_unit_cd;
247 --
248 --Bug:5054189
249 -- ---------------------------------------------------------------------------
250 -- |-----------------------< chk_duplicate_ordr_num >---------------------------|
251 -- ---------------------------------------------------------------------------
252 --
253 -- Description
254 --   Ensure that the Sequence Number is unique
255 --   within business_group
256 --
257 -- Pre Conditions
258 --   None.
259 --
260 -- In Parameters
261 --   p_elig_brgng_unit_prte_id   elig_brgng_unit_prte_id
262 --   p_eligy_prfl_id             eligy_prfl_id
263 --   p_ordr_num                  Sequence Number
264 --   p_business_group_id
265 --
266 -- Post Success
267 --   Processing continues
268 --
269 -- Post Failure
270 --   Errors handled by the procedure
271 --
272 -- Access Status
273 --   Internal table handler use only
274 --
275 
276 Procedure chk_duplicate_ordr_num
277           ( p_elig_brgng_unit_prte_id  in   number
278            ,p_eligy_prfl_id               in   number
279            ,p_ordr_num                    in   number
280            ,p_business_group_id           in   number)
281 is
282   l_proc     varchar2(72) := g_package||'chk_duplicate_ordr_num';
283   l_dummy    char(1);
284   cursor c1 is
285     select null
286     from   ben_elig_brgng_unit_prte_f
287     where  elig_brgng_unit_prte_id <> nvl(p_elig_brgng_unit_prte_id,-1)
288     and    eligy_prfl_id = p_eligy_prfl_id
289     and    ordr_num = p_ordr_num
290     and    business_group_id = p_business_group_id;
291 --
292 Begin
293   hr_utility.set_location('Entering:'||l_proc, 5);
294   --
295   open c1;
296   fetch c1 into l_dummy;
297   if c1%found then
298     close c1;
299     fnd_message.set_name('BEN','BEN_91001_SEQ_NOT_UNIQUE');
300     fnd_message.raise_error;
301   end if;
302   close c1;
303   --
304   hr_utility.set_location('Leaving:'||l_proc, 15);
305 End chk_duplicate_ordr_num;
306 -- ----------------------------------------------------------------------------
307 -- |--------------------------< dt_update_validate >--------------------------|
308 -- ----------------------------------------------------------------------------
309 -- {Start Of Comments}
310 --
311 -- Description:
312 --   This procedure is used for referential integrity of datetracked
313 --   parent entities when a datetrack update operation is taking place
314 --   and where there is no cascading of update defined for this entity.
315 --
316 -- Prerequisites:
317 --   This procedure is called from the update_validate.
318 --
319 -- In Parameters:
320 --
321 -- Post Success:
322 --   Processing continues.
323 --
324 -- Post Failure:
325 --
326 -- Developer Implementation Notes:
327 --   This procedure should not need maintenance unless the HR Schema model
328 --   changes.
329 --
330 -- Access Status:
331 --   Internal Row Handler Use Only.
332 --
333 -- {End Of Comments}
334 -- ----------------------------------------------------------------------------
335 Procedure dt_update_validate
336             (p_eligy_prfl_id                 in number default hr_api.g_number,
337 	     p_datetrack_mode		     in varchar2,
338              p_validation_start_date	     in date,
339 	     p_validation_end_date	     in date) Is
340 --
341   l_proc	    varchar2(72) := g_package||'dt_update_validate';
342   l_integrity_error Exception;
343   l_table_name	    all_tables.table_name%TYPE;
344 --
345 Begin
346   hr_utility.set_location('Entering:'||l_proc, 5);
347   --
348   -- Ensure that the p_datetrack_mode argument is not null
349   --
350   hr_api.mandatory_arg_error
351     (p_api_name       => l_proc,
352      p_argument       => 'datetrack_mode',
353      p_argument_value => p_datetrack_mode);
354   --
355   -- Only perform the validation if the datetrack update mode is valid
356   --
357   If (dt_api.validate_dt_upd_mode(p_datetrack_mode => p_datetrack_mode)) then
358     --
359     --
360     -- Ensure the arguments are not null
361     --
362     hr_api.mandatory_arg_error
363       (p_api_name       => l_proc,
364        p_argument       => 'validation_start_date',
365        p_argument_value => p_validation_start_date);
366     --
367     hr_api.mandatory_arg_error
368       (p_api_name       => l_proc,
369        p_argument       => 'validation_end_date',
370        p_argument_value => p_validation_end_date);
371     --
372     If ((nvl(p_eligy_prfl_id, hr_api.g_number) <> hr_api.g_number) and
373       NOT (dt_api.check_min_max_dates
374             (p_base_table_name => 'ben_eligy_prfl_f',
375              p_base_key_column => 'eligy_prfl_id',
376              p_base_key_value  => p_eligy_prfl_id,
377              p_from_date       => p_validation_start_date,
378              p_to_date         => p_validation_end_date)))  Then
379       l_table_name := 'ben_eligy_prfl_f';
380       Raise l_integrity_error;
381     End If;
382     --
383   End If;
384   --
385   hr_utility.set_location(' Leaving:'||l_proc, 10);
386 Exception
387   When l_integrity_error Then
388     --
389     -- A referential integrity check was violated therefore
390     -- we must error
391     --
392        ben_utility.parent_integrity_error(p_table_name => l_table_name);
393     --
394   When Others Then
395     --
396     -- An unhandled or unexpected error has occurred which
397     -- we must report
398     --
399     fnd_message.set_name('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
400     fnd_message.set_token('PROCEDURE', l_proc);
401     fnd_message.set_token('STEP','15');
402     fnd_message.raise_error;
403 End dt_update_validate;
404 --
405 -- ----------------------------------------------------------------------------
406 -- |--------------------------< dt_delete_validate >--------------------------|
407 -- ----------------------------------------------------------------------------
408 -- {Start Of Comments}
409 --
410 -- Description:
411 --   This procedure is used for referential integrity of datetracked
412 --   child entities when either a datetrack DELETE or ZAP is in operation
413 --   and where there is no cascading of delete defined for this entity.
414 --   For the datetrack mode of DELETE or ZAP we must ensure that no
415 --   datetracked child rows exist between the validation start and end
416 --   dates.
417 --
418 -- Prerequisites:
419 --   This procedure is called from the delete_validate.
420 --
421 -- In Parameters:
422 --
423 -- Post Success:
424 --   Processing continues.
425 --
426 -- Post Failure:
427 --   If a row exists by determining the returning Boolean value from the
428 --   generic dt_api.rows_exist function then we must supply an error via
429 --   the use of the local exception handler l_rows_exist.
430 --
431 -- Developer Implementation Notes:
432 --   This procedure should not need maintenance unless the HR Schema model
433 --   changes.
434 --
435 -- Access Status:
436 --   Internal Row Handler Use Only.
437 --
438 -- {End Of Comments}
439 -- ----------------------------------------------------------------------------
440 Procedure dt_delete_validate
441             (p_elig_brgng_unit_prte_id		in number,
442              p_datetrack_mode		in varchar2,
443 	     p_validation_start_date	in date,
444 	     p_validation_end_date	in date) Is
445 --
446   l_proc	varchar2(72) 	:= g_package||'dt_delete_validate';
447   l_rows_exist	Exception;
448   l_table_name	all_tables.table_name%TYPE;
449 --
450 Begin
451   hr_utility.set_location('Entering:'||l_proc, 5);
452   --
453   -- Ensure that the p_datetrack_mode argument is not null
454   --
455   hr_api.mandatory_arg_error
456     (p_api_name       => l_proc,
457      p_argument       => 'datetrack_mode',
458      p_argument_value => p_datetrack_mode);
459   --
460   -- Only perform the validation if the datetrack mode is either
461   -- DELETE or ZAP
462   --
463   If (p_datetrack_mode = 'DELETE' or
464       p_datetrack_mode = 'ZAP') then
465     --
466     --
467     -- Ensure the arguments are not null
468     --
469     hr_api.mandatory_arg_error
470       (p_api_name       => l_proc,
471        p_argument       => 'validation_start_date',
472        p_argument_value => p_validation_start_date);
473     --
474     hr_api.mandatory_arg_error
475       (p_api_name       => l_proc,
476        p_argument       => 'validation_end_date',
477        p_argument_value => p_validation_end_date);
478     --
479     hr_api.mandatory_arg_error
480       (p_api_name       => l_proc,
481        p_argument       => 'elig_brgng_unit_prte_id',
482        p_argument_value => p_elig_brgng_unit_prte_id);
483     --
484     --
485     --
486   End If;
487   --
488   hr_utility.set_location(' Leaving:'||l_proc, 10);
489 Exception
490   When l_rows_exist Then
491     --
492     -- A referential integrity check was violated therefore
493     -- we must error
494     --
495        ben_utility.child_exists_error(p_table_name => l_table_name);
496     --
497   When Others Then
498     --
499     -- An unhandled or unexpected error has occurred which
500     -- we must report
501     --
502     fnd_message.set_name('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
503     fnd_message.set_token('PROCEDURE', l_proc);
504     fnd_message.set_token('STEP','15');
505     fnd_message.raise_error;
506 End dt_delete_validate;
507 --
508 -- ----------------------------------------------------------------------------
509 -- |---------------------------< insert_validate >----------------------------|
510 -- ----------------------------------------------------------------------------
511 Procedure insert_validate
512 	(p_rec 			 in ben_ebu_shd.g_rec_type,
513 	 p_effective_date	 in date,
514 	 p_datetrack_mode	 in varchar2,
515 	 p_validation_start_date in date,
516 	 p_validation_end_date	 in date) is
517 --
518   l_proc	varchar2(72) := g_package||'insert_validate';
519 --
520 Begin
521   hr_utility.set_location('Entering:'||l_proc, 5);
522   --
523   -- Call all supporting business operations
524   --
525   --
526   hr_api.validate_bus_grp_id(p_rec.business_group_id);  -- Validate Bus Grp
527   --
528   chk_elig_brgng_unit_prte_id
529   (p_elig_brgng_unit_prte_id          => p_rec.elig_brgng_unit_prte_id,
530    p_effective_date        => p_effective_date,
531    p_object_version_number => p_rec.object_version_number);
532   --
533   chk_excld_flag
534   (p_elig_brgng_unit_prte_id          => p_rec.elig_brgng_unit_prte_id,
535    p_excld_flag         => p_rec.excld_flag,
536    p_effective_date        => p_effective_date,
537    p_object_version_number => p_rec.object_version_number);
538   --
539   chk_brgng_unit_cd
540   (p_elig_brgng_unit_prte_id          => p_rec.elig_brgng_unit_prte_id,
541    p_brgng_unit_cd         => p_rec.brgng_unit_cd,
542    p_eligy_prfl_id         => p_rec.eligy_prfl_id,
543    p_validation_start_date => p_validation_start_date,
544    p_validation_end_date   => p_validation_end_date,
545    p_business_group_id     => p_rec.business_group_id,
546    p_effective_date        => p_effective_date,
547    p_object_version_number => p_rec.object_version_number);
548   --
549  chk_duplicate_ordr_num
550 ( p_elig_brgng_unit_prte_id      => p_rec.elig_brgng_unit_prte_id
551  ,p_eligy_prfl_id             	 => p_rec.eligy_prfl_id
552  ,p_ordr_num                  	 => p_rec.ordr_num
553  ,p_business_group_id         	 => p_rec.business_group_id);
554  --
555 
556   hr_utility.set_location(' Leaving:'||l_proc, 10);
557 End insert_validate;
558 --
559 -- ----------------------------------------------------------------------------
560 -- |---------------------------< update_validate >----------------------------|
561 -- ----------------------------------------------------------------------------
562 Procedure update_validate
563 	(p_rec 			 in ben_ebu_shd.g_rec_type,
564 	 p_effective_date	 in date,
565 	 p_datetrack_mode	 in varchar2,
566 	 p_validation_start_date in date,
567 	 p_validation_end_date	 in date) is
568 --
569   l_proc	varchar2(72) := g_package||'update_validate';
570 --
571 Begin
572   hr_utility.set_location('Entering:'||l_proc, 5);
573   --
574   -- Call all supporting business operations
575   --
576   --
577   hr_api.validate_bus_grp_id(p_rec.business_group_id);  -- Validate Bus Grp
578   --
579   chk_elig_brgng_unit_prte_id
580   (p_elig_brgng_unit_prte_id          => p_rec.elig_brgng_unit_prte_id,
581    p_effective_date        => p_effective_date,
582    p_object_version_number => p_rec.object_version_number);
583   --
584   chk_excld_flag
585   (p_elig_brgng_unit_prte_id          => p_rec.elig_brgng_unit_prte_id,
586    p_excld_flag         => p_rec.excld_flag,
587    p_effective_date        => p_effective_date,
588    p_object_version_number => p_rec.object_version_number);
589   --
590   chk_brgng_unit_cd
591   (p_elig_brgng_unit_prte_id          => p_rec.elig_brgng_unit_prte_id,
592    p_brgng_unit_cd         => p_rec.brgng_unit_cd,
593    p_eligy_prfl_id         => p_rec.eligy_prfl_id,
594    p_validation_start_date => p_validation_start_date,
595    p_validation_end_date   => p_validation_end_date,
596    p_business_group_id     => p_rec.business_group_id,
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_brgng_unit_prte_id      => p_rec.elig_brgng_unit_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  -- Call the datetrack update integrity operation
607   --
608   dt_update_validate
609     (p_eligy_prfl_id                 => p_rec.eligy_prfl_id,
610      p_datetrack_mode                => p_datetrack_mode,
611      p_validation_start_date	     => p_validation_start_date,
612      p_validation_end_date	     => p_validation_end_date);
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_ebu_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_brgng_unit_prte_id		=> p_rec.elig_brgng_unit_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_brgng_unit_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_brgng_unit_prte_f b
657     where b.elig_brgng_unit_prte_id      = p_elig_brgng_unit_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_brgng_unit_prte_id',
673                              p_argument_value => p_elig_brgng_unit_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_ebu_bus;