DBA Data[Home] [Help]

PACKAGE BODY: APPS.BEN_LMM_BUS

Source


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