DBA Data[Home] [Help]

PACKAGE BODY: APPS.BEN_EFP_BUS

Source


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