DBA Data[Home] [Help]

PACKAGE BODY: APPS.BEN_LCC_BUS

Source


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