DBA Data[Home] [Help]

PACKAGE BODY: APPS.BEN_BUR_BUS

Source


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