DBA Data[Home] [Help]

PACKAGE BODY: APPS.PAY_ETM_BUS

Source


1 Package Body pay_etm_bus as
2 /* $Header: pyetmrhi.pkb 120.0 2005/05/29 04:42:30 appldev noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33)	:= '  pay_etm_bus.';  -- Global package name
9 --
10 -- ----------------------------------------------------------------------------
11 -- |-----------------------< chk_non_updateable_args >------------------------|
12 -- ----------------------------------------------------------------------------
16 --
13 Procedure chk_non_updateable_args
14 (p_rec in pay_etm_shd.g_rec_type
15 ) is
17   l_proc  varchar2(72) := g_package||'chk_non_updateable_args';
18   l_error exception;
19   l_api_updating boolean;
20   l_argument     varchar2(30);
21 --
22 Begin
23   hr_utility.set_location('Entering:'||l_proc, 5);
24   l_api_updating := pay_etm_shd.api_updating
25     (p_template_id           => p_rec.template_id
26     ,p_object_version_number => p_rec.object_version_number
27     );
28   if not l_api_updating then
29     hr_utility.set_message(801,'HR_6153_ALL_PROCEDURE_FAIL');
30     hr_utility.set_message_token('PROCEDURE', l_proc);
31     hr_utility.set_message_token('STEP', '10');
32     hr_utility.raise_error;
33   end if;
34   --
35   hr_utility.set_location(l_proc, 15);
36   --
37   -- p_business_group_id
38   --
39   if nvl(p_rec.business_group_id, hr_api.g_number) <>
40      nvl(pay_etm_shd.g_old_rec.business_group_id, hr_api.g_number)
41   then
42     l_argument := 'p_business_group_id';
43     raise l_error;
44   end if;
45   --
46   -- p_legislation_code
47   --
48   if nvl(p_rec.legislation_code, hr_api.g_varchar2) <>
49      nvl(pay_etm_shd.g_old_rec.legislation_code, hr_api.g_varchar2)
50   then
51     l_argument := 'p_legislation_code';
52     raise l_error;
53   end if;
54   --
55   -- p_template_name
56   --
57   if nvl(p_rec.template_name, hr_api.g_varchar2) <>
58      nvl(pay_etm_shd.g_old_rec.template_name, hr_api.g_varchar2)
59   then
60     l_argument := 'p_template_name';
61     raise l_error;
62   end if;
63   --
64   -- p_template_type
65   --
66   if nvl(p_rec.template_type, hr_api.g_varchar2) <>
67      nvl(pay_etm_shd.g_old_rec.template_type, hr_api.g_varchar2)
68   then
69     l_argument := 'p_template_type';
70     raise l_error;
71   end if;
72   --
73   -- p_base_name
74   --
75   if nvl(p_rec.base_name, hr_api.g_varchar2) <>
76      nvl(pay_etm_shd.g_old_rec.base_name, hr_api.g_varchar2)
77   then
78     l_argument := 'p_base_name';
79     raise l_error;
80   end if;
81   hr_utility.set_location('Leaving:'||l_proc, 20);
82 exception
83     when l_error then
84        hr_utility.set_location('Leaving:'||l_proc, 25);
85        hr_api.argument_changed_error
86          (p_api_name => l_proc
87          ,p_argument => l_argument);
88     when others then
89        hr_utility.set_location('Leaving:'||l_proc, 30);
90        raise;
91 End chk_non_updateable_args;
92 -- ----------------------------------------------------------------------------
93 -- |-------------------------< chk_busgrp_legcode >---------------------------|
94 -- ----------------------------------------------------------------------------
95 Procedure chk_busgrp_legcode
96   (p_business_group_id in     number
97   ,p_legislation_code  in     varchar2
98   ) is
99   --
100   -- Cursor to validate the legislation_code.
101   --
102   cursor csr_valid_leg_code is
103   select null
104   from   fnd_territories ft
105   where  ft.territory_code = p_legislation_code;
106 --
107   l_proc  varchar2(72) := g_package||'chk_busgrp_legcode';
108   l_valid varchar2(1);
109 --
110 Begin
111   hr_utility.set_location('Entering:'||l_proc, 5);
112   --
113   -- Check that at least one of legislation_code and business_group_id
114   -- is null.
115   --
116   if p_business_group_id is not null and p_legislation_code is not null
117   then
118     hr_utility.set_location(' Leaving:'||l_proc, 10);
119     fnd_message.set_name('PAY', 'PAY_50069_ETM_LEG_BUS_NOT_NULL');
120     fnd_message.raise_error;
121   end if;
122   --
123   -- Validate business_group_id.
124   --
125   if p_business_group_id is not null then
126     hr_api.validate_bus_grp_id( p_business_group_id );
127   end if;
128   --
129   -- Validate legislation_code - if set and not International.
130   --
131   if (p_legislation_code is not null and
132       p_legislation_code <> 'ZZ') then
133     open csr_valid_leg_code;
134     fetch csr_valid_leg_code into l_valid;
135     if csr_valid_leg_code%notfound then
136       hr_utility.set_location(' Leaving:'||l_proc, 15);
137       close csr_valid_leg_code;
138       fnd_message.set_name('PAY', 'PAY_50070_INVALID_LEG_CODE');
139       fnd_message.raise_error;
140     end if;
141     close csr_valid_leg_code;
142   end if;
143   hr_utility.set_location(' Leaving:'||l_proc, 20);
144 End chk_busgrp_legcode;
145 -- ----------------------------------------------------------------------------
146 -- |--------------------------< chk_template_name >---------------------------|
147 -- ----------------------------------------------------------------------------
148 Procedure chk_template_name
149   (p_template_name     in     varchar2
150   ,p_template_type     in     varchar2
151   ,p_legislation_code  in     varchar2
152   ,p_business_group_id in     number
153   ) is
154   --
155   -- Cursor to check that the template name is unique within a legislation
156   -- for all templates of template_type 'T'.
157   --
158   cursor csr_template_name_exists
159     (p_template_name     in varchar2
160     ,p_legislation_code  in varchar2
161     ,p_business_group_id in number
165     where  pet.template_type = 'T'
162     ) is
163     select null
164     from   pay_element_templates pet
166     and    upper(pet.template_name) = upper(p_template_name)
167     and
168     (
169      (pet.legislation_code is null and pet.business_group_id is null) or
170      (p_legislation_code is null and p_business_group_id is null) or
171      (pet.legislation_code = p_legislation_code) or
172      (pet.business_group_id = p_business_group_id) or
173      (p_legislation_code = (select legislation_code from per_business_groups_perf
174                             where business_group_id = pet.business_group_id))
175     );
176 --
177   l_proc  varchar2(72) := g_package||'chk_template_name';
178   l_legislation_code varchar2(2000);
179   l_exists           varchar2(1);
180 --
181 Begin
182   hr_utility.set_location('Entering:'||l_proc, 5);
183   --
184   -- Check that the name is not null.
185   --
186   hr_api.mandatory_arg_error
187   (p_api_name       => l_proc
188   ,p_argument       => 'p_template_name'
189   ,p_argument_value => p_template_name
190   );
191   --
192   -- Uniqueness check only applies to templates whose template_type is
193   -- 'T'.
194   --
195   if p_template_type = 'T' then
196     --
197     -- Get the legislation_code for the new template.
198     --
199     if p_business_group_id is not null then
200       l_legislation_code :=
201       hr_api.return_legislation_code(p_business_group_id);
202     else
203       l_legislation_code := p_legislation_code;
204     end if;
205     --
206     -- Check for uniqueness using the cursor.
207     --
208     open csr_template_name_exists
209     (p_template_name     => p_template_name
210     ,p_legislation_code  => l_legislation_code
211     ,p_business_group_id => p_business_group_id
212     );
213     fetch csr_template_name_exists into l_exists;
214     if csr_template_name_exists%found then
215       close csr_template_name_exists;
216       hr_utility.set_location(' Leaving:'||l_proc, 10);
217       fnd_message.set_name('PAY', 'PAY_50071_ETM_NAME_EXISTS');
218       fnd_message.set_token('TEMPLATE_NAME', p_template_name);
219       fnd_message.raise_error;
220     end if;
221     close csr_template_name_exists;
222   end if;
223   hr_utility.set_location(' Leaving:'||l_proc, 15);
224 End chk_template_name;
225 --
226 -- ----------------------------------------------------------------------------
227 -- |--------------------< chk_base_processing_priority >----------------------|
228 -- ----------------------------------------------------------------------------
229 Procedure chk_base_processing_priority
230 (p_base_processing_priority in number
231 ,p_template_id              in number
232 ,p_template_type            in varchar2
233 ,p_object_version_number    in number
234 ) is
235   --
236   -- Cursor to check that the processing priority does cause overflow
237   -- with any relative processing priority values from
238   -- PAY_SHADOW_ELEMENT_TYPES.
239   --
240   cursor csr_priority_too_large is
241   select null
242   from   pay_shadow_element_types pset
243   where  pset.template_id = p_template_id
244   and    pset.relative_processing_priority + p_base_processing_priority >
245          pay_etm_shd.g_max_processing_priority;
246 --
247   l_proc  varchar2(72) := g_package||'chk_base_processing_priority';
248   l_api_updating boolean;
249   l_lower constant number := 0;
250   l_upper constant number := pay_etm_shd.g_max_processing_priority;
251   l_too_large varchar2(1);
252 --
253 Begin
254   hr_utility.set_location('Entering:'||l_proc, 5);
255   l_api_updating := pay_etm_shd.api_updating
256     (p_template_id           => p_template_id
257     ,p_object_version_number => p_object_version_number
258     );
259   --
260   if (l_api_updating and
261       nvl(pay_etm_shd.g_old_rec.base_processing_priority, hr_api.g_number) <>
262       nvl(p_base_processing_priority, hr_api.g_number)) or
263      not l_api_updating
264   then
265     --
266     -- Check that an update is not being done for a template type of 'U'.
267     --
268     if l_api_updating and p_template_type = 'U' then
269       hr_utility.set_location(' Leaving:'||l_proc, 10);
270       fnd_message.set_name('PAY', 'PAY_50072_ETM_PRIORITY_UPDATE');
271       fnd_message.raise_error;
272     end if;
273     --
274     -- Check that the priority is not null.
275     --
276     hr_api.mandatory_arg_error
277     (p_api_name       => l_proc
278     ,p_argument       => 'p_base_processing_priority'
279     ,p_argument_value => p_base_processing_priority
280     );
281     --
282     -- Check that the base processing priority is reasonable.
283     --
284     if p_base_processing_priority < l_lower or
285        p_base_processing_priority > l_upper then
286       hr_utility.set_location(' Leaving:'||l_proc, 15);
287       fnd_message.set_name('PAY', 'PAY_50073_ETM_PRIORITY_RANGE');
288       fnd_message.set_token('LOWER', l_lower);
289       fnd_message.set_token('UPPER', l_upper);
290       fnd_message.raise_error;
291     end if;
292     if l_api_updating then
293       open csr_priority_too_large;
294       fetch csr_priority_too_large into l_too_large;
295       if csr_priority_too_large%found then
296         hr_utility.set_location(' Leaving:'||l_proc, 20);
297         fnd_message.set_name('PAY', 'PAY_50074_ETM_PRI_SUM_RANGE');
298         fnd_message.set_token('LOWER', l_lower);
299         fnd_message.set_token('UPPER', l_upper);
300         fnd_message.raise_error;
301       end if;
302       close csr_priority_too_large;
306 End chk_base_processing_priority;
303     end if;
304   end if;
305   hr_utility.set_location(' Leaving:'||l_proc, 25);
307 -- ----------------------------------------------------------------------------
308 -- |-----------------------------< chk_version >------------------------------|
309 -- ----------------------------------------------------------------------------
310 Procedure chk_version_number
311 (p_version_number        in number
312 ,p_template_id           in number
313 ,p_template_type         in varchar2
314 ,p_object_version_number in number
315 ) is
316 --
317   l_proc  varchar2(72) := g_package||'chk_version_number';
318   l_api_updating boolean;
319 --
320 Begin
321   hr_utility.set_location('Entering:'||l_proc, 5);
322   l_api_updating := pay_etm_shd.api_updating
323     (p_template_id           => p_template_id
324     ,p_object_version_number => p_object_version_number
325     );
326   --
327   if (l_api_updating and
328       nvl(pay_etm_shd.g_old_rec.version_number, hr_api.g_number) <>
329       nvl(p_version_number, hr_api.g_number)) or
330      not l_api_updating
331   then
332     --
333     -- Check that the version number is not null.
334     --
335     hr_api.mandatory_arg_error
336     (p_api_name       => l_proc
337     ,p_argument       => 'p_version_number'
338     ,p_argument_value => p_version_number
339     );
340     --
341     -- Version number may not be updated for template type = 'U'.
342     --
343     if l_api_updating and p_template_type = 'U' then
344       hr_utility.set_location(' Leaving:'||l_proc, 10);
345       fnd_message.set_name('PAY', 'PAY_50084_ETM_VERSION_NO_UPD');
346       fnd_message.raise_error;
347     end if;
348     --
349     -- Updated version number must not be less than the previous
350     -- version number.
351     --
352     if l_api_updating and
353        p_version_number < pay_etm_shd.g_old_rec.version_number then
354       hr_utility.set_location(' Leaving:'||l_proc, 15);
355       fnd_message.set_name('PAY', 'PAY_50083_ETM_LOWER_VERSION_NO');
356       fnd_message.raise_error;
357     end if;
358   end if;
359   hr_utility.set_location(' Leaving:'||l_proc, 20);
360 End chk_version_number;
361 -- ----------------------------------------------------------------------------
362 -- |--------------------------< chk_template_type >---------------------------|
363 -- ----------------------------------------------------------------------------
364 Procedure chk_template_type
365 (p_effective_date    in date
366 ,p_legislation_code  in varchar2
367 ,p_business_group_id in number
368 ,p_template_type     in varchar2
369 ) is
370 --
371   l_proc  varchar2(72) := g_package||'chk_template_type';
372 --
373 Begin
374   hr_utility.set_location('Entering:'||l_proc, 5);
375   --
376   -- Check that the template type is not null.
377   --
378   hr_api.mandatory_arg_error
379   (p_api_name       => l_proc
380   ,p_argument       => 'p_template_type'
381   ,p_argument_value => p_template_type
382   );
383   --
384   -- Validate against hr_lookups.
385   --
386   if p_template_type not in ('U','T') or
387      hr_api.not_exists_in_hr_lookups
388      (p_effective_date => p_effective_date
389      ,p_lookup_type    => 'ELEMENT_TEMPLATE_TYPE'
390      ,p_lookup_code    => p_template_type
391      )
392   then
393     hr_utility.set_location(' Leaving:'||l_proc, 10);
394     fnd_message.set_name('PAY', 'PAY_50082_ETM_BAD_TEMP_TYPE');
395     fnd_message.set_token('TEMPLATE_TYPE', p_template_type);
396     fnd_message.raise_error;
397   end if;
398   --
399   -- The legislation_code must be null and the business_group_id
400   -- not null if the template_type is 'U'.
401   --
402   if p_template_type = 'U' and
403      (p_legislation_code is not null or p_business_group_id is null)
404   then
405     hr_utility.set_location(' Leaving:'||l_proc, 20);
406     fnd_message.set_name('PAY', 'PAY_50081_ETM_BAD_BUS_GROUP');
407     fnd_message.raise_error;
408   end if;
409   hr_utility.set_location(' Leaving:'||l_proc, 20);
410 End chk_template_type;
411 -- ----------------------------------------------------------------------------
412 -- |-----------------------< chk_max_base_name_length >-----------------------|
413 -- ----------------------------------------------------------------------------
414 Procedure chk_max_base_name_length
415 (p_max_base_name_length  in number
416 ,p_template_type         in varchar2
417 ,p_template_id           in number
418 ,p_object_version_number in number
419 ) is
420 --
421   l_proc  varchar2(72) := g_package||'chk_max_base_name_length';
422   l_api_updating boolean;
423   l_lower constant number := 1;
424   l_upper constant number := 50;
425 --
426 Begin
427   hr_utility.set_location('Entering:'||l_proc, 5);
428   l_api_updating := pay_etm_shd.api_updating
429     (p_template_id           => p_template_id
430     ,p_object_version_number => p_object_version_number
431     );
432   --
433   if (l_api_updating and
434       nvl(pay_etm_shd.g_old_rec.max_base_name_length, hr_api.g_number) <>
435       nvl(p_max_base_name_length, hr_api.g_number)) or
436      not l_api_updating
437   then
438     --
439     -- Check that the base name length is not null.
440     --
441     hr_api.mandatory_arg_error
442     (p_api_name       => l_proc
443     ,p_argument       => 'p_max_base_name_length'
444     ,p_argument_value => p_max_base_name_length
445     );
446     --
450     if l_api_updating and p_template_type = 'U' then
447     -- Maximum base name length may not be updated if the template type
448     -- is 'U'
449     --
451       hr_utility.set_location(' Leaving:'||l_proc, 10);
452       fnd_message.set_name('PAY', 'PAY_50080_ETM_UPD_BASE_NM_LEN');
453       fnd_message.raise_error;
454     end if;
455     --
456     -- Check that the length is within limits.
457     --
458     if p_max_base_name_length < l_lower or p_max_base_name_length > l_upper
459     then
460       hr_utility.set_location(' Leaving:'||l_proc, 15);
461       fnd_message.set_name('PAY', 'PAY_50079_ETM_BASE_NAME_LENGTH');
462       fnd_message.set_token('LOWER', l_lower);
463       fnd_message.set_token('UPPER', l_upper);
464       fnd_message.raise_error;
465     end if;
466   end if;
467   hr_utility.set_location(' Leaving:'||l_proc, 20);
468 End chk_max_base_name_length;
469 -- ----------------------------------------------------------------------------
470 -- |-----------------------------< chk_base_name >----------------------------|
471 -- ----------------------------------------------------------------------------
472 Procedure chk_base_name
473 (p_base_name            in varchar2
474 ,p_template_type        in varchar2
475 ,p_template_name        in varchar2
476 ,p_max_base_name_length in number
477 ,p_business_group_id    in number
478 ) is
479   --
480   -- Cursor to check that the base name is unique within the scope of
481   -- a business group.
482   --
483   cursor csr_base_name_exists is
484   select null
485   from   pay_element_templates pet
486   where  pet.template_type = 'U'
487   and    upper(pet.base_name) = upper(p_base_name)
488   and    pet.business_group_id = p_business_group_id;
489   --
490   -- Cursor to check that the base name is unique for a particular template
491   -- within the scope of a business group.
492   --
493   cursor csr_name_exists_for_template is
494   select null
495   from   pay_element_templates pet
496   where  pet.template_type = 'U'
497   and    upper(pet.base_name) = upper(p_base_name)
498   and    pet.template_name    = p_template_name
499   and    pet.business_group_id = p_business_group_id;
500 --
501   l_proc  varchar2(72) := g_package||'chk_base_name';
502   l_exists varchar2(1);
503   l_value  varchar2(2000);
504   l_output varchar2(2000);
505   l_rgeflg varchar2(2000);
506 --
507 Begin
508   hr_utility.set_location('Entering:'||l_proc, 5);
509   --
510   -- Check that the base name is null if template type is 'T'.
511   --
512   if p_template_type = 'T' and p_base_name is not null then
513     hr_utility.set_location(' Leaving:'||l_proc, 10);
514     fnd_message.set_name('PAY', 'PAY_50078_ETM_BASE_NM_NOT_NULL');
515     fnd_message.raise_error;
516   end if;
517   --
518   -- Return if template type is 'T'.
519   --
520   if p_template_type = 'T' then
521     hr_utility.set_location(' Leaving:'||l_proc, 15);
522     return;
523   end if;
524   --
525   -- Check that the base name is not null.
526   --
527   hr_api.mandatory_arg_error
528   (p_api_name       => l_proc
529   ,p_argument       => 'p_base_name'
530   ,p_argument_value => p_base_name
531   );
532   --
533   -- Check that the base name is not too long.
534   --
535   if lengthb(p_base_name) > p_max_base_name_length then
536     hr_utility.set_location(' Leaving:'||l_proc, 20);
537     fnd_message.set_name('PAY', 'PAY_50077_ETM_LONG_BASE_NAME');
538     fnd_message.set_token('BASE_NAME', p_base_name);
539     fnd_message.set_token('MAX_LENGTH', p_max_base_name_length);
540     fnd_message.raise_error;
541   end if;
542   --
543   -- Check that the base name format is correct (payroll name).
544   --
545   l_value := p_base_name;
546   hr_chkfmt.checkformat
547   (value   => l_value
548   ,format  => 'PAY_NAME'
549   ,output  => l_output
550   ,minimum => null
551   ,maximum => null
552   ,nullok  => 'N'
553   ,rgeflg  => l_rgeflg
554   ,curcode => null
555   );
556   --
557   -- Check that the base name is unique within its business groups.
558   --
559   if pay_etm_shd.g_allow_base_name_reuse then
560     --
561     -- If reuse allowed then avoid base name clash for any template,
562     -- based upon the same source template, in the business group.
563     --
564     open csr_name_exists_for_template;
565     fetch csr_name_exists_for_template into l_exists;
566     if csr_name_exists_for_template%found then
567       hr_utility.set_location(' Leaving:'||l_proc, 22);
568       close csr_name_exists_for_template;
569       fnd_message.set_name('PAY', 'PAY_50076_ETM_BASE_NAME_EXISTS');
570       fnd_message.set_token('BASE_NAME', p_base_name);
571       fnd_message.raise_error;
572     end if;
573     close csr_name_exists_for_template;
574   else
575     --
576     -- If reuse not allowed then avoid base name clash for any
577     -- template in the business group.
578     --
579     open csr_base_name_exists;
580     fetch csr_base_name_exists into l_exists;
581     if csr_base_name_exists%found then
582       hr_utility.set_location(' Leaving:'||l_proc, 25);
583       close csr_base_name_exists;
584       fnd_message.set_name('PAY', 'PAY_50076_ETM_BASE_NAME_EXISTS');
585       fnd_message.set_token('BASE_NAME', p_base_name);
586       fnd_message.raise_error;
587     end if;
588     close csr_base_name_exists;
589   end if;
590   hr_utility.set_location(' Leaving:'||l_proc, 30);
591 End chk_base_name;
595 Procedure chk_delete
592 -- ----------------------------------------------------------------------------
593 -- |------------------------------< chk_delete >------------------------------|
594 -- ----------------------------------------------------------------------------
596   (p_template_id in     number
597   ) is
598   --
599   -- Cursors to check for rows referencing the template.
600   --
601   cursor csr_element_types is
602   select null
603   from   pay_shadow_element_types pset
604   where  pset.template_id = p_template_id;
605   --
606   cursor csr_exclusion_rules is
607   select null
608   from   pay_template_exclusion_rules ter
609   where  ter.template_id = p_template_id;
610   --
611   cursor csr_balance_types is
612   select null
613   from   pay_shadow_balance_types sbt
614   where  sbt.template_id = p_template_id;
615   --
616   cursor csr_core_objects is
617   select null
618   from   pay_template_core_objects tco
619   where  tco.template_id = p_template_id;
620   --
621   l_proc  varchar2(72) := g_package||'chk_delete';
622   l_exists varchar2(1);
623   l_error  exception;
624 --
625 Begin
626   hr_utility.set_location('Entering:'||l_proc, 5);
627   --
628   open csr_element_types;
629   fetch csr_element_types into l_exists;
630   if csr_element_types%found then
631     hr_utility.set_location(' Leaving:'||l_proc, 10);
632     close csr_element_types;
633     raise l_error;
634   end if;
635   close csr_element_types;
636   --
637   open csr_balance_types;
638   fetch csr_balance_types into l_exists;
639   if csr_balance_types%found then
640     hr_utility.set_location(' Leaving:'||l_proc, 15);
641     close csr_balance_types;
642     raise l_error;
643   end if;
644   close csr_balance_types;
645   --
646   open csr_exclusion_rules;
647   fetch csr_exclusion_rules into l_exists;
648   if csr_exclusion_rules%found then
649     hr_utility.set_location(' Leaving:'||l_proc, 20);
650     close csr_exclusion_rules;
651     raise l_error;
652   end if;
653   close csr_exclusion_rules;
654   --
655   open csr_core_objects;
656   fetch csr_core_objects into l_exists;
657   if csr_core_objects%found then
658     hr_utility.set_location(' Leaving:'||l_proc, 25);
659     close csr_core_objects;
660     raise l_error;
661   end if;
662   close csr_core_objects;
663   hr_utility.set_location(' Leaving:'||l_proc, 30);
664 exception
665   when l_error then
666     fnd_message.set_name('PAY', 'PAY_50075_ETM_INVALID_DELETE');
667     fnd_message.raise_error;
668   when others then
669     hr_utility.set_location(' Leaving:'||l_proc, 35);
670     raise;
671 End chk_delete;
672 -- ----------------------------------------------------------------------------
673 -- |---------------------------< insert_validate >----------------------------|
674 -- ----------------------------------------------------------------------------
675 Procedure insert_validate
676   (p_effective_date  in     date
677   ,p_rec             in     pay_etm_shd.g_rec_type
678   ) is
679 --
680   l_proc  varchar2(72) := g_package||'insert_validate';
681 --
682 Begin
683   hr_utility.set_location('Entering:'||l_proc, 5);
684   --
685   -- Call all supporting business operations
686   --
687   chk_busgrp_legcode
688   (p_business_group_id => p_rec.business_group_id
689   ,p_legislation_code  => p_rec.legislation_code
690   );
691   --
692   chk_template_type
693   (p_legislation_code  => p_rec.legislation_code
694   ,p_business_group_id => p_rec.business_group_id
695   ,p_effective_date    => p_effective_date
696   ,p_template_type     => p_rec.template_type
697   );
698   --
699   chk_template_name
700   (p_template_name     => p_rec.template_name
701   ,p_template_type     => p_rec.template_type
702   ,p_business_group_id => p_rec.business_group_id
703   ,p_legislation_code  => p_rec.legislation_code
704   );
705   --
706   chk_max_base_name_length
707   (p_max_base_name_length     => p_rec.max_base_name_length
708   ,p_template_type            => p_rec.template_type
709   ,p_template_id              => p_rec.template_id
710   ,p_object_version_number    => p_rec.object_version_number
711   );
712   --
713   chk_base_name
714   (p_base_name            => p_rec.base_name
715   ,p_template_type        => p_rec.template_type
716   ,p_template_name        => p_rec.template_name
717   ,p_max_base_name_length => p_rec.max_base_name_length
718   ,p_business_group_id    => p_rec.business_group_id
719   );
720   --
721   chk_base_processing_priority
722   (p_base_processing_priority => p_rec.base_processing_priority
723   ,p_template_id              => p_rec.template_id
724   ,p_template_type            => p_rec.template_type
725   ,p_object_version_number    => p_rec.object_version_number
726   );
727   --
728   chk_version_number
729   (p_version_number           => p_rec.version_number
730   ,p_template_id              => p_rec.template_id
731   ,p_template_type            => p_rec.template_type
732   ,p_object_version_number    => p_rec.object_version_number
733   );
734   hr_utility.set_location(' Leaving:'||l_proc, 10);
735 End insert_validate;
736 --
737 -- ----------------------------------------------------------------------------
738 -- |---------------------------< update_validate >----------------------------|
739 -- ----------------------------------------------------------------------------
740 Procedure update_validate
741   (p_effective_date  in     date
742   ,p_rec             in     pay_etm_shd.g_rec_type
743   ) is
744 --
745   l_proc  varchar2(72) := g_package||'update_validate';
746 --
747 Begin
748   hr_utility.set_location('Entering:'||l_proc, 5);
749   --
750   -- Call all supporting business operations
751   --
752   chk_non_updateable_args(p_rec => p_rec);
753   --
754   chk_max_base_name_length
755   (p_max_base_name_length     => p_rec.max_base_name_length
756   ,p_template_type            => p_rec.template_type
757   ,p_template_id              => p_rec.template_id
758   ,p_object_version_number    => p_rec.object_version_number
759   );
760   --
761   chk_base_processing_priority
762   (p_base_processing_priority => p_rec.base_processing_priority
763   ,p_template_id              => p_rec.template_id
764   ,p_template_type            => p_rec.template_type
765   ,p_object_version_number    => p_rec.object_version_number
766   );
767   --
768   chk_version_number
769   (p_version_number           => p_rec.version_number
770   ,p_template_id              => p_rec.template_id
771   ,p_template_type            => p_rec.template_type
772   ,p_object_version_number    => p_rec.object_version_number
773   );
774   hr_utility.set_location(' Leaving:'||l_proc, 10);
775 End update_validate;
776 --
777 -- ----------------------------------------------------------------------------
778 -- |---------------------------< delete_validate >----------------------------|
779 -- ----------------------------------------------------------------------------
780 Procedure delete_validate(p_rec in pay_etm_shd.g_rec_type) is
781 --
782   l_proc  varchar2(72) := g_package||'delete_validate';
783 --
784 Begin
785   hr_utility.set_location('Entering:'||l_proc, 5);
786   --
787   -- Call all supporting business operations
788   --
789   chk_delete(p_rec.template_id);
790   hr_utility.set_location(' Leaving:'||l_proc, 10);
791 End delete_validate;
792 --
793 end pay_etm_bus;