DBA Data[Home] [Help]

PACKAGE BODY: APPS.BEN_PRM_BUS

Source


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