DBA Data[Home] [Help]

PACKAGE BODY: APPS.BEN_FTR_BUS

Source


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