DBA Data[Home] [Help]

PACKAGE BODY: APPS.BEN_OUR_BUS

Source


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