DBA Data[Home] [Help]

PACKAGE BODY: APPS.BEN_BTR_BUS

Source


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