DBA Data[Home] [Help]

PACKAGE BODY: APPS.PAY_RFM_BUS

Source


1 Package Body pay_rfm_bus as
2 /* $Header: pyrfmrhi.pkb 120.0 2005/05/29 08:20 appldev noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33) := '  pay_rfm_bus.';  -- Global package name
9 --
10 --  ---------------------------------------------------------------------------
11 --  |----------------------< set_security_group_id >--------------------------|
12 --  ---------------------------------------------------------------------------
13 --
14 Procedure set_security_group_id
15   (p_report_format_mapping_id             in number
16   ,p_associated_column1                   in varchar2 default null
17   ) is
18   --
19   -- Declare cursor
20   --
21   cursor csr_sec_grp is
22     select pbg.security_group_id,
23            pbg.legislation_code
24       from per_business_groups_perf pbg
25          , pay_report_format_mappings_f rfm
26      where rfm.report_format_mapping_id = p_report_format_mapping_id
27        and pbg.business_group_id (+) = rfm.business_group_id;
28   --
29   -- Declare local variables
30   --
31   l_security_group_id number;
32   l_proc              varchar2(72)  :=  g_package||'set_security_group_id';
33   l_legislation_code  varchar2(150);
34   --
35 begin
36   --
37   hr_utility.set_location('Entering:'|| l_proc, 10);
38   --
39   -- Ensure that all the mandatory parameter are not null
40   --
41   hr_api.mandatory_arg_error
42     (p_api_name           => l_proc
43     ,p_argument           => 'report_format_mapping_id'
44     ,p_argument_value     => p_report_format_mapping_id
45     );
46   --
47   open csr_sec_grp;
48   fetch csr_sec_grp into l_security_group_id
49                        , l_legislation_code;
50   --
51   if csr_sec_grp%notfound then
52      --
53      close csr_sec_grp;
54      --
55      -- The primary key is invalid therefore we must error
56      --
57      fnd_message.set_name('PAY','HR_7220_INVALID_PRIMARY_KEY');
58      hr_multi_message.add
59        (p_associated_column1
60          => nvl(p_associated_column1,'REPORT_FORMAT_MAPPING_ID')
61        );
62      --
63   else
64     close csr_sec_grp;
65     --
66     -- Set the security_group_id in CLIENT_INFO
67     --
68     hr_api.set_security_group_id
69       (p_security_group_id => l_security_group_id
70       );
71     --
72     -- Set the sessions legislation context in HR_SESSION_DATA
73     --
74     hr_api.set_legislation_context(l_legislation_code);
75   end if;
76   --
77   hr_utility.set_location(' Leaving:'|| l_proc, 20);
78   --
79 end set_security_group_id;
80 --
81 --  ---------------------------------------------------------------------------
82 --  |--------------------< chk_report_format_mapping_id >---------------------|
83 --  ---------------------------------------------------------------------------
84 --
85 Procedure chk_report_format_mapping_id
86   ( p_report_format_mapping_id  in  number ) IS
87 --
88 cursor csr_unique_id  is
89   select null
90   from   pay_report_format_mappings_f
91   where  report_format_mapping_id = p_report_format_mapping_id;
92 --
93   l_proc     varchar2(72) := g_package || 'chk_report_format_mapping_id';
94   l_exists   varchar2(1);
95 --
96 Begin
97   --
98   hr_utility.set_location('Entering:'|| l_proc, 10);
99   --
100         hr_api.mandatory_arg_error
101                    ( p_api_name       =>  l_proc
102                     ,p_argument       =>  'REPORT_FORMAT_MAPPING_ID'
103                     ,p_argument_value =>  p_report_format_mapping_id
104                    );
105 
106         open csr_unique_id;
107         fetch csr_unique_id into l_exists;
108 
109         if csr_unique_id%found then
110 
111              close csr_unique_id;
112 
113              pay_rfm_shd.constraint_error
114                     (p_constraint_name => 'PAY_REPORT_FORMAT_MAPPINGS_PK');
115 
116         end if ;
117 
118         close csr_unique_id;
119   --
120   hr_utility.set_location(' Leaving:'|| l_proc, 20);
121   --
122 End chk_report_format_mapping_id;
123 --
124 -- ----------------------------------------------------------------------------
125 -- |-----------------------------< chk_unique_key >---------------------------|
126 -- ----------------------------------------------------------------------------
127 -- {Start Of Comments}
128 --
129 -- Description:
130 --   This procedure is used to check the uniqueness of the combination
131 --   report type, report qualifier and report category which forms the
132 --   true key.
133 --
134 --
135 -- Pre Conditions:
136 --   Should be called only while insert. Since these columns are non-updatable
137 --   it is not required to check the uniqueness while update.
138 --
139 -- In Arguments:
140 --
141 --
142 --
143 -- Post Success:
144 --   Processing Continues.
145 --
146 --
147 -- Post Failure:
148 --   Failure might occur if any of the parameters are null or the combination
149 --   already exists for a different report format mapping.
150 --   Errors are trapped and reported.
151 --
152 -- {End Of Comments}
153 -- ----------------------------------------------------------------------------
154 Procedure chk_unique_key
155   ( p_report_type      in  varchar2
156    ,p_report_qualifier in  varchar2
157    ,p_report_category  in  varchar2
158   ) IS
159 --
160 cursor csr_unique_key  is
161   select null
162   from   pay_report_format_mappings_f
163   where  report_type = p_report_type
164   and    report_qualifier = p_report_qualifier
165   and    report_category  = p_report_category;
166 --
167   l_proc     varchar2(72) := g_package || 'chk_unique_key';
168   l_exists   varchar2(1);
169 --
170 Begin
171   --
172   hr_utility.set_location('Entering:'|| l_proc, 10);
173   --
174         hr_api.mandatory_arg_error
175               ( p_api_name       =>  l_proc
176                ,p_argument       =>  'REPORT_TYPE'
177                ,p_argument_value =>  p_report_type
178               );
179 
180         hr_api.mandatory_arg_error
181               ( p_api_name       =>  l_proc
182                ,p_argument       =>  'REPORT_QUALIFIER'
183                ,p_argument_value =>  p_report_qualifier
184               );
185 
186         hr_api.mandatory_arg_error
187               ( p_api_name       =>  l_proc
188                ,p_argument       =>  'REPORT_CATEGORY'
189                ,p_argument_value =>  p_report_category
190               );
191 
192         open csr_unique_key;
193         fetch csr_unique_key into l_exists;
194 
195         if csr_unique_key%found then
196 
197              close csr_unique_key;
198 
199              fnd_message.set_name( 'PAY' , 'PAY_33257_INV_UKEY2' );
200              fnd_message.set_token( 'COL1' , 'REPORT_TYPE');
201              fnd_message.set_token( 'COL2' , 'REPORT_QUALIFIER');
202              fnd_message.set_token( 'COL3' , 'REPORT_CATEGORY');
203              fnd_message.set_token( 'COL1_VAL', p_report_type);
204              fnd_message.set_token( 'COL2_VAL', p_report_qualifier);
205              fnd_message.set_token( 'COL3_VAL', p_report_category);
206              fnd_message.raise_error ;
207 
208         end if ;
209 
210         close csr_unique_key;
211   --
212   hr_utility.set_location(' Leaving:'|| l_proc, 20);
213   --
214 End chk_unique_key;
215 --
216 -- ----------------------------------------------------------------------------
217 -- |-----------------------------< chk_report_format >------------------------|
218 -- ----------------------------------------------------------------------------
219 -- {Start Of Comments}
220 --
221 -- Description:
222 --   This procedure is used to check the validity of report_format.
223 --   report_format must not be null.
224 --
225 -- Pre Conditions:
226 --   None
227 --
228 --
229 -- In Arguments:
230 --   report_format
231 --
232 --
233 -- Post Success:
234 --   Processing continues.
235 --
236 --
237 -- Post Failure:
238 --   Failure might occur if the report_format is null.
239 --   Errors will be trapped and reported.
240 --
241 --
242 -- {End Of Comments}
243 -- ----------------------------------------------------------------------------
244 Procedure chk_report_format
245   ( p_report_format      in  varchar2  ) IS
246 --
247   l_proc     varchar2(72) := g_package || 'chk_report_format';
248 --
249 Begin
250   --
251   hr_utility.set_location('Entering:'|| l_proc, 10);
252   --
253         hr_api.mandatory_arg_error
254               ( p_api_name       =>  l_proc
255                ,p_argument       =>  'REPORT_FORMAT'
256                ,p_argument_value =>  p_report_format
257               );
258   --
259   hr_utility.set_location(' Leaving:'|| l_proc, 20);
260   --
261 End chk_report_format;
262 --
263 -- ----------------------------------------------------------------------------
264 -- |---------------------------< chk_updatable_flag >-------------------------|
265 -- ----------------------------------------------------------------------------
266 -- {Start Of Comments}
267 --
268 -- Description:
269 --   Checks the validity of updatable_flag.
270 --   If updatable_flag is not null then it must be either 'Y' or 'N'
271 --
272 -- Pre Conditions:
273 --   None
274 --
275 --
276 -- In Arguments:
277 --   updatable_flag
278 --
279 --
280 -- Post Success:
281 --   Processing Continues.
282 --
283 --
284 -- Post Failure:
285 --   Failure might occur if updatabale_flag is not valid.
286 --   Errors are trapped and reported.
287 --
288 -- {End Of Comments}
289 -- ----------------------------------------------------------------------------
290 Procedure chk_updatable_flag
291   ( p_updatable_flag     in  varchar2  ) IS
292 --
293   l_proc     varchar2(72) := g_package || 'chk_updatable_flag';
294 --
295 Begin
296   --
297   hr_utility.set_location('Entering:'|| l_proc, 10);
298   --
299 
300         if  p_updatable_flag is not null and
301                   p_updatable_flag not in ('Y', 'N') then
302 
303              fnd_message.set_name( 'PAY' , 'PAY_33259_INVALID_UFLAG' );
304              fnd_message.raise_error ;
305 
306         end if;
307 
308   --
309   hr_utility.set_location(' Leaving:'|| l_proc, 20);
310   --
311 End chk_updatable_flag;
312 --
313 -- ----------------------------------------------------------------------------
314 -- |--------------------------< chk_legislation_code>-------------------------|
315 -- ----------------------------------------------------------------------------
316 --
317 --  Description:
318 --    Validates that the legislation code exists in fnd_territories
319 --
320 --  Pre-Requisites:
321 --    None
322 --
323 --  In Parameters:
324 --    p_legislation_code
325 --
326 --  Post Success:
327 --    Processing continues if the legislation_code is valid.
328 --
329 --  Post Failure:
330 --    An application error is raised and processing is terminated if
331 --    the legislation_code is invalid.
332 --
333 --  Developer/Implementation Notes:
334 --    None
335 --
336 -- ----------------------------------------------------------------------------
337 procedure chk_legislation_code
338 ( p_legislation_code  in varchar2 )
339 is
340 --
341 cursor csr_legislation_code is
342   select null
343   from   fnd_territories
344   where  territory_code = p_legislation_code ;
345 --
346 l_exists varchar2(1);
347 l_proc   varchar2(100) := g_package || 'chk_legislation_code';
348 --
349 Begin
350   --
351   hr_utility.set_location('Entering:'|| l_proc, 10);
352 
353   open csr_legislation_code;
354   fetch csr_legislation_code into l_exists ;
355 
356   if csr_legislation_code%notfound then
357     close csr_legislation_code;
358     fnd_message.set_name('PAY', 'PAY_33177_LEG_CODE_INVALID');
359     fnd_message.raise_error;
360   end if;
361   close csr_legislation_code;
362 
363   hr_utility.set_location(' Leaving:'|| l_proc, 20);
364   --
365 End chk_legislation_code;
366 --
367 -- ----------------------------------------------------------------------------
368 -- |------------------------------< chk_delete >------------------------------|
369 -- ----------------------------------------------------------------------------
370 -- {Start Of Comments}
371 --
372 --  Description:
373 --    Validates that the
374 --       1. For Delete Mode there are no child rows on or after
375 --          validation_start_date
376 --       2. For Zap Mode there are no child rows at all.
377 
378 --
379 --  Pre-Requisites:
380 --        None.
381 --
382 --  In Parameters:
383 
384 --
385 --  Post Success:
386 --    Processing continues if the deletion is valid.
387 --
388 --  Post Failure:
389 --    An application error is raised and processing is terminated if
390 --    the deletion is invalid.
391 --
392 --  Developer/Implementation Notes:
393 --    None
394 --
395 --  Access Status:
396 --    Internal Row Handler Use Only
397 --
398 -- {End Of Comments}
399 -- ----------------------------------------------------------------------------
400 Procedure chk_delete
401   ( p_report_format_mapping_id  in  number
402    ,p_object_version_number     in  number
403    ,p_datetrack_mode            in  varchar2
404    ,p_validation_start_date     in  date
405    ,p_validation_end_date       in  date
406   ) IS
407 --
408 cursor csr_dt_rfi_exists is
409    select null
410    from   pay_report_format_items_f rfi
411          ,pay_report_format_mappings_f rfm
412    where  rfm.report_format_mapping_id = p_report_format_mapping_id
413    and    rfm.object_version_number = p_object_version_number
414    and    rfm.report_type = rfi.report_type
415    and    rfm.report_qualifier = rfi.report_qualifier
416    and    rfm.report_category = rfi.report_category
417    and    rfi.effective_end_date >= p_validation_start_date  ;
418 --
419 cursor csr_rfi_exists is
420    select null
421    from   pay_report_format_items_f rfi
422          ,pay_report_format_mappings_f rfm
423    where  rfm.report_format_mapping_id = p_report_format_mapping_id
424    and    rfm.object_version_number = p_object_version_number
425    and    rfm.report_type = rfi.report_type
426    and    rfm.report_qualifier = rfi.report_qualifier
427    and    rfm.report_category = rfi.report_category;
428 --
429 cursor csr_rfp_exists is
430    select null
431    from   pay_report_format_parameters rfp
432    where  rfp.report_format_mapping_id = p_report_format_mapping_id;
433 --
434 cursor csr_rftl_exists is
435    select null
436    from   pay_report_format_mappings_tl rftl
437    where  rftl.report_format_mapping_id = p_report_format_mapping_id;
438 --
439   l_proc     varchar2(72) := g_package || 'chk_delete';
440   l_exists varchar2(1);
441 --
442 Begin
443   --
444   hr_utility.set_location('Entering:'|| l_proc, 10);
445 
446   if p_datetrack_mode = hr_api.g_delete then
447 
448         open csr_dt_rfi_exists;
449         fetch csr_dt_rfi_exists into l_exists;
450         if csr_dt_rfi_exists%found then
451 
452                 close csr_dt_rfi_exists;
453 
454                 fnd_message.set_name('PAY', 'HR_7215_DT_CHILD_EXISTS');
455                 fnd_message.set_token('TABLE_NAME', 'PAY_REPORT_FORMAT_ITEMS_F');
456                 fnd_message.raise_error;
457 
458         end if;
459         close csr_dt_rfi_exists;
460 
461   end if;
462 
463   if p_datetrack_mode = hr_api.g_zap then
464 
465         open csr_rfi_exists;
466         fetch csr_rfi_exists into l_exists;
467         if csr_rfi_exists%found then
468 
469                 close csr_rfi_exists;
470 
471                 fnd_message.set_name('PAY', 'HR_7215_DT_CHILD_EXISTS');
472                 fnd_message.set_token('TABLE_NAME', 'PAY_REPORT_FORMAT_ITEMS_F');
473                 fnd_message.raise_error;
474 
475         end if;
476         close csr_rfi_exists;
477 
478         open csr_rfp_exists;
479         fetch csr_rfp_exists into l_exists;
480         if csr_rfp_exists%found then
481 
482                 close csr_rfp_exists;
483 
484                 fnd_message.set_name('PAY', 'HR_7215_DT_CHILD_EXISTS');
485                 fnd_message.set_token('TABLE_NAME', 'PAY_REPORT_FORMAT_PARAMETERS');
486                 fnd_message.raise_error;
487 
488         end if;
489         close csr_rfp_exists;
490 
491         open csr_rftl_exists;
492         fetch csr_rftl_exists into l_exists;
493         if csr_rftl_exists%found then
494 
495                 close csr_rftl_exists;
496 
497                 fnd_message.set_name('PAY', 'HR_7215_DT_CHILD_EXISTS');
498                 fnd_message.set_token('TABLE_NAME', 'PAY_REPORT_FORMAT_MAPPINGS_TL');
499                 fnd_message.raise_error;
500 
501         end if;
502         close csr_rftl_exists;
503 
504   end if;
505 
506   hr_utility.set_location(' Leaving:'|| l_proc, 20);
507   --
508 End chk_delete;
509 --
510 -- ----------------------------------------------------------------------------
511 -- |-----------------------< chk_non_updateable_args >------------------------|
512 -- ----------------------------------------------------------------------------
513 -- {Start Of Comments}
514 --
515 -- Description:
516 --   This procedure is used to ensure that non updateable attributes have
517 --   not been updated. If an attribute has been updated an error is generated.
518 --
519 -- Pre Conditions:
520 --   g_old_rec has been populated with details of the values currently in
521 --   the database.
522 --
523 -- In Arguments:
524 --   p_rec has been populated with the updated values the user would like the
525 --   record set to.
526 --
527 -- Post Success:
528 --   Processing continues if all the non updateable attributes have not
529 --   changed.
530 --
531 -- Post Failure:
532 --   An application error is raised if any of the non updatable attributes
533 --   have been altered.
534 --
535 -- {End Of Comments}
536 -- ----------------------------------------------------------------------------
537 Procedure chk_non_updateable_args
538   (p_effective_date  in date
539   ,p_rec             in pay_rfm_shd.g_rec_type
540   ) IS
541 --
542   l_proc     varchar2(72) := g_package || 'chk_non_updateable_args';
543 --
544 Begin
545   --
546   -- Only proceed with the validation if a row exists for the current
547   -- record in the HR Schema.
548   --
549   IF NOT pay_rfm_shd.api_updating
550       (p_report_format_mapping_id         => p_rec.report_format_mapping_id
551       ,p_effective_date                   => p_effective_date
552       ,p_object_version_number            => p_rec.object_version_number
553       ) THEN
554      fnd_message.set_name('PER', 'HR_6153_ALL_PROCEDURE_FAIL');
555      fnd_message.set_token('PROCEDURE ', l_proc);
556      fnd_message.set_token('STEP ', '5');
557      fnd_message.raise_error;
558   END IF;
559   --
560   --
561   if nvl(p_rec.business_group_id, hr_api.g_number) <>
562      nvl(pay_rfm_shd.g_old_rec.business_group_id, hr_api.g_number) then
563      hr_api.argument_changed_error
564      (p_api_name => l_proc
565      ,p_argument => 'BUSINESS_GROUP_ID'
566      ,p_base_table => pay_rfm_shd.g_tab_nam
567      );
568   end if;
569   --
570   if nvl(p_rec.legislation_code, hr_api.g_varchar2) <>
571      nvl(pay_rfm_shd.g_old_rec.legislation_code, hr_api.g_varchar2) then
572      hr_api.argument_changed_error
573      (p_api_name => l_proc
574      ,p_argument => 'LEGISLATION_CODE'
575      ,p_base_table => pay_rfm_shd.g_tab_nam
576      );
577   end if;
578   --
579   if nvl(p_rec.report_type, hr_api.g_varchar2) <>
580      pay_rfm_shd.g_old_rec.report_type then
581      hr_api.argument_changed_error
582      (p_api_name => l_proc
583      ,p_argument => 'REPORT_TYPE'
584      ,p_base_table => pay_rfm_shd.g_tab_nam
585      );
586   end if;
587   --
588   if nvl(p_rec.report_qualifier, hr_api.g_varchar2) <>
589      pay_rfm_shd.g_old_rec.report_qualifier then
590      hr_api.argument_changed_error
591      (p_api_name => l_proc
592      ,p_argument => 'REPORT_QUALIFIER'
593      ,p_base_table => pay_rfm_shd.g_tab_nam
594      );
595   end if;
596   --
597   if nvl(p_rec.report_category, hr_api.g_varchar2) <>
598      pay_rfm_shd.g_old_rec.report_category then
599      hr_api.argument_changed_error
600      (p_api_name => l_proc
601      ,p_argument => 'REPORT_CATEGORY'
602      ,p_base_table => pay_rfm_shd.g_tab_nam
603      );
604   end if;
605   --
606 End chk_non_updateable_args;
607 --
608 -- ----------------------------------------------------------------------------
609 -- |--------------------------< dt_update_validate >--------------------------|
610 -- ----------------------------------------------------------------------------
611 -- {Start Of Comments}
612 --
613 -- Description:
614 --   This procedure is used for referential integrity of datetracked
615 --   parent entities when a datetrack update operation is taking place
616 --   and where there is no cascading of update defined for this entity.
617 --
618 -- Prerequisites:
619 --   This procedure is called from the update_validate.
620 --
621 -- In Parameters:
622 --
623 -- Post Success:
624 --   Processing continues.
625 --
626 -- Post Failure:
627 --
628 -- Developer Implementation Notes:
629 --   This procedure should not need maintenance unless the HR Schema model
630 --   changes.
631 --
632 -- Access Status:
633 --   Internal Row Handler Use Only.
634 --
635 -- {End Of Comments}
636 -- ----------------------------------------------------------------------------
637 Procedure dt_update_validate
638   (p_datetrack_mode                in varchar2
639   ,p_validation_start_date         in date
640   ,p_validation_end_date           in date
641   ) Is
642 --
643   l_proc  varchar2(72) := g_package||'dt_update_validate';
644 --
645 Begin
646   --
647   -- Ensure that the p_datetrack_mode argument is not null
648   --
649   hr_api.mandatory_arg_error
650     (p_api_name       => l_proc
651     ,p_argument       => 'datetrack_mode'
652     ,p_argument_value => p_datetrack_mode
653     );
654   --
655   -- Mode will be valid, as this is checked at the start of the upd.
656   --
657   -- Ensure the arguments are not null
658   --
659   hr_api.mandatory_arg_error
660     (p_api_name       => l_proc
661     ,p_argument       => 'validation_start_date'
662     ,p_argument_value => p_validation_start_date
663     );
664   --
665   hr_api.mandatory_arg_error
666     (p_api_name       => l_proc
667     ,p_argument       => 'validation_end_date'
668     ,p_argument_value => p_validation_end_date
669     );
670   --
671     --
672   --
673 Exception
674   When Others Then
675     --
676     -- An unhandled or unexpected error has occurred which
677     -- we must report
678     --
679     fnd_message.set_name('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
680     fnd_message.set_token('PROCEDURE', l_proc);
681     fnd_message.set_token('STEP','15');
682     fnd_message.raise_error;
683 End dt_update_validate;
684 --
685 -- ----------------------------------------------------------------------------
686 -- |--------------------------< dt_delete_validate >--------------------------|
687 -- ----------------------------------------------------------------------------
688 -- {Start Of Comments}
689 --
690 -- Description:
691 --   This procedure is used for referential integrity of datetracked
692 --   child entities when either a datetrack DELETE or ZAP is in operation
693 --   and where there is no cascading of delete defined for this entity.
694 --   For the datetrack mode of DELETE or ZAP we must ensure that no
695 --   datetracked child rows exist between the validation start and end
696 --   dates.
697 --
698 -- Prerequisites:
699 --   This procedure is called from the delete_validate.
700 --
701 -- In Parameters:
702 --
703 -- Post Success:
704 --   Processing continues.
705 --
706 -- Post Failure:
707 --   If a row exists by determining the returning Boolean value from the
708 --   generic dt_api.rows_exist function then we must supply an error via
709 --   the use of the local exception handler l_rows_exist.
710 --
711 -- Developer Implementation Notes:
712 --   This procedure should not need maintenance unless the HR Schema model
713 --   changes.
714 --
715 -- Access Status:
716 --   Internal Row Handler Use Only.
717 --
718 -- {End Of Comments}
719 -- ----------------------------------------------------------------------------
720 Procedure dt_delete_validate
721   (p_report_format_mapping_id         in number
722   ,p_datetrack_mode                   in varchar2
723   ,p_validation_start_date            in date
724   ,p_validation_end_date              in date
725   ) Is
726 --
727   l_proc        varchar2(72)    := g_package||'dt_delete_validate';
728 --
729 Begin
730   --
731   -- Ensure that the p_datetrack_mode argument is not null
732   --
733   hr_api.mandatory_arg_error
734     (p_api_name       => l_proc
735     ,p_argument       => 'datetrack_mode'
736     ,p_argument_value => p_datetrack_mode
737     );
738   --
739   -- Only perform the validation if the datetrack mode is either
740   -- DELETE or ZAP
741   --
742   If (p_datetrack_mode = hr_api.g_delete or
743       p_datetrack_mode = hr_api.g_zap) then
744     --
745     --
746     -- Ensure the arguments are not null
747     --
748     hr_api.mandatory_arg_error
749       (p_api_name       => l_proc
750       ,p_argument       => 'validation_start_date'
751       ,p_argument_value => p_validation_start_date
752       );
753     --
754     hr_api.mandatory_arg_error
755       (p_api_name       => l_proc
756       ,p_argument       => 'validation_end_date'
757       ,p_argument_value => p_validation_end_date
758       );
759     --
760     hr_api.mandatory_arg_error
761       (p_api_name       => l_proc
762       ,p_argument       => 'report_format_mapping_id'
763       ,p_argument_value => p_report_format_mapping_id
764       );
765     --
766   End If;
767   --
768 Exception
769   When Others Then
770     --
771     -- An unhandled or unexpected error has occurred which
772     -- we must report
773     --
774     fnd_message.set_name('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
775     fnd_message.set_token('PROCEDURE', l_proc);
776     fnd_message.set_token('STEP','15');
777     fnd_message.raise_error;
778   --
779 End dt_delete_validate;
780 --
781 -- ----------------------------------------------------------------------------
782 -- |----------------------< chk_startup_action >------------------------------|
783 -- ----------------------------------------------------------------------------
784 --
785 -- Description:
786 --  This procedure will check that the current action is allowed according
787 --  to the current startup mode.
788 --
789 -- ----------------------------------------------------------------------------
790 PROCEDURE chk_startup_action
791   (p_insert               IN boolean
792   ,p_business_group_id    IN number
793   ,p_legislation_code     IN varchar2
794   ,p_legislation_subgroup IN varchar2 DEFAULT NULL) IS
795 --
796 BEGIN
797   --
798   -- Call the supporting procedure to check startup mode
799 
800   if p_business_group_id is not null and p_legislation_code is not null then
801         fnd_message.set_name('PAY', 'PAY_33179_BGLEG_INVALID');
802         fnd_message.raise_error;
803     end if;
804 
805   IF (p_insert) THEN
806     hr_startup_data_api_support.chk_startup_action
807       (p_generic_allowed   => TRUE
808       ,p_startup_allowed   => TRUE
809       ,p_user_allowed      => TRUE
810       ,p_business_group_id => p_business_group_id
811       ,p_legislation_code  => p_legislation_code
812       ,p_legislation_subgroup => p_legislation_subgroup
813       );
814   ELSE
815     hr_startup_data_api_support.chk_upd_del_startup_action
816       (p_generic_allowed   => TRUE
817       ,p_startup_allowed   => TRUE
818       ,p_user_allowed      => TRUE
819       ,p_business_group_id => p_business_group_id
820       ,p_legislation_code  => p_legislation_code
821       ,p_legislation_subgroup => p_legislation_subgroup
822       );
823   END IF;
824   --
825 END chk_startup_action;
826 --
827 -- ----------------------------------------------------------------------------
828 -- |---------------------------< insert_validate >----------------------------|
829 -- ----------------------------------------------------------------------------
830 Procedure insert_validate
831   (p_rec                   in pay_rfm_shd.g_rec_type
832   ,p_effective_date        in date
833   ,p_datetrack_mode        in varchar2
834   ,p_validation_start_date in date
835   ,p_validation_end_date   in date
836   ) is
837 --
838   l_proc        varchar2(72) := g_package||'insert_validate';
839 --
840 Begin
841   hr_utility.set_location('Entering:'||l_proc, 5);
842   --
843   -- Call all supporting business operations
844   --
845   --
846   chk_startup_action(true
847                     ,p_rec.business_group_id
848                     ,p_rec.legislation_code
849                     );
850 
851   IF hr_startup_data_api_support.g_startup_mode
852                      NOT IN ('GENERIC','STARTUP') THEN
853      --
854      -- Validate Important Attributes
855      --
856      hr_api.validate_bus_grp_id
857        (p_business_group_id => p_rec.business_group_id
858        ,p_associated_column1 => pay_rfm_shd.g_tab_nam
859                                 || '.BUSINESS_GROUP_ID');
860      --
861      -- after validating the set of important attributes,
862      -- if Multiple Message Detection is enabled and at least
863      -- one error has been found then abort further validation.
864      --
865      hr_multi_message.end_validation_set;
866   END IF;
867   --
868 
869   --
870   -- Validate Dependent Attributes
871   --
872   if hr_startup_data_api_support.g_startup_mode not in ('GENERIC','USER') then
873 
874         chk_legislation_code(p_legislation_code => p_rec.legislation_code);
875 
876   end if;
877   --
878   chk_unique_key
879      ( p_report_type      => p_rec.report_type
880       ,p_report_qualifier => p_rec.report_qualifier
881       ,p_report_category  => p_rec.report_category
882      );
883   --
884   chk_report_format
885      ( p_report_format    => p_rec.report_format );
886   --
887   chk_updatable_flag
888      ( p_updatable_flag   => p_rec.updatable_flag );
889   --
890   hr_utility.set_location(' Leaving:'||l_proc, 10);
891 End insert_validate;
892 --
893 -- ----------------------------------------------------------------------------
894 -- |---------------------------< update_validate >----------------------------|
895 -- ----------------------------------------------------------------------------
896 Procedure update_validate
897   (p_rec                     in pay_rfm_shd.g_rec_type
898   ,p_effective_date          in date
899   ,p_datetrack_mode          in varchar2
900   ,p_validation_start_date   in date
901   ,p_validation_end_date     in date
902   ) is
903 --
904   l_proc        varchar2(72) := g_package||'update_validate';
905 --
906 Begin
907   hr_utility.set_location('Entering:'||l_proc, 5);
908   --
909   -- Call all supporting business operations
910   --
911   --
912   chk_startup_action(false
913                     ,p_rec.business_group_id
914                     ,p_rec.legislation_code
915                     );
916   IF hr_startup_data_api_support.g_startup_mode
917                      NOT IN ('GENERIC','STARTUP') THEN
918      --
919      -- Validate Important Attributes
920      --
921      hr_api.validate_bus_grp_id
922        (p_business_group_id => p_rec.business_group_id
923        ,p_associated_column1 => pay_rfm_shd.g_tab_nam
924                                 || '.BUSINESS_GROUP_ID');
925      --
926      -- After validating the set of important attributes,
927      -- if Multiple Message Detection is enabled and at least
928      -- one error has been found then abort further validation.
929      --
930      hr_multi_message.end_validation_set;
931   END IF;
932   --
933   --
934   -- Validate Dependent Attributes
935   --
936   -- Call the datetrack update integrity operation
937   --
938   dt_update_validate
939     (p_datetrack_mode                 => p_datetrack_mode
940     ,p_validation_start_date          => p_validation_start_date
941     ,p_validation_end_date            => p_validation_end_date
942     );
943   --
944   chk_non_updateable_args
945     (p_effective_date  => p_effective_date
946     ,p_rec             => p_rec
947     );
948   --
949   chk_report_format
950      ( p_report_format    => p_rec.report_format );
951   --
952   chk_updatable_flag
953      ( p_updatable_flag   => p_rec.updatable_flag );
954   --
955   hr_utility.set_location(' Leaving:'||l_proc, 10);
956 End update_validate;
957 --
958 -- ----------------------------------------------------------------------------
959 -- |---------------------------< delete_validate >----------------------------|
960 -- ----------------------------------------------------------------------------
961 Procedure delete_validate
962   (p_rec                    in pay_rfm_shd.g_rec_type
963   ,p_effective_date         in date
964   ,p_datetrack_mode         in varchar2
965   ,p_validation_start_date  in date
966   ,p_validation_end_date    in date
967   ) is
968 --
969   l_proc        varchar2(72) := g_package||'delete_validate';
970 --
971 Begin
972   hr_utility.set_location('Entering:'||l_proc, 5);
973   --
974     --
975   chk_startup_action(false
976                     ,pay_rfm_shd.g_old_rec.business_group_id
977                     ,pay_rfm_shd.g_old_rec.legislation_code
978                     );
979   IF hr_startup_data_api_support.g_startup_mode
980                      NOT IN ('GENERIC','STARTUP') THEN
981      --
982      -- Validate Important Attributes
983      --
984      --
985      -- After validating the set of important attributes,
986      -- if Multiple Message Detection is enabled and at least
987      -- one error has been found then abort further validation.
988      --
989      hr_multi_message.end_validation_set;
990   END IF;
991   --
992   -- Call all supporting business operations
993   --
994   dt_delete_validate
995     (p_datetrack_mode                   => p_datetrack_mode
996     ,p_validation_start_date            => p_validation_start_date
997     ,p_validation_end_date              => p_validation_end_date
998     ,p_report_format_mapping_id         => p_rec.report_format_mapping_id
999     );
1000   --
1001   chk_delete
1002     ( p_report_format_mapping_id  => p_rec.report_format_mapping_id
1003      ,p_object_version_number     => p_rec.object_version_number
1004      ,p_datetrack_mode            => p_datetrack_mode
1005      ,p_validation_start_date     => p_validation_start_date
1006      ,p_validation_end_date       => p_validation_end_date
1007     );
1008   --
1009   hr_utility.set_location(' Leaving:'||l_proc, 10);
1010 End delete_validate;
1011 --
1012 end pay_rfm_bus;