DBA Data[Home] [Help]

PACKAGE BODY: APPS.PAY_SET_BUS

Source


1 Package Body pay_set_bus as
2 /* $Header: pysetrhi.pkb 120.0 2005/05/29 08:39:23 appldev noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33)	:= '  pay_set_bus.';  -- Global package name
9 --
10 -- ----------------------------------------------------------------------------
11 -- |---------------------------< get_template_info >--------------------------|
12 -- ----------------------------------------------------------------------------
13 Procedure get_template_info
14   (p_template_id                 in            number
15   ,p_business_group_id           in out nocopy number
16   ,p_legislation_code            in out nocopy varchar2
17   ,p_template_type               in out nocopy varchar2
18   ,p_base_processing_priority    in out nocopy number
19   ) is
20   --
21   -- Cursor to get the template information.
22   --
23   cursor csr_get_template_info is
24   select pet.business_group_id
25   ,      pet.legislation_code
26   ,      pet.template_type
27   ,      pet.base_processing_priority
28   from   pay_element_templates pet
29   where  pet.template_id = p_template_id;
30 --
31   l_proc  varchar2(72) := g_package||'get_template_info';
32   l_api_updating boolean;
33   l_valid        varchar2(1);
34 --
35 Begin
36   hr_utility.set_location('Entering:'||l_proc, 5);
37   open csr_get_template_info;
38   fetch csr_get_template_info
39   into  p_business_group_id
40   ,     p_legislation_code
41   ,     p_template_type
42   ,     p_base_processing_priority;
43   close csr_get_template_info;
44   if p_business_group_id is not null then
45     p_legislation_code :=
46     hr_api.return_legislation_code(p_business_group_id);
47   end if;
48   hr_utility.set_location(' Leaving:'||l_proc, 15);
49 End get_template_info;
50 -- ----------------------------------------------------------------------------
51 -- |-----------------------< chk_non_updateable_args >------------------------|
52 -- ----------------------------------------------------------------------------
53 Procedure chk_non_updateable_args
54 (p_rec in pay_set_shd.g_rec_type
55 ) is
56   --
57   -- Cursor to disallow update if a core element has been generated from
58   -- this shadow element.
59   --
60   cursor csr_disallow_update is
61   select null
62   from   pay_template_core_objects tco
63   where  (tco.core_object_type = pay_tco_shd.g_set_lookup_type or
64           tco.core_object_type = pay_tco_shd.g_spr_lookup_type)
65   and    tco.shadow_object_id = p_rec.element_type_id;
66 --
67   l_proc  varchar2(72) := g_package||'chk_non_updateable_args';
68   l_error exception;
69   l_api_updating boolean;
70   l_argument     varchar2(30);
71   l_disallow     varchar2(1);
72 --
73 Begin
74   hr_utility.set_location('Entering:'||l_proc, 5);
75   l_api_updating := pay_set_shd.api_updating
76     (p_element_type_id       => p_rec.element_type_id
77     ,p_object_version_number => p_rec.object_version_number
78     );
79   if not l_api_updating then
80     hr_utility.set_message(801,'HR_6153_ALL_PROCEDURE_FAIL');
81     hr_utility.set_message_token('PROCEDURE', l_proc);
82     hr_utility.set_message_token('STEP', '10');
83     hr_utility.raise_error;
84   end if;
85   --
86   hr_utility.set_location(l_proc, 20);
87   --
88   -- Check that the update is actually allowed.
89   --
90   open csr_disallow_update;
91   fetch csr_disallow_update into l_disallow;
92   if csr_disallow_update%found then
93     hr_utility.set_location(l_proc, 25);
94     close csr_disallow_update;
95     fnd_message.set_name('PAY', 'PAY_50137_SET_CORE_ROW_EXISTS');
96     fnd_message.raise_error;
97   end if;
98   close csr_disallow_update;
99   --
100   -- Check the otherwise non-updateable arguments.
101   --
102   -- p_template_id
103   --
104   if nvl(p_rec.template_id, hr_api.g_number) <>
105      nvl(pay_set_shd.g_old_rec.template_id, hr_api.g_number)
106   then
107     l_argument := 'p_template_id';
108     raise l_error;
109   end if;
110   hr_utility.set_location('Leaving:'||l_proc, 35);
111 exception
112     when l_error then
113        hr_utility.set_location('Leaving:'||l_proc, 40);
114        hr_api.argument_changed_error
115          (p_api_name => l_proc
116          ,p_argument => l_argument);
117     when others then
118        hr_utility.set_location('Leaving:'||l_proc, 45);
119        raise;
120 End chk_non_updateable_args;
121 -- ----------------------------------------------------------------------------
122 -- |---------------------------< chk_template_id >----------------------------|
123 -- ----------------------------------------------------------------------------
124 Procedure chk_template_id
125   (p_template_id     in     number
126   ) is
127   --
128   -- Cursor to check that template_id is valid.
129   --
130   cursor csr_template_id_valid is
131   select null
132   from   pay_element_templates pet
133   where  pet.template_id = p_template_id;
134   --
135   l_proc  varchar2(72) := g_package||'chk_template_id';
136   l_valid varchar2(1);
137 --
138 Begin
139   hr_utility.set_location('Entering:'||l_proc, 5);
140   --
141   -- Check that template_id is not null.
142   --
143   hr_api.mandatory_arg_error
144   (p_api_name       => l_proc
145   ,p_argument       => 'p_template_id'
146   ,p_argument_value => p_template_id
147   );
148   --
149   -- Check that template_id is valid.
150   --
151   open csr_template_id_valid;
152   fetch csr_template_id_valid into l_valid;
153   if csr_template_id_valid%notfound then
154     hr_utility.set_location(' Leaving:'||l_proc, 10);
155     close csr_template_id_valid;
156     fnd_message.set_name('PAY', 'PAY_50114_ETM_INVALID_TEMPLATE');
157     fnd_message.raise_error;
158   end if;
159   close csr_template_id_valid;
160   hr_utility.set_location(' Leaving:'||l_proc, 15);
161 End chk_template_id;
162 -- ----------------------------------------------------------------------------
163 -- |------------------------< chk_classification_name >-----------------------|
164 -- ----------------------------------------------------------------------------
165 Procedure chk_classification_name
166   (p_classification_name     in     varchar2
167   ,p_element_type_id         in     number
168   ,p_object_version_number   in     number
169   ) is
170 --
171   l_proc  varchar2(72) := g_package||'chk_classification_name';
172   l_api_updating boolean;
173 --
174 Begin
175   hr_utility.set_location('Entering:'||l_proc, 5);
176   l_api_updating := pay_set_shd.api_updating
177   (p_element_type_id       => p_element_type_id
178   ,p_object_version_number => p_object_version_number
179   );
180   if (l_api_updating and nvl(p_classification_name, hr_api.g_varchar2) <>
181       nvl(pay_set_shd.g_old_rec.classification_name, hr_api.g_varchar2)) or
182      not l_api_updating
183   then
184     --
185     -- Check that the classification name is not null.
186     --
187     hr_api.mandatory_arg_error
188     (p_api_name       => l_proc
189     ,p_argument       => 'p_classification_name'
190     ,p_argument_value => p_classification_name
191     );
192   end if;
193   hr_utility.set_location(' Leaving:'||l_proc, 15);
194 End chk_classification_name;
195 -- ----------------------------------------------------------------------------
196 -- |-----------------------------< chk_lookups >------------------------------|
197 -- ----------------------------------------------------------------------------
198 Procedure chk_lookups
199   (p_effective_date                    in     date
200   ,p_additional_entry_allowed_fla      in     varchar2
201   ,p_adjustment_only_flag              in     varchar2
202   ,p_closed_for_entry_flag             in     varchar2
203   ,p_indirect_only_flag                in     varchar2
204   ,p_multiple_entries_allowed_fla      in     varchar2
205   ,p_multiply_value_flag               in     varchar2
206   ,p_post_termination_rule             in     varchar2
207   ,p_process_in_run_flag               in     varchar2
208   ,p_processing_type                   in     varchar2
209   ,p_standard_link_flag                in     varchar2
210   ,p_qualifying_units                  in     varchar2
211   ,p_third_party_pay_only_flag         in     varchar2
212   ,p_iterative_flag                    in     varchar2
213   ,p_grossup_flag                      in     varchar2
214   ,p_advance_indicator                 in     varchar2
215   ,p_advance_payable                   in     varchar2
216   ,p_advance_deduction                 in     varchar2
217   ,p_process_advance_entry             in     varchar2
218   ,p_once_each_period_flag             in     varchar2
219   ,p_element_type_id                   in     number
220   ,p_object_version_number             in     number
221   ) is
222 --
223   l_proc  varchar2(72) := g_package||'chk_lookups';
224   l_api_updating boolean;
225 --
226   Procedure chk_lookup
227     (p_effective_date                     in    date
228     ,p_caller                             in    varchar2
229     ,p_argument_name                      in    varchar2
230     ,p_old_lookup_code                    in    varchar2
231     ,p_lookup_code                        in    varchar2
232     ,p_lookup_type                        in    varchar2
233     ,p_mandatory                          in    boolean
234     ,p_updatable                          in    boolean
235     ,p_api_updating                       in    boolean
236     ) is
237   begin
238     if (p_updatable  and p_api_updating and
239         nvl(p_lookup_code, hr_api.g_varchar2) <>
240         nvl(p_old_lookup_code, hr_api.g_varchar2)) or not p_api_updating
241     then
242       --
243       -- Check that mandatory argument is not null.
244       --
245       if p_mandatory then
246         hr_api.mandatory_arg_error
247         (p_api_name       => p_caller
248         ,p_argument       => p_argument_name
249         ,p_argument_value => p_lookup_code
250         );
251       end if;
252       --
253       -- Exit if the argument is null, and not mandatory.
254       --
255       if not p_mandatory and p_lookup_code is null then
256         return;
257       end if;
258       --
259       -- Do the lookup check.
260       --
261       if hr_api.not_exists_in_hr_lookups
262          (p_effective_date => p_effective_date
263          ,p_lookup_type    => p_lookup_type
264          ,p_lookup_code    => p_lookup_code
265          )
266       then
267         fnd_message.set_name('PAY', 'HR_52966_INVALID_LOOKUP');
268         fnd_message.set_token('LOOKUP_TYPE', p_lookup_type);
269         fnd_message.set_token('COLUMN', upper(p_argument_name));
270         fnd_message.raise_error;
271       end if;
272     end if;
273   end chk_lookup;
274 --
275 Begin
276   hr_utility.set_location('Entering:'||l_proc, 5);
277   l_api_updating := pay_set_shd.api_updating
278   (p_element_type_id       => p_element_type_id
279   ,p_object_version_number => p_object_version_number
280   );
281   --
282   -- additional_entry_allowed_flag
283   --
284   chk_lookup
285   (p_effective_date   => p_effective_date
286   ,p_caller           => l_proc
287   ,p_argument_name    => 'additional_entry_allowed_flag'
288   ,p_old_lookup_code  => pay_set_shd.g_old_rec.additional_entry_allowed_flag
289   ,p_lookup_code      => p_additional_entry_allowed_fla
290   ,p_lookup_type      => 'YES_NO'
291   ,p_mandatory        => true
292   ,p_updatable        => true
293   ,p_api_updating     => l_api_updating
294   );
295   --
296   -- adjustment_only_flag
297   --
298   chk_lookup
299   (p_effective_date   => p_effective_date
300   ,p_caller           => l_proc
301   ,p_argument_name    => 'adjustment_only_flag'
302   ,p_old_lookup_code  => pay_set_shd.g_old_rec.adjustment_only_flag
303   ,p_lookup_code      => p_adjustment_only_flag
304   ,p_lookup_type      => 'YES_NO'
305   ,p_mandatory        => true
306   ,p_updatable        => true
307   ,p_api_updating     => l_api_updating
308   );
309   --
310   -- closed_for_entry_flag
311   --
312   chk_lookup
313   (p_effective_date   => p_effective_date
314   ,p_caller           => l_proc
315   ,p_argument_name    => 'closed_for_entry_flag'
316   ,p_old_lookup_code  => pay_set_shd.g_old_rec.closed_for_entry_flag
317   ,p_lookup_code      => p_closed_for_entry_flag
318   ,p_lookup_type      => 'YES_NO'
319   ,p_mandatory        => true
320   ,p_updatable        => true
321   ,p_api_updating     => l_api_updating
322   );
323   --
324   -- indirect_only_flag
325   --
326   chk_lookup
327   (p_effective_date   => p_effective_date
328   ,p_caller           => l_proc
329   ,p_argument_name    => 'indirect_only_flag'
330   ,p_old_lookup_code  => pay_set_shd.g_old_rec.indirect_only_flag
331   ,p_lookup_code      => p_indirect_only_flag
332   ,p_lookup_type      => 'YES_NO'
333   ,p_mandatory        => true
334   ,p_updatable        => true
335   ,p_api_updating     => l_api_updating
336   );
337   --
338   -- multiple_entries_allowed_flag
339   --
340   chk_lookup
341   (p_effective_date   => p_effective_date
342   ,p_caller           => l_proc
343   ,p_argument_name    => 'multiple_entries_allowed_flag'
344   ,p_old_lookup_code  => pay_set_shd.g_old_rec.multiple_entries_allowed_flag
345   ,p_lookup_code      => p_multiple_entries_allowed_fla
346   ,p_lookup_type      => 'YES_NO'
347   ,p_mandatory        => true
348   ,p_updatable        => true
349   ,p_api_updating     => l_api_updating
350   );
351   --
352   -- multiply_value_flag
353   --
354   chk_lookup
355   (p_effective_date   => p_effective_date
356   ,p_caller           => l_proc
357   ,p_argument_name    => 'multiply_value_flag'
358   ,p_old_lookup_code  => pay_set_shd.g_old_rec.multiply_value_flag
359   ,p_lookup_code      => p_multiply_value_flag
360   ,p_lookup_type      => 'YES_NO'
361   ,p_mandatory        => true
362   ,p_updatable        => true
363   ,p_api_updating     => l_api_updating
364   );
365   --
366   -- post_termination_rule
367   --
368   chk_lookup
369   (p_effective_date   => p_effective_date
370   ,p_caller           => l_proc
371   ,p_argument_name    => 'post_termination_rule'
372   ,p_old_lookup_code  => pay_set_shd.g_old_rec.post_termination_rule
373   ,p_lookup_code      => p_post_termination_rule
374   ,p_lookup_type      => 'TERMINATION_RULE'
375   ,p_mandatory        => true
376   ,p_updatable        => true
377   ,p_api_updating     => l_api_updating
378   );
379   --
380   -- process_in_run_flag
381   --
382   chk_lookup
383   (p_effective_date   => p_effective_date
384   ,p_caller           => l_proc
385   ,p_argument_name    => 'process_in_run_flag'
386   ,p_old_lookup_code  => pay_set_shd.g_old_rec.process_in_run_flag
387   ,p_lookup_code      => p_process_in_run_flag
388   ,p_lookup_type      => 'YES_NO'
389   ,p_mandatory        => true
390   ,p_updatable        => true
391   ,p_api_updating     => l_api_updating
392   );
393   --
394   -- processing_type
395   --
396   chk_lookup
397   (p_effective_date   => p_effective_date
398   ,p_caller           => l_proc
399   ,p_argument_name    => 'processing_type'
400   ,p_old_lookup_code  => pay_set_shd.g_old_rec.processing_type
401   ,p_lookup_code      => p_processing_type
402   ,p_lookup_type      => 'PROCESSING_TYPE'
403   ,p_mandatory        => true
404   ,p_updatable        => true
405   ,p_api_updating     => l_api_updating
406   );
407   --
408   -- standard_link_flag
409   --
410   chk_lookup
411   (p_effective_date   => p_effective_date
412   ,p_caller           => l_proc
413   ,p_argument_name    => 'standard_link_flag'
414   ,p_old_lookup_code  => pay_set_shd.g_old_rec.standard_link_flag
415   ,p_lookup_code      => p_standard_link_flag
416   ,p_lookup_type      => 'YES_NO'
417   ,p_mandatory        => true
418   ,p_updatable        => true
419   ,p_api_updating     => l_api_updating
420   );
421   --
422   -- qualifying_units
423   --
424   chk_lookup
425   (p_effective_date   => p_effective_date
426   ,p_caller           => l_proc
427   ,p_argument_name    => 'qualifying_units'
428   ,p_old_lookup_code  => pay_set_shd.g_old_rec.qualifying_units
429   ,p_lookup_code      => p_qualifying_units
430   ,p_lookup_type      => 'QUALIFYING_UNITS'
431   ,p_mandatory        => false
432   ,p_updatable        => true
433   ,p_api_updating     => l_api_updating
434   );
435   --
436   -- third_party_pay_only_flag
437   --
438   chk_lookup
439   (p_effective_date   => p_effective_date
440   ,p_caller           => l_proc
441   ,p_argument_name    => 'third_party_only_flag'
442   ,p_old_lookup_code  => pay_set_shd.g_old_rec.third_party_pay_only_flag
443   ,p_lookup_code      => p_third_party_pay_only_flag
444   ,p_lookup_type      => 'YES_NO'
445   ,p_mandatory        => false
446   ,p_updatable        => true
447   ,p_api_updating     => l_api_updating
448   );
449   --
450   -- iterative_flag
451   --
452   chk_lookup
453   (p_effective_date   => p_effective_date
454   ,p_caller           => l_proc
455   ,p_argument_name    => 'iterative_flag'
456   ,p_old_lookup_code  => pay_set_shd.g_old_rec.iterative_flag
457   ,p_lookup_code      => p_iterative_flag
458   ,p_lookup_type      => 'YES_NO'
459   ,p_mandatory        => false
460   ,p_updatable        => true
461   ,p_api_updating     => l_api_updating
462   );
463   --
464   -- grossup_flag
465   --
466   chk_lookup
467   (p_effective_date   => p_effective_date
468   ,p_caller           => l_proc
469   ,p_argument_name    => 'grossup_flag'
470   ,p_old_lookup_code  => pay_set_shd.g_old_rec.grossup_flag
471   ,p_lookup_code      => p_grossup_flag
472   ,p_lookup_type      => 'YES_NO'
473   ,p_mandatory        => false
474   ,p_updatable        => true
475   ,p_api_updating     => l_api_updating
476   );
477   --
478   -- advance_indicator
479   --
480   chk_lookup
481   (p_effective_date   => p_effective_date
482   ,p_caller           => l_proc
483   ,p_argument_name    => 'advance_indicator'
484   ,p_old_lookup_code  => pay_set_shd.g_old_rec.advance_indicator
485   ,p_lookup_code      => p_advance_indicator
486   ,p_lookup_type      => 'YES_NO'
487   ,p_mandatory        => false
488   ,p_updatable        => true
489   ,p_api_updating     => l_api_updating
490   );
491   --
492   -- advance_payable
493   --
494   chk_lookup
495   (p_effective_date   => p_effective_date
496   ,p_caller           => l_proc
497   ,p_argument_name    => 'advance_payable'
498   ,p_old_lookup_code  => pay_set_shd.g_old_rec.advance_payable
499   ,p_lookup_code      => p_advance_payable
500   ,p_lookup_type      => 'YES_NO'
501   ,p_mandatory        => false
502   ,p_updatable        => true
503   ,p_api_updating     => l_api_updating
504   );
505   --
506   -- advance_deduction
507   --
508   chk_lookup
509   (p_effective_date   => p_effective_date
510   ,p_caller           => l_proc
511   ,p_argument_name    => 'advance_deduction'
512   ,p_old_lookup_code  => pay_set_shd.g_old_rec.advance_deduction
513   ,p_lookup_code      => p_advance_deduction
514   ,p_lookup_type      => 'YES_NO'
515   ,p_mandatory        => false
516   ,p_updatable        => true
517   ,p_api_updating     => l_api_updating
518   );
519   --
520   -- process_advance_entry
521   --
522   chk_lookup
523   (p_effective_date   => p_effective_date
524   ,p_caller           => l_proc
525   ,p_argument_name    => 'process_advance_entry'
526   ,p_old_lookup_code  => pay_set_shd.g_old_rec.process_advance_entry
527   ,p_lookup_code      => p_process_advance_entry
528   ,p_lookup_type      => 'YES_NO'
529   ,p_mandatory        => false
530   ,p_updatable        => true
531   ,p_api_updating     => l_api_updating
532   );
533   --
534   -- once_each_period_flag
535   --
536   chk_lookup
537   (p_effective_date   => p_effective_date
538   ,p_caller           => l_proc
539   ,p_argument_name    => 'once_each_period_flag'
540   ,p_old_lookup_code  => pay_set_shd.g_old_rec.once_each_period_flag
541   ,p_lookup_code      => p_once_each_period_flag
542   ,p_lookup_type      => 'YES_NO'
543   ,p_mandatory        => false
544   ,p_updatable        => true
545   ,p_api_updating     => l_api_updating
546   );
547   hr_utility.set_location(' Leaving:'||l_proc, 15);
548 End chk_lookups;
549 -- ----------------------------------------------------------------------------
550 -- |---------------------------< chk_element_name >---------------------------|
551 -- ----------------------------------------------------------------------------
552 Procedure chk_element_name
553   (p_element_name          in     varchar2
554   ,p_template_id           in     number
555   ,p_template_type         in     varchar2
556   ,p_business_group_id     in     number
557   ,p_element_type_id       in     number
558   ,p_object_version_number in     number
559   ) is
560   --
561   -- Cursor to check that the element name is unique within a template
562   -- (template_type = 'T').
563   --
564   cursor csr_T_element_name_exists is
565     select null
566     from   pay_shadow_element_types pset
567     where  pset.template_id = p_template_id
568     and    upper(nvl(pset.element_name, hr_api.g_varchar2)) =
569            upper(nvl(p_element_name, hr_api.g_varchar2));
570   --
571   -- Cursor to check that the element name is unique for a business group
572   -- (template type = 'U').
573   --
574   cursor csr_U_element_name_exists is
575     select null
576     from   pay_shadow_element_types pset
577     ,      pay_element_templates    pet
578     where  upper(pset.element_name) = upper(p_element_name)
579     and    pet.template_id  = pset.template_id
580     and    pet.template_type = 'U'
581     and    pet.business_group_id = p_business_group_id;
582 --
583   l_proc  varchar2(72) := g_package||'chk_element_name';
584   l_legislation_code varchar2(2000);
585   l_exists           varchar2(1);
586   l_value            varchar2(2000);
587   l_output           varchar2(2000);
588   l_rgeflg           varchar2(2000);
589   l_nullok           varchar2(2000);
590   l_api_updating     boolean;
591 --
592 Begin
593   hr_utility.set_location('Entering:'||l_proc, 5);
594   l_api_updating := pay_set_shd.api_updating
595   (p_element_type_id       => p_element_type_id
596   ,p_object_version_number => p_object_version_number
597   );
598   if (l_api_updating and nvl(p_element_name, hr_api.g_varchar2) <>
599       nvl(pay_set_shd.g_old_rec.element_name, hr_api.g_varchar2)) or
600       not l_api_updating
601   then
602     --
603     -- Name cannot be null if the template type is 'U'.
604     --
605     if p_template_type = 'U' then
606       l_nullok := 'N';
607     else
608       l_nullok := 'Y';
609     end if;
610     --
611     -- Check that the name format is correct (payroll name).
612     --
613     l_value := p_element_name;
614     if p_template_type = 'T' then
615       --
616       -- If template type is 'T' then the element name can begin
617       -- with a space which is not the correct format.
618       --
619       l_value := replace(l_value, ' ', 'A');
620     end if;
621     hr_chkfmt.checkformat
622     (value   => l_value
623     ,format  => 'PAY_NAME'
624     ,output  => l_output
625     ,minimum => null
626     ,maximum => null
627     ,nullok  => l_nullok
628     ,rgeflg  => l_rgeflg
629     ,curcode => null
630     );
631     --
632     -- Uniqueness checks.
633     --
634     if p_template_type = 'T' then
635       --
636       -- Check for uniqueness using the cursor.
637       --
638       open csr_T_element_name_exists;
639       fetch csr_T_element_name_exists into l_exists;
640       if csr_T_element_name_exists%found then
641         close csr_T_element_name_exists;
642         hr_utility.set_location(' Leaving:'||l_proc, 10);
643         fnd_message.set_name('PAY', 'PAY_50139_SET_ELEMENT_EXISTS');
644         fnd_message.set_token('ELEMENT_NAME', p_element_name);
645         fnd_message.raise_error;
646       end if;
647       close csr_T_element_name_exists;
648     elsif p_template_type = 'U' then
649       --
650       -- Check for uniqueness using the cursor.
651       --
652       open csr_U_element_name_exists;
653       fetch csr_U_element_name_exists into l_exists;
654       if csr_U_element_name_exists%found then
655         close csr_U_element_name_exists;
656         hr_utility.set_location(' Leaving:'||l_proc, 15);
657         fnd_message.set_name('PAY', 'PAY_50139_SET_ELEMENT_EXISTS');
658         fnd_message.set_token('ELEMENT_NAME', p_element_name);
659         fnd_message.raise_error;
660       end if;
661       close csr_U_element_name_exists;
662     end if;
663   end if;
664   hr_utility.set_location(' Leaving:'||l_proc, 20);
665 End chk_element_name;
666 -- ----------------------------------------------------------------------------
667 -- |---------------------< chk_processing_priority >--------------------------|
668 -- ----------------------------------------------------------------------------
669 Procedure chk_processing_priority
670 (p_relative_processing_priority in number
671 ,p_base_processing_priority     in number
672 ,p_element_type_id              in number
673 ,p_object_version_number        in number
674 ) is
675 --
676   l_proc  varchar2(72) := g_package||'chk_processing_priority';
677   l_api_updating boolean;
678   l_lower constant number := 0;
679   l_upper constant number := pay_etm_shd.g_max_processing_priority;
680   l_too_large varchar2(1);
681 --
682 Begin
683   hr_utility.set_location('Entering:'||l_proc, 5);
684   l_api_updating := pay_set_shd.api_updating
685     (p_element_type_id       => p_element_type_id
686     ,p_object_version_number => p_object_version_number
687     );
688   --
689   if (l_api_updating and
690       nvl(pay_set_shd.g_old_rec.relative_processing_priority, hr_api.g_number)
691       <> nvl(p_relative_processing_priority, hr_api.g_number)) or
692      not l_api_updating
693   then
694     --
695     -- Check that the priority is not null.
696     --
697     hr_api.mandatory_arg_error
698     (p_api_name       => l_proc
699     ,p_argument       => 'p_relative_processing_priority'
700     ,p_argument_value => p_relative_processing_priority
701     );
702     --
703     -- Check that the processing priority sum is within the allowable range.
704     --
705     if (p_relative_processing_priority < l_lower - p_base_processing_priority) or
706        (p_relative_processing_priority > l_upper - p_base_processing_priority)
707     then
708       hr_utility.set_location(' Leaving:'||l_proc, 15);
709       fnd_message.set_name('PAY', 'PAY_50140_SET_PRI_SUM_RANGE');
710       fnd_message.set_token('PRIORITY', p_relative_processing_priority);
711       fnd_message.set_token('LOWER', l_lower);
712       fnd_message.set_token('UPPER', l_upper);
713       fnd_message.raise_error;
714     end if;
715   end if;
716   hr_utility.set_location(' Leaving:'||l_proc, 25);
717 End chk_processing_priority;
718 -- ----------------------------------------------------------------------------
719 -- |--------------------------< chk_input_currency_code >---------------------|
720 -- ----------------------------------------------------------------------------
721 Procedure chk_input_currency_code
722   (p_input_currency_code   in     varchar2
723   ,p_element_type_id       in     number
724   ,p_object_version_number in     number
725   ) is
726   --
727   -- Check that the currency code is valid.
728   --
729   cursor csr_valid_currency_code is
730   select null
731   from   fnd_currencies fc
732   where  upper(fc.currency_code) = upper(p_input_currency_code)
733   and    fc.enabled_flag = 'Y'
734   and    fc.currency_flag = 'Y';
735 --
736   l_proc  varchar2(72) := g_package||'chk_input_currency_code';
737   l_api_updating boolean;
738   l_valid        varchar2(1);
739 --
740 Begin
741   hr_utility.set_location('Entering:'||l_proc, 5);
742   l_api_updating := pay_set_shd.api_updating
743   (p_element_type_id       => p_element_type_id
744   ,p_object_version_number => p_object_version_number
745   );
746   if (l_api_updating and nvl(p_input_currency_code, hr_api.g_varchar2) <>
747       nvl(pay_set_shd.g_old_rec.input_currency_code, hr_api.g_varchar2)) or
748      not l_api_updating
749   then
750     if p_input_currency_code is not null then
751       open csr_valid_currency_code;
752       fetch csr_valid_currency_code into l_valid;
753       if csr_valid_currency_code%notfound then
754         hr_utility.set_location(' Leaving:'||l_proc, 10);
755         close csr_valid_currency_code;
756         fnd_message.set_name('PAY', 'HR_51855_QUA_CCY_INV');
757         fnd_message.raise_error;
758       end if;
759       close csr_valid_currency_code;
760     end if;
761     hr_utility.set_location(' Leaving:'||l_proc, 15);
762   end if;
763 End chk_input_currency_code;
764 -- ----------------------------------------------------------------------------
765 -- |-------------------------< chk_output_currency_code >---------------------|
766 -- ----------------------------------------------------------------------------
767 Procedure chk_output_currency_code
768   (p_output_currency_code  in     varchar2
769   ,p_element_type_id       in     number
770   ,p_object_version_number in     number
771   ) is
772   --
773   -- Check that the currency code is valid.
774   --
775   cursor csr_valid_currency_code is
776   select null
777   from   fnd_currencies fc
778   where  upper(fc.currency_code) = upper(p_output_currency_code)
779   and    fc.enabled_flag = 'Y'
780   and    fc.currency_flag = 'Y';
781 --
782   l_proc  varchar2(72) := g_package||'chk_output_currency_code';
783   l_api_updating boolean;
784   l_valid        varchar2(1);
785 --
786 Begin
787   hr_utility.set_location('Entering:'||l_proc, 5);
788   l_api_updating := pay_set_shd.api_updating
789   (p_element_type_id       => p_element_type_id
790   ,p_object_version_number => p_object_version_number
791   );
792   if (l_api_updating and nvl(p_output_currency_code, hr_api.g_varchar2) <>
793       nvl(pay_set_shd.g_old_rec.output_currency_code, hr_api.g_varchar2)) or
794      not l_api_updating
795   then
796     if p_output_currency_code is not null then
797       open csr_valid_currency_code;
798       fetch csr_valid_currency_code into l_valid;
799       if csr_valid_currency_code%notfound then
800         hr_utility.set_location(' Leaving:'||l_proc, 10);
801         close csr_valid_currency_code;
802         fnd_message.set_name('PAY', 'HR_51855_QUA_CCY_INV');
803         fnd_message.raise_error;
804       end if;
805       close csr_valid_currency_code;
806     end if;
807     hr_utility.set_location(' Leaving:'||l_proc, 15);
808   end if;
809 End chk_output_currency_code;
810 -- ----------------------------------------------------------------------------
811 -- |---------------------< chk_payroll_formula_id >---------------------------|
812 -- ----------------------------------------------------------------------------
813 Procedure chk_payroll_formula_id
814   (p_payroll_formula_id     in     number
815   ,p_template_id            in     number
816   ,p_template_type          in     varchar2
817   ,p_business_group_id      in     number
818   ,p_legislation_code       in     varchar2
819   ,p_element_type_id        in     number
820   ,p_object_version_number  in     number
821   ) is
822 --
823   --
824   -- Check that the payroll formula is valid.
825   --
826   -- If the shadow element belongs to a template of type 'T' then the formula
827   -- may be shared with other templates, but the legislative domain of the
828   -- formula must encompass that of the template.
829   cursor csr_T_formula_valid is
830   select null
831   from   pay_shadow_formulas sf
832   where  sf.formula_id = p_payroll_formula_id
833   and    sf.template_type = 'T'
834   and    nvl(sf.formula_type_name,pay_sf_shd.g_payroll_formula_type) = pay_sf_shd.g_payroll_formula_type
835   and    ((sf.legislation_code is null and sf.business_group_id is null) or
836           sf.legislation_code = p_legislation_code or
837           sf.business_group_id = p_business_group_id);
838   --
839   -- If the shadow element belongs to a template of type 'U' then the formula
840   -- must not be shared with any other templates to avoid name clashes.
841   --
842   cursor csr_U_formula_valid is
843   select null
844   from   pay_shadow_formulas sf
845   where  sf.formula_id = p_payroll_formula_id
846   and    sf.template_type = 'U'
847   and    nvl(sf.formula_type_name,pay_sf_shd.g_payroll_formula_type) = pay_sf_shd.g_payroll_formula_type
848   and    sf.business_group_id = p_business_group_id
849   and    not exists
850          (select null
851           from   pay_shadow_element_types pset
852           where  pset.payroll_formula_id = p_payroll_formula_id
853           and    pset.template_id <> p_template_id);
854 --
855   l_proc  varchar2(72) := g_package||'chk_payroll_formula_id';
856   l_api_updating boolean;
857   l_valid        varchar2(1);
858 --
859 Begin
860   hr_utility.set_location('Entering:'||l_proc, 5);
861   l_api_updating := pay_set_shd.api_updating
862   (p_element_type_id       => p_element_type_id
863   ,p_object_version_number => p_object_version_number
864   );
865   if (l_api_updating and nvl(p_payroll_formula_id, hr_api.g_number) <>
866       nvl(pay_set_shd.g_old_rec.payroll_formula_id, hr_api.g_number)) or
867      not l_api_updating
868   then
869     if p_payroll_formula_id is not null then
870       if p_template_type = 'T' then
871         open csr_T_formula_valid;
872         fetch csr_T_formula_valid into l_valid;
873         if csr_T_formula_valid%notfound then
874           hr_utility.set_location(' Leaving:'||l_proc, 10);
875           close csr_T_formula_valid;
876           fnd_message.set_name('PAY', 'PAY_50141_SET_BAD_PAY_FORMULA');
877           fnd_message.raise_error;
878         end if;
879         close csr_T_formula_valid;
880       elsif p_template_type = 'U' then
881         open csr_U_formula_valid;
882         fetch csr_U_formula_valid into l_valid;
883         if csr_U_formula_valid%notfound then
884           hr_utility.set_location(' Leaving:'||l_proc, 15);
885           close csr_U_formula_valid;
886           fnd_message.set_name('PAY', 'PAY_50141_SET_BAD_PAY_FORMULA');
887           fnd_message.raise_error;
888         end if;
889         close csr_U_formula_valid;
890       end if;
891     end if;
892   end if;
893   hr_utility.set_location(' Leaving:'||l_proc, 20);
894 End chk_payroll_formula_id;
895 -- ----------------------------------------------------------------------------
896 -- |-------------------------< chk_exclusion_rule_id >------------------------|
897 -- ----------------------------------------------------------------------------
898 Procedure chk_exclusion_rule_id
899   (p_exclusion_rule_id     in     number
900   ,p_template_id           in     number
901   ,p_element_type_id       in     number
902   ,p_object_version_number in     number
903   ) is
904   --
905   -- Cursor to check that the exclusion_rule_id is valid.
906   --
907   cursor csr_exclusion_rule_id_valid is
908   select null
909   from pay_template_exclusion_rules ter
910   where ter.exclusion_rule_id = p_exclusion_rule_id
911   and   ter.template_id = p_template_id;
912 --
913   l_proc  varchar2(72) := g_package||'chk_exclusion_rule_id';
914   l_api_updating boolean;
915   l_valid        varchar2(1);
916 --
917 Begin
918   hr_utility.set_location('Entering:'||l_proc, 5);
919   l_api_updating := pay_set_shd.api_updating
920   (p_element_type_id       => p_element_type_id
921   ,p_object_version_number => p_object_version_number
922   );
923   if (l_api_updating and nvl(p_exclusion_rule_id, hr_api.g_number) <>
924       nvl(pay_set_shd.g_old_rec.exclusion_rule_id, hr_api.g_number)) or
925      not l_api_updating
926   then
927     if p_exclusion_rule_id is not null then
928       open csr_exclusion_rule_id_valid;
929       fetch csr_exclusion_rule_id_valid into l_valid;
930       if csr_exclusion_rule_id_valid%notfound then
931         hr_utility.set_location('Leaving:'||l_proc, 10);
932         close csr_exclusion_rule_id_valid;
933         fnd_message.set_name('PAY', 'PAY_50100_ETM_INVALID_EXC_RULE');
934         fnd_message.raise_error;
935       end if;
936       close csr_exclusion_rule_id_valid;
937     end if;
938   end if;
939   hr_utility.set_location(' Leaving:'||l_proc, 15);
940 End chk_exclusion_rule_id;
941 --
942 -- ----------------------------------------------------------------------------
943 -- |----------------------------< chk_iterative_flag >------------------------|
944 -- ----------------------------------------------------------------------------
945 Procedure chk_iterative_flag
946   (p_iterative_flag  in  varchar2
947   ,p_grossup_flag    in  varchar2
948   ) is
949 --
950   l_proc  varchar2(72)  := g_package||'chk_iterative_flag';
951 --
952 Begin
953   hr_utility.set_location('Entering:'||l_proc, 5);
954   if (p_grossup_flag = 'Y' and p_iterative_flag <> 'Y') then
955     fnd_message.set_name('PAY', 'PAY_34147_ELE_ITR_GROSSUP');
956     fnd_message.raise_error;
957   end if;
958   hr_utility.set_location(' Leaving:'||l_proc, 10);
959 End chk_iterative_flag;
960 --
961 -- ----------------------------------------------------------------------------
962 -- |-----------------------< chk_iterative_priority >-------------------------|
963 -- ----------------------------------------------------------------------------
964 Procedure chk_iterative_priority
965   (p_iterative_priority  in number
966   ,p_iterative_flag      in varchar2
967   ) is
968 --
969   l_proc  varchar2(72)  := g_package||'chk_iterative_priority';
970 --
971 Begin
972   hr_utility.set_location('Entering:'||l_proc, 5);
973   if (p_iterative_flag = 'N' and p_iterative_priority is not null) then
974     fnd_message.set_name('PAY', 'PAY_34144_ELE_ITR_NO_FORML_PRI');
975     fnd_message.raise_error;
976   end if;
977   hr_utility.set_location(' Leaving:'||l_proc, 10);
978 End chk_iterative_priority;
979 --
980 -- ----------------------------------------------------------------------------
981 -- |--------------------< chk_iterative_formula_name >------------------------|
982 -- ----------------------------------------------------------------------------
983 Procedure chk_iterative_formula_name
984   (p_iterative_formula_name  in varchar2
985   ,p_iterative_flag          in varchar2
986   ) is
987 --
988   l_proc  varchar2(72)  := g_package||'chk_iterative_formula_name';
989 --
990 Begin
991   hr_utility.set_location('Entering:'||l_proc, 5);
992   if p_iterative_flag is not null then
993     if (p_iterative_flag = 'N' and p_iterative_formula_name is not null) then
994       fnd_message.set_name('PAY', 'PAY_34144_ELE_ITR_NO_FORML_PRI');
995       fnd_message.raise_error;
996     end if;
997     if (p_iterative_flag = 'Y' and p_iterative_formula_name is null) then
998       fnd_message.set_name('PAY', 'PAY_34146_ELE_ITR_FORML_REQD');
999       fnd_message.raise_error;
1000     end if;
1001   end if;
1002   hr_utility.set_location(' Leaving:'||l_proc, 10);
1003 End chk_iterative_formula_name;
1004 --
1005 -- ----------------------------------------------------------------------------
1006 -- |--------------------------< chk_process_mode >----------------------------|
1007 -- ----------------------------------------------------------------------------
1008 Procedure chk_process_mode
1009   (p_process_mode  in  varchar2
1010   ,p_grossup_flag  in  varchar2
1011   ) is
1012 --
1013   l_proc  varchar2(72)  := g_package||'chk_process_mode';
1014 --
1015 Begin
1016   hr_utility.set_location('Entering:'||l_proc, 5);
1017   if (p_grossup_flag = 'Y' and p_process_mode = 'N') then
1018     fnd_message.set_name('PAY', 'PAY_50093_ELE_GROSSUP_PROC_MOD');
1019     fnd_message.raise_error;
1020   end if;
1021   --
1022   if (p_process_mode not in ('N','S','P')) then
1023     fnd_message.set_name('PAY', 'PAY_34148_ELE_PROC_MODE');
1024     fnd_message.raise_error;
1025   end if;
1026   hr_utility.set_location(' Leaving:'||l_proc, 10);
1027 End chk_process_mode;
1028 --
1029 -- ----------------------------------------------------------------------------
1030 -- |------------------------------< chk_delete >------------------------------|
1031 -- ----------------------------------------------------------------------------
1032 Procedure chk_delete
1033   (p_element_type_id     in     number
1034   ) is
1035   --
1036   -- Cursors to check for rows referencing the element.
1037   --
1038   cursor csr_input_values is
1039   select null
1040   from   pay_shadow_input_values psiv
1041   where  psiv.element_type_id = p_element_type_id;
1042   --
1043   cursor csr_core_objects is
1044   select null
1045   from   pay_template_core_objects tco
1046   where  (tco.core_object_type = pay_tco_shd.g_set_lookup_type or
1047           tco.core_object_type = pay_tco_shd.g_spr_lookup_type)
1048   and    tco.shadow_object_id = p_element_type_id;
1049   --
1050   cursor csr_formula_rules is
1051   select null
1052   from   pay_shadow_formula_rules sfr
1053   where  sfr.shadow_element_type_id = p_element_type_id or
1054          sfr.element_type_id = p_element_type_id;
1055   --
1056   cursor csr_sub_classi_rules is
1057   select null
1058   from   pay_shadow_sub_classi_rules ssr
1059   where  ssr.element_type_id = p_element_type_id;
1060   --
1061   cursor csr_iterative_rules is
1062   select null
1063   from   pay_shadow_iterative_rules sir
1064   where  sir.element_type_id = p_element_type_id;
1065   --
1066   cursor csr_ele_type_usages is
1067   select null
1068   from   pay_shadow_ele_type_usages seu
1069   where  seu.element_type_id = p_element_type_id;
1070   --
1071   cursor csr_gu_bal_exclusions is
1072   select null
1073   from   pay_shadow_gu_bal_exclusions sgb
1074   where  sgb.source_id = p_element_type_id;
1075   --
1076   cursor csr_template_ff_usages is
1077   select null
1078   from   pay_template_ff_usages tfu
1079   where  tfu.object_id = p_element_type_id;
1080 --
1081   l_proc  varchar2(72) := g_package||'chk_delete';
1082   l_error  exception;
1083   l_exists varchar2(1);
1084 --
1085 Begin
1086   hr_utility.set_location('Entering:'||l_proc, 5);
1087   --
1088   open csr_input_values;
1089   fetch csr_input_values into l_exists;
1090   if csr_input_values%found then
1091     hr_utility.set_location(' Leaving:'||l_proc, 10);
1092     close csr_input_values;
1093     raise l_error;
1094   end if;
1095   close csr_input_values;
1096   --
1097   open csr_core_objects;
1098   fetch csr_core_objects into l_exists;
1099   if csr_core_objects%found then
1100     hr_utility.set_location(' Leaving:'||l_proc, 15);
1101     close csr_core_objects;
1102     raise l_error;
1103   end if;
1104   close csr_core_objects;
1105   --
1106   open csr_formula_rules;
1107   fetch csr_formula_rules into l_exists;
1108   if csr_formula_rules%found then
1109     hr_utility.set_location(' Leaving:'||l_proc, 20);
1110     close csr_formula_rules;
1111     raise l_error;
1112   end if;
1113   close csr_formula_rules;
1114   --
1115   open csr_sub_classi_rules;
1116   fetch csr_sub_classi_rules into l_exists;
1117   if csr_sub_classi_rules%found then
1118     hr_utility.set_location(' Leaving:'||l_proc, 25);
1119     close csr_sub_classi_rules;
1120     raise l_error;
1121   end if;
1122   close csr_sub_classi_rules;
1123   --
1124   open csr_iterative_rules;
1125   fetch csr_iterative_rules into l_exists;
1126   if csr_iterative_rules%found then
1127     hr_utility.set_location(' Leaving:'||l_proc, 30);
1128     close csr_iterative_rules;
1129     raise l_error;
1130   end if;
1131   close csr_iterative_rules;
1132   --
1133   open csr_ele_type_usages;
1134   fetch csr_ele_type_usages into l_exists;
1135   if csr_ele_type_usages%found then
1136     hr_utility.set_location(' Leaving:'||l_proc, 35);
1137     close csr_ele_type_usages;
1138     raise l_error;
1139   end if;
1140   close csr_ele_type_usages;
1141   --
1142   open csr_gu_bal_exclusions;
1143   fetch csr_gu_bal_exclusions into l_exists;
1144   if csr_gu_bal_exclusions%found then
1145     hr_utility.set_location(' Leaving:'||l_proc, 40);
1146     close csr_gu_bal_exclusions;
1147     raise l_error;
1148   end if;
1149   close csr_gu_bal_exclusions;
1150   --
1151   open csr_template_ff_usages;
1152   fetch csr_template_ff_usages into l_exists;
1153   if csr_template_ff_usages%found then
1154     hr_utility.set_location(' Leaving:'||l_proc, 45);
1155     close csr_template_ff_usages;
1156     raise l_error;
1157   end if;
1158   close csr_template_ff_usages;
1159 exception
1160   when l_error then
1161     fnd_message.set_name('PAY', 'PAY_50138_SET_INVALID_DELETE');
1162     fnd_message.raise_error;
1163   when others then
1164     hr_utility.set_location(' Leaving:'||l_proc, 200);
1165     raise;
1166   hr_utility.set_location(' Leaving:'||l_proc, 205);
1167 End chk_delete;
1168 -- ----------------------------------------------------------------------------
1169 -- |---------------------------< insert_validate >----------------------------|
1170 -- ----------------------------------------------------------------------------
1171 Procedure insert_validate
1172 (p_effective_date in date
1173 ,p_rec in pay_set_shd.g_rec_type
1174 ) is
1175 --
1176   l_proc  varchar2(72) := g_package||'insert_validate';
1177   l_business_group_id        number;
1178   l_legislation_code         varchar2(2000);
1179   l_template_type            varchar2(2000);
1180   l_base_processing_priority number;
1181 --
1182 Begin
1183   hr_utility.set_location('Entering:'||l_proc, 5);
1184   --
1185   -- Call all supporting business operations
1186   --
1187   chk_template_id(p_template_id => p_rec.template_id);
1188   --
1189   get_template_info
1190   (p_template_id              => p_rec.template_id
1191   ,p_business_group_id        => l_business_group_id
1192   ,p_legislation_code         => l_legislation_code
1193   ,p_template_type            => l_template_type
1194   ,p_base_processing_priority => l_base_processing_priority
1195   );
1196   --
1197   chk_classification_name
1198   (p_classification_name   => p_rec.classification_name
1199   ,p_element_type_id       => p_rec.element_type_id
1200   ,p_object_version_number => p_rec.object_version_number
1201   );
1202   --
1203   chk_lookups
1204   (p_effective_date               => p_effective_date
1205   ,p_additional_entry_allowed_fla => p_rec.additional_entry_allowed_flag
1206   ,p_adjustment_only_flag         => p_rec.adjustment_only_flag
1207   ,p_closed_for_entry_flag        => p_rec.closed_for_entry_flag
1208   ,p_indirect_only_flag           => p_rec.indirect_only_flag
1209   ,p_multiple_entries_allowed_fla => p_rec.multiple_entries_allowed_flag
1210   ,p_multiply_value_flag          => p_rec.multiply_value_flag
1211   ,p_post_termination_rule        => p_rec.post_termination_rule
1212   ,p_process_in_run_flag          => p_rec.process_in_run_flag
1213   ,p_processing_type              => p_rec.processing_type
1214   ,p_standard_link_flag           => p_rec.standard_link_flag
1215   ,p_qualifying_units             => p_rec.qualifying_units
1216   ,p_third_party_pay_only_flag    => p_rec.third_party_pay_only_flag
1217   ,p_iterative_flag               => p_rec.iterative_flag
1218   ,p_grossup_flag                 => p_rec.grossup_flag
1219   ,p_advance_indicator            => p_rec.advance_indicator
1220   ,p_advance_payable              => p_rec.advance_payable
1221   ,p_advance_deduction            => p_rec.advance_deduction
1222   ,p_process_advance_entry        => p_rec.process_advance_entry
1223   ,p_once_each_period_flag        => p_rec.once_each_period_flag
1224   ,p_element_type_id              => p_rec.element_type_id
1225   ,p_object_version_number        => p_rec.object_version_number
1226   );
1227   --
1228   chk_element_name
1229   (p_element_name          => p_rec.element_name
1230   ,p_template_id           => p_rec.template_id
1231   ,p_template_type         => l_template_type
1232   ,p_business_group_id     => l_business_group_id
1233   ,p_element_type_id       => p_rec.element_type_id
1234   ,p_object_version_number => p_rec.object_version_number
1235   );
1236   --
1237   chk_processing_priority
1238   (p_relative_processing_priority => p_rec.relative_processing_priority
1239   ,p_base_processing_priority     => l_base_processing_priority
1240   ,p_element_type_id              => p_rec.element_type_id
1241   ,p_object_version_number        => p_rec.object_version_number
1242   );
1243   --
1244   chk_input_currency_code
1245   (p_input_currency_code   => p_rec.input_currency_code
1246   ,p_element_type_id       => p_rec.element_type_id
1247   ,p_object_version_number => p_rec.object_version_number
1248   );
1249   --
1250   chk_output_currency_code
1251   (p_output_currency_code  => p_rec.output_currency_code
1252   ,p_element_type_id       => p_rec.element_type_id
1253   ,p_object_version_number => p_rec.object_version_number
1254   );
1255   --
1256   chk_payroll_formula_id
1257   (p_payroll_formula_id    => p_rec.payroll_formula_id
1258   ,p_template_id           => p_rec.template_id
1259   ,p_template_type         => l_template_type
1260   ,p_business_group_id     => l_business_group_id
1261   ,p_legislation_code      => l_legislation_code
1262   ,p_element_type_id       => p_rec.element_type_id
1263   ,p_object_version_number => p_rec.object_version_number
1264   );
1265   --
1266   chk_exclusion_rule_id
1267   (p_exclusion_rule_id     => p_rec.exclusion_rule_id
1268   ,p_template_id           => p_rec.template_id
1269   ,p_element_type_id       => p_rec.element_type_id
1270   ,p_object_version_number => p_rec.object_version_number
1271   );
1272   --
1273   chk_iterative_flag
1274   (p_iterative_flag        => p_rec.iterative_flag
1275   ,p_grossup_flag          => p_rec.grossup_flag
1276   );
1277   --
1278   chk_iterative_priority
1279   (p_iterative_priority    => p_rec.iterative_priority
1280   ,p_iterative_flag        => p_rec.iterative_flag
1281   );
1282   --
1283   chk_iterative_formula_name
1284   (p_iterative_formula_name => p_rec.iterative_formula_name
1285   ,p_iterative_flag         => p_rec.iterative_flag
1286   );
1287   --
1288   chk_process_mode
1289   (p_process_mode           => p_rec.process_mode
1290   ,p_grossup_flag           => p_rec.grossup_flag
1291   );
1292   hr_utility.set_location(' Leaving:'||l_proc, 10);
1293 End insert_validate;
1294 --
1295 -- ----------------------------------------------------------------------------
1296 -- |---------------------------< update_validate >----------------------------|
1297 -- ----------------------------------------------------------------------------
1298 Procedure update_validate
1299 (p_effective_date in date
1300 ,p_rec in pay_set_shd.g_rec_type
1301 ) is
1302 --
1303   l_proc  varchar2(72) := g_package||'update_validate';
1304   l_business_group_id        number;
1305   l_legislation_code         varchar2(2000);
1306   l_template_type            varchar2(2000);
1307   l_base_processing_priority number;
1308 --
1309 Begin
1310   hr_utility.set_location('Entering:'||l_proc, 5);
1311   --
1312   -- Call all supporting business operations
1313   --
1314   chk_non_updateable_args(p_rec);
1315   --
1316   get_template_info
1317   (p_template_id              => p_rec.template_id
1318   ,p_business_group_id        => l_business_group_id
1319   ,p_legislation_code         => l_legislation_code
1320   ,p_template_type            => l_template_type
1321   ,p_base_processing_priority => l_base_processing_priority
1322   );
1323   --
1324   chk_classification_name
1325   (p_classification_name   => p_rec.classification_name
1326   ,p_element_type_id       => p_rec.element_type_id
1327   ,p_object_version_number => p_rec.object_version_number
1328   );
1329   --
1330   chk_lookups
1331   (p_effective_date               => p_effective_date
1332   ,p_additional_entry_allowed_fla => p_rec.additional_entry_allowed_flag
1333   ,p_adjustment_only_flag         => p_rec.adjustment_only_flag
1334   ,p_closed_for_entry_flag        => p_rec.closed_for_entry_flag
1335   ,p_indirect_only_flag           => p_rec.indirect_only_flag
1336   ,p_multiple_entries_allowed_fla => p_rec.multiple_entries_allowed_flag
1337   ,p_multiply_value_flag          => p_rec.multiply_value_flag
1338   ,p_post_termination_rule        => p_rec.post_termination_rule
1339   ,p_process_in_run_flag          => p_rec.process_in_run_flag
1340   ,p_processing_type              => p_rec.processing_type
1341   ,p_standard_link_flag           => p_rec.standard_link_flag
1342   ,p_qualifying_units             => p_rec.qualifying_units
1343   ,p_third_party_pay_only_flag    => p_rec.third_party_pay_only_flag
1344   ,p_iterative_flag               => p_rec.iterative_flag
1345   ,p_grossup_flag                 => p_rec.grossup_flag
1346   ,p_advance_indicator            => p_rec.advance_indicator
1347   ,p_advance_payable              => p_rec.advance_payable
1348   ,p_advance_deduction            => p_rec.advance_deduction
1349   ,p_process_advance_entry        => p_rec.process_advance_entry
1350   ,p_once_each_period_flag        => p_rec.once_each_period_flag
1351   ,p_element_type_id              => p_rec.element_type_id
1352   ,p_object_version_number        => p_rec.object_version_number
1353   );
1354   --
1355   chk_element_name
1356   (p_element_name          => p_rec.element_name
1357   ,p_template_id           => p_rec.template_id
1358   ,p_template_type         => l_template_type
1359   ,p_business_group_id     => l_business_group_id
1360   ,p_element_type_id       => p_rec.element_type_id
1361   ,p_object_version_number => p_rec.object_version_number
1362   );
1363   --
1364   chk_processing_priority
1365   (p_relative_processing_priority => p_rec.relative_processing_priority
1366   ,p_base_processing_priority     => l_base_processing_priority
1367   ,p_element_type_id              => p_rec.element_type_id
1368   ,p_object_version_number        => p_rec.object_version_number
1369   );
1370   --
1371   chk_input_currency_code
1372   (p_input_currency_code   => p_rec.input_currency_code
1373   ,p_element_type_id       => p_rec.element_type_id
1374   ,p_object_version_number => p_rec.object_version_number
1375   );
1376   --
1377   chk_output_currency_code
1378   (p_output_currency_code  => p_rec.output_currency_code
1379   ,p_element_type_id       => p_rec.element_type_id
1380   ,p_object_version_number => p_rec.object_version_number
1381   );
1382   --
1383   chk_payroll_formula_id
1384   (p_payroll_formula_id    => p_rec.payroll_formula_id
1385   ,p_template_id           => p_rec.template_id
1386   ,p_template_type         => l_template_type
1387   ,p_business_group_id     => l_business_group_id
1388   ,p_legislation_code      => l_legislation_code
1389   ,p_element_type_id       => p_rec.element_type_id
1390   ,p_object_version_number => p_rec.object_version_number
1391   );
1392   --
1393   chk_exclusion_rule_id
1394   (p_exclusion_rule_id     => p_rec.exclusion_rule_id
1395   ,p_template_id           => p_rec.template_id
1396   ,p_element_type_id       => p_rec.element_type_id
1397   ,p_object_version_number => p_rec.object_version_number
1398   );
1399   --
1400   chk_iterative_flag
1401   (p_iterative_flag        => p_rec.iterative_flag
1402   ,p_grossup_flag          => p_rec.grossup_flag
1403   );
1404   --
1405   chk_iterative_priority
1406   (p_iterative_priority    => p_rec.iterative_priority
1407   ,p_iterative_flag        => p_rec.iterative_flag
1408   );
1409   --
1410   chk_iterative_formula_name
1411   (p_iterative_formula_name => p_rec.iterative_formula_name
1412   ,p_iterative_flag         => p_rec.iterative_flag
1413   );
1414   --
1415   chk_process_mode
1416   (p_process_mode           => p_rec.process_mode
1417   ,p_grossup_flag           => p_rec.grossup_flag
1418   );
1419   hr_utility.set_location(' Leaving:'||l_proc, 10);
1420 End update_validate;
1421 --
1422 -- ----------------------------------------------------------------------------
1423 -- |---------------------------< delete_validate >----------------------------|
1424 -- ----------------------------------------------------------------------------
1425 Procedure delete_validate(p_rec in pay_set_shd.g_rec_type) is
1426 --
1427   l_proc  varchar2(72) := g_package||'delete_validate';
1428 --
1429 Begin
1430   hr_utility.set_location('Entering:'||l_proc, 5);
1431   --
1432   -- Call all supporting business operations
1433   --
1434   chk_delete(p_rec.element_type_id);
1435   hr_utility.set_location(' Leaving:'||l_proc, 10);
1436 End delete_validate;
1437 --
1438 end pay_set_bus;