DBA Data[Home] [Help]

PACKAGE BODY: APPS.BEN_LGL_BUS

Source


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