DBA Data[Home] [Help]

PACKAGE BODY: APPS.BEN_CMR_BUS

Source


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