DBA Data[Home] [Help]

PACKAGE BODY: APPS.BEN_EDI_BUS

Source


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