[Home] [Help]
PACKAGE BODY: APPS.PAY_ELEMENT_TEMPLATE_API
Source
1 Package Body pay_element_template_api as
2 /* $Header: pyetmapi.pkb 120.0 2005/05/29 04:41:31 appldev noship $ */
3 --
4 -- Package Variables
5 --
6 g_debug boolean := hr_utility.debug_enabled;
7 g_package varchar2(33) := ' pay_element_template_api.';
8 -- ----------------------------------------------------------------------------
9 -- |------------------------< create_user_structure >-------------------------|
10 -- ----------------------------------------------------------------------------
11 procedure create_user_structure
12 (p_validate in boolean default false
13 ,p_effective_date in date
14 ,p_business_group_id in number
15 ,p_source_template_id in number
16 ,p_base_name in varchar2
17 ,p_base_processing_priority in number default null
18 ,p_preference_info_category in varchar2 default null
19 ,p_preference_information1 in varchar2 default null
20 ,p_preference_information2 in varchar2 default null
21 ,p_preference_information3 in varchar2 default null
22 ,p_preference_information4 in varchar2 default null
23 ,p_preference_information5 in varchar2 default null
24 ,p_preference_information6 in varchar2 default null
25 ,p_preference_information7 in varchar2 default null
26 ,p_preference_information8 in varchar2 default null
27 ,p_preference_information9 in varchar2 default null
28 ,p_preference_information10 in varchar2 default null
29 ,p_preference_information11 in varchar2 default null
30 ,p_preference_information12 in varchar2 default null
31 ,p_preference_information13 in varchar2 default null
32 ,p_preference_information14 in varchar2 default null
33 ,p_preference_information15 in varchar2 default null
34 ,p_preference_information16 in varchar2 default null
35 ,p_preference_information17 in varchar2 default null
36 ,p_preference_information18 in varchar2 default null
37 ,p_preference_information19 in varchar2 default null
38 ,p_preference_information20 in varchar2 default null
39 ,p_preference_information21 in varchar2 default null
40 ,p_preference_information22 in varchar2 default null
41 ,p_preference_information23 in varchar2 default null
42 ,p_preference_information24 in varchar2 default null
43 ,p_preference_information25 in varchar2 default null
44 ,p_preference_information26 in varchar2 default null
45 ,p_preference_information27 in varchar2 default null
46 ,p_preference_information28 in varchar2 default null
47 ,p_preference_information29 in varchar2 default null
48 ,p_preference_information30 in varchar2 default null
49 ,p_configuration_info_category in varchar2 default null
50 ,p_configuration_information1 in varchar2 default null
51 ,p_configuration_information2 in varchar2 default null
52 ,p_configuration_information3 in varchar2 default null
53 ,p_configuration_information4 in varchar2 default null
54 ,p_configuration_information5 in varchar2 default null
55 ,p_configuration_information6 in varchar2 default null
56 ,p_configuration_information7 in varchar2 default null
57 ,p_configuration_information8 in varchar2 default null
58 ,p_configuration_information9 in varchar2 default null
59 ,p_configuration_information10 in varchar2 default null
60 ,p_configuration_information11 in varchar2 default null
61 ,p_configuration_information12 in varchar2 default null
62 ,p_configuration_information13 in varchar2 default null
63 ,p_configuration_information14 in varchar2 default null
64 ,p_configuration_information15 in varchar2 default null
65 ,p_configuration_information16 in varchar2 default null
66 ,p_configuration_information17 in varchar2 default null
67 ,p_configuration_information18 in varchar2 default null
68 ,p_configuration_information19 in varchar2 default null
69 ,p_configuration_information20 in varchar2 default null
70 ,p_configuration_information21 in varchar2 default null
71 ,p_configuration_information22 in varchar2 default null
72 ,p_configuration_information23 in varchar2 default null
73 ,p_configuration_information24 in varchar2 default null
74 ,p_configuration_information25 in varchar2 default null
75 ,p_configuration_information26 in varchar2 default null
76 ,p_configuration_information27 in varchar2 default null
77 ,p_configuration_information28 in varchar2 default null
78 ,p_configuration_information29 in varchar2 default null
79 ,p_configuration_information30 in varchar2 default null
80 ,p_prefix_reporting_name in varchar2 default 'N'
81 ,p_allow_base_name_reuse in boolean default false
82 ,p_template_id out nocopy number
83 ,p_object_version_number out nocopy number
84 ) is
85 --
86 -- Declare cursors and local variables
87 --
88 l_proc varchar2(72) := g_package||'create_user_structure';
89 l_effective_date date;
90 l_template_id number;
91 l_ovn number;
92 l_template_type varchar2(2000);
93 -----------------------------
94 -- PL/SQL template tables. --
95 -----------------------------
96 l_element_template pay_etm_shd.g_rec_type;
97 l_core_objects pay_element_template_util.t_core_objects;
98 l_exclusion_rules pay_element_template_util.t_exclusion_rules;
99 l_formulas pay_element_template_util.t_formulas;
100 l_balance_types pay_element_template_util.t_balance_types;
101 l_defined_balances pay_element_template_util.t_defined_balances;
102 l_element_types pay_element_template_util.t_element_types;
103 l_sub_classi_rules pay_element_template_util.t_sub_classi_rules;
104 l_balance_classis pay_element_template_util.t_balance_classis;
105 l_input_values pay_element_template_util.t_input_values;
106 l_balance_feeds pay_element_template_util.t_balance_feeds;
107 l_formula_rules pay_element_template_util.t_formula_rules;
108 l_iterative_rules pay_element_template_util.t_iterative_rules;
109 l_ele_type_usages pay_element_template_util.t_ele_type_usages;
110 l_gu_bal_exclusions pay_element_template_util.t_gu_bal_exclusions;
111 l_template_ff_usages pay_element_template_util.t_template_ff_usages;
112 l_bal_attributes pay_element_template_util.t_bal_attributes;
113 begin
114 --
115 -- Set the ALLOW_BASE_NAME_REUSE flag.
116 --
117 pay_etm_shd.g_allow_base_name_reuse := p_allow_base_name_reuse;
118 --
119 g_debug := hr_utility.debug_enabled;
120 if g_debug then
121 hr_utility.set_location('Entering:'|| l_proc, 10);
122 end if;
123 --
124 -- Issue a savepoint
125 --
126 savepoint create_user_structure;
127 if g_debug then
128 hr_utility.set_location(l_proc, 20);
129 end if;
130 --
131 -- Check mandatory arguments.
132 --
133 hr_api.mandatory_arg_error
134 (p_api_name => l_proc,
135 p_argument => 'p_effective_date',
136 p_argument_value => p_effective_date);
137 --
138 hr_api.mandatory_arg_error
139 (p_api_name => l_proc,
140 p_argument => 'p_business_group_id',
141 p_argument_value => p_business_group_id);
142 --
143 hr_api.mandatory_arg_error
144 (p_api_name => l_proc,
145 p_argument => 'p_source_template_id',
146 p_argument_value => p_source_template_id);
147 --
148 hr_api.mandatory_arg_error
149 (p_api_name => l_proc,
150 p_argument => 'p_base_name',
151 p_argument_value => p_base_name);
152 --
153 -- Truncate the time portion from all IN date parameters
154 --
155 l_effective_date := trunc(p_effective_date);
156 --
157 -- Call Before Process User Hook
158 --
159 if g_debug then
160 hr_utility.set_location(l_proc, 30);
161 end if;
162 --
163 -- Validation in addition to Row Handlers
164 --
165 -- Process Logic
166 --
167 l_template_type :=
168 pay_element_template_util.get_template_type(p_source_template_id);
169 if l_template_type is null or l_template_type <> 'T' then
170 hr_utility.set_message(801, 'PAY_50057_BAD_SOURCE_TEMPLATE');
171 hr_utility.raise_error;
172 end if;
173 --
174 if g_debug then
175 hr_utility.set_location(l_proc, 50);
176 end if;
177 pay_element_template_util.create_plsql_template
178 (p_lock => false
179 ,p_template_id => p_source_template_id
180 ,p_element_template => l_element_template
181 ,p_core_objects => l_core_objects
182 ,p_exclusion_rules => l_exclusion_rules
183 ,p_formulas => l_formulas
184 ,p_balance_types => l_balance_types
185 ,p_defined_balances => l_defined_balances
186 ,p_element_types => l_element_types
187 ,p_sub_classi_rules => l_sub_classi_rules
188 ,p_balance_classis => l_balance_classis
189 ,p_input_values => l_input_values
190 ,p_balance_feeds => l_balance_feeds
191 ,p_formula_rules => l_formula_rules
192 ,p_iterative_rules => l_iterative_rules
193 ,p_ele_type_usages => l_ele_type_usages
194 ,p_gu_bal_exclusions => l_gu_bal_exclusions
195 ,p_template_ff_usages => l_template_ff_usages
196 ,p_bal_attributes => l_bal_attributes
197 );
198 --
199 if g_debug then
200 hr_utility.set_location(l_proc, 51);
201 end if;
202 pay_element_template_util.create_plsql_user_structure
203 (p_business_group_id => p_business_group_id
204 ,p_base_name => p_base_name
205 ,p_base_processing_priority => p_base_processing_priority
206 ,p_preference_info_category => p_preference_info_category
207 ,p_preference_information1 => p_preference_information1
208 ,p_preference_information2 => p_preference_information2
209 ,p_preference_information3 => p_preference_information3
210 ,p_preference_information4 => p_preference_information4
211 ,p_preference_information5 => p_preference_information5
212 ,p_preference_information6 => p_preference_information6
213 ,p_preference_information7 => p_preference_information7
214 ,p_preference_information8 => p_preference_information8
215 ,p_preference_information9 => p_preference_information9
216 ,p_preference_information10 => p_preference_information10
217 ,p_preference_information11 => p_preference_information11
218 ,p_preference_information12 => p_preference_information12
219 ,p_preference_information13 => p_preference_information13
220 ,p_preference_information14 => p_preference_information14
221 ,p_preference_information15 => p_preference_information15
222 ,p_preference_information16 => p_preference_information16
223 ,p_preference_information17 => p_preference_information17
224 ,p_preference_information18 => p_preference_information18
225 ,p_preference_information19 => p_preference_information19
226 ,p_preference_information20 => p_preference_information20
227 ,p_preference_information21 => p_preference_information21
228 ,p_preference_information22 => p_preference_information22
229 ,p_preference_information23 => p_preference_information23
230 ,p_preference_information24 => p_preference_information24
231 ,p_preference_information25 => p_preference_information25
232 ,p_preference_information26 => p_preference_information26
233 ,p_preference_information27 => p_preference_information27
234 ,p_preference_information28 => p_preference_information28
235 ,p_preference_information29 => p_preference_information29
236 ,p_preference_information30 => p_preference_information30
237 ,p_configuration_info_category => p_configuration_info_category
238 ,p_configuration_information1 => p_configuration_information1
239 ,p_configuration_information2 => p_configuration_information2
240 ,p_configuration_information3 => p_configuration_information3
241 ,p_configuration_information4 => p_configuration_information4
242 ,p_configuration_information5 => p_configuration_information5
243 ,p_configuration_information6 => p_configuration_information6
244 ,p_configuration_information7 => p_configuration_information7
245 ,p_configuration_information8 => p_configuration_information8
246 ,p_configuration_information9 => p_configuration_information9
247 ,p_configuration_information10 => p_configuration_information10
248 ,p_configuration_information11 => p_configuration_information11
249 ,p_configuration_information12 => p_configuration_information12
250 ,p_configuration_information13 => p_configuration_information13
251 ,p_configuration_information14 => p_configuration_information14
252 ,p_configuration_information15 => p_configuration_information15
253 ,p_configuration_information16 => p_configuration_information16
254 ,p_configuration_information17 => p_configuration_information17
255 ,p_configuration_information18 => p_configuration_information18
256 ,p_configuration_information19 => p_configuration_information19
257 ,p_configuration_information20 => p_configuration_information20
258 ,p_configuration_information21 => p_configuration_information21
259 ,p_configuration_information22 => p_configuration_information22
260 ,p_configuration_information23 => p_configuration_information23
261 ,p_configuration_information24 => p_configuration_information24
262 ,p_configuration_information25 => p_configuration_information25
263 ,p_configuration_information26 => p_configuration_information26
264 ,p_configuration_information27 => p_configuration_information27
265 ,p_configuration_information28 => p_configuration_information28
266 ,p_configuration_information29 => p_configuration_information29
267 ,p_configuration_information30 => p_configuration_information30
268 ,p_prefix_reporting_name => p_prefix_reporting_name
269 ,p_element_template => l_element_template
270 ,p_exclusion_rules => l_exclusion_rules
271 ,p_formulas => l_formulas
272 ,p_balance_types => l_balance_types
273 ,p_defined_balances => l_defined_balances
274 ,p_element_types => l_element_types
275 ,p_sub_classi_rules => l_sub_classi_rules
276 ,p_balance_classis => l_balance_classis
277 ,p_input_values => l_input_values
278 ,p_balance_feeds => l_balance_feeds
279 ,p_formula_rules => l_formula_rules
280 ,p_iterative_rules => l_iterative_rules
281 ,p_ele_type_usages => l_ele_type_usages
282 ,p_gu_bal_exclusions => l_gu_bal_exclusions
283 ,p_template_ff_usages => l_template_ff_usages
284 ,p_bal_attributes => l_bal_attributes
285 );
286 --
287 if g_debug then
288 hr_utility.set_location(l_proc, 52);
289 end if;
293 ,p_exclusion_rules => l_exclusion_rules
290 pay_element_template_util.plsql_to_db_template
291 (p_effective_date => p_effective_date
292 ,p_element_template => l_element_template
294 ,p_formulas => l_formulas
295 ,p_balance_types => l_balance_types
296 ,p_defined_balances => l_defined_balances
297 ,p_element_types => l_element_types
298 ,p_sub_classi_rules => l_sub_classi_rules
299 ,p_balance_classis => l_balance_classis
300 ,p_input_values => l_input_values
301 ,p_balance_feeds => l_balance_feeds
302 ,p_formula_rules => l_formula_rules
303 ,p_iterative_rules => l_iterative_rules
304 ,p_ele_type_usages => l_ele_type_usages
305 ,p_gu_bal_exclusions => l_gu_bal_exclusions
306 ,p_bal_attributes => l_bal_attributes
307 ,p_template_id => l_template_id
308 ,p_object_version_number => l_ovn
309 );
310 --
311 -- Call After Process User Hook
312 --
313 if g_debug then
314 hr_utility.set_location(l_proc, 60);
315 end if;
316 --
317 -- When in validation only mode raise the Validate_Enabled exception
318 --
319 if p_validate then
320 raise hr_api.validate_enabled;
321 end if;
322 --
323 -- Set all output arguments
324 --
325 p_template_id := l_template_id;
326 p_object_version_number := l_ovn;
327 --
328 if g_debug then
329 hr_utility.set_location(' Leaving:'||l_proc, 70);
330 end if;
331 exception
332 when hr_api.validate_enabled then
333 --
334 -- As the Validate_Enabled exception has been raised
335 -- we must rollback to the savepoint
336 --
337 rollback to create_user_structure;
338 --
339 -- Only set output warning arguments
340 -- (Any key or derived arguments must be set to null
341 -- when validation only mode is being used.)
342 --
343 p_template_id := null;
344 p_object_version_number := null;
345 if g_debug then
346 hr_utility.set_location(' Leaving:'||l_proc, 80);
347 end if;
348 when others then
349 --
350 -- A validation or unexpected error has occured
351 --
352 rollback to create_user_structure;
353 if g_debug then
354 hr_utility.set_location(' Leaving:'||l_proc, 90);
355 end if;
356 p_template_id := null;
357 p_object_version_number := null;
358 raise;
359 end create_user_structure;
360 -- ----------------------------------------------------------------------------
361 -- |---------------------------< generate_part1 >-----------------------------|
362 -- ----------------------------------------------------------------------------
363 procedure generate_part1
364 (p_validate in boolean default false
365 ,p_effective_date in date
366 ,p_hr_only in boolean default false
367 ,p_hr_to_payroll in boolean default false
368 ,p_template_id in number
369 ) is
370 l_proc varchar2(72) := g_package||'generate_part1';
371 l_effective_date date;
372 begin
373 g_debug := hr_utility.debug_enabled;
374 if g_debug then
375 hr_utility.set_location('Entering:'|| l_proc, 10);
376 end if;
377 --
378 -- Issue a savepoint
379 --
380 savepoint generate_part1;
381 if g_debug then
382 hr_utility.set_location(l_proc, 20);
383 end if;
384 --
385 -- Check mandatory arguments.
386 --
387 hr_api.mandatory_arg_error
388 (p_api_name => l_proc,
389 p_argument => 'p_effective_date',
390 p_argument_value => p_effective_date);
391 --
392 hr_api.mandatory_arg_error
393 (p_api_name => l_proc,
394 p_argument => 'p_template_id',
395 p_argument_value => p_template_id);
396 --
397 -- Truncate the time portion from all IN date parameters
398 --
399 l_effective_date := trunc(p_effective_date);
400 --
401 -- Call Before Process User Hook
402 --
403 if g_debug then
404 hr_utility.set_location(l_proc, 30);
405 end if;
406 --
407 -- Validation in addition to Row Handlers
408 --
409 -- Process Logic
410 --
411 if g_debug then
412 hr_utility.set_location(l_proc, 50);
413 end if;
414 pay_element_template_gen.generate_part1
415 (p_effective_date => l_effective_date
416 ,p_hr_only => p_hr_only
417 ,p_hr_to_payroll => p_hr_to_payroll
418 ,p_template_id => p_template_id
419 );
420 --
421 -- Call After Process User Hook
422 --
423 if g_debug then
424 hr_utility.set_location(l_proc, 60);
425 end if;
426 --
427 -- When in validation only mode raise the Validate_Enabled exception
428 --
429 if p_validate then
430 raise hr_api.validate_enabled;
431 end if;
432 --
433 -- Set all output arguments
437 end if;
434 --
435 if g_debug then
436 hr_utility.set_location(' Leaving:'||l_proc, 70);
438 exception
439 when hr_api.validate_enabled then
440 --
441 -- As the Validate_Enabled exception has been raised
442 -- we must rollback to the savepoint
443 --
444 rollback to generate_part1;
445 --
446 -- Only set output warning arguments
447 -- (Any key or derived arguments must be set to null
448 -- when validation only mode is being used.)
449 --
450 if g_debug then
451 hr_utility.set_location(' Leaving:'||l_proc, 80);
452 end if;
453 when others then
454 --
455 -- A validation or unexpected error has occured
456 --
457 rollback to generate_part1;
458 if g_debug then
459 hr_utility.set_location(' Leaving:'||l_proc, 90);
460 end if;
461 raise;
462 end generate_part1;
463 -- ----------------------------------------------------------------------------
464 -- |---------------------------< generate_part2 >-----------------------------|
465 -- ----------------------------------------------------------------------------
466 procedure generate_part2
467 (p_validate in boolean default false
468 ,p_effective_date in date
469 ,p_template_id in number
470 ) is
471 l_proc varchar2(72) := g_package||'generate_part2';
472 l_effective_date date;
473 begin
474 g_debug := hr_utility.debug_enabled;
475 if g_debug then
476 hr_utility.set_location('Entering:'|| l_proc, 10);
477 end if;
478 --
479 -- Issue a savepoint
480 --
481 savepoint generate_part2;
482 if g_debug then
483 hr_utility.set_location(l_proc, 20);
484 end if;
485 --
486 -- Check mandatory arguments.
487 --
488 hr_api.mandatory_arg_error
489 (p_api_name => l_proc,
490 p_argument => 'p_effective_date',
491 p_argument_value => p_effective_date);
492 --
493 hr_api.mandatory_arg_error
494 (p_api_name => l_proc,
495 p_argument => 'p_template_id',
496 p_argument_value => p_template_id);
497 --
498 -- Truncate the time portion from all IN date parameters
499 --
500 l_effective_date := trunc(p_effective_date);
501 --
502 -- Call Before Process User Hook
503 --
504 if g_debug then
505 hr_utility.set_location(l_proc, 30);
506 end if;
507 --
508 -- Validation in addition to Row Handlers
509 --
510 -- Process Logic
511 --
512 if g_debug then
513 hr_utility.set_location(l_proc, 50);
514 end if;
515 pay_element_template_gen.generate_part2
516 (p_effective_date => l_effective_date
517 ,p_template_id => p_template_id
518 );
519 --
520 -- Call After Process User Hook
521 --
522 if g_debug then
523 hr_utility.set_location(l_proc, 60);
524 end if;
525 --
526 -- When in validation only mode raise the Validate_Enabled exception
527 --
528 if p_validate then
529 raise hr_api.validate_enabled;
530 end if;
531 --
532 -- Set all output arguments
533 --
534 if g_debug then
535 hr_utility.set_location(' Leaving:'||l_proc, 70);
536 end if;
537 exception
538 when hr_api.validate_enabled then
539 --
540 -- As the Validate_Enabled exception has been raised
541 -- we must rollback to the savepoint
542 --
543 rollback to generate_part2;
544 --
545 -- Only set output warning arguments
546 -- (Any key or derived arguments must be set to null
547 -- when validation only mode is being used.)
548 --
549 if g_debug then
550 hr_utility.set_location(' Leaving:'||l_proc, 80);
551 end if;
552 when others then
553 --
554 -- A validation or unexpected error has occured
555 --
556 rollback to generate_part2;
557 if g_debug then
558 hr_utility.set_location(' Leaving:'||l_proc, 90);
559 end if;
560 raise;
561 end generate_part2;
562 -- ----------------------------------------------------------------------------
563 -- |---------------------------< delete_template >----------------------------|
564 -- ----------------------------------------------------------------------------
565 procedure delete_template
566 (p_validate in boolean default false
567 ,p_template_id in number
568 ) is
569 l_proc varchar2(72) := g_package||'delete_template';
570 l_effective_date date;
571 -----------------------------
572 -- PL/SQL template tables. --
573 -----------------------------
574 l_element_template pay_etm_shd.g_rec_type;
575 l_core_objects pay_element_template_util.t_core_objects;
576 l_exclusion_rules pay_element_template_util.t_exclusion_rules;
577 l_formulas pay_element_template_util.t_formulas;
578 l_balance_types pay_element_template_util.t_balance_types;
579 l_defined_balances pay_element_template_util.t_defined_balances;
580 l_element_types pay_element_template_util.t_element_types;
581 l_sub_classi_rules pay_element_template_util.t_sub_classi_rules;
585 l_formula_rules pay_element_template_util.t_formula_rules;
582 l_balance_classis pay_element_template_util.t_balance_classis;
583 l_input_values pay_element_template_util.t_input_values;
584 l_balance_feeds pay_element_template_util.t_balance_feeds;
586 l_iterative_rules pay_element_template_util.t_iterative_rules;
587 l_ele_type_usages pay_element_template_util.t_ele_type_usages;
588 l_gu_bal_exclusions pay_element_template_util.t_gu_bal_exclusions;
589 l_template_ff_usages pay_element_template_util.t_template_ff_usages;
590 l_bal_attributes pay_element_template_util.t_bal_attributes;
591 begin
592 g_debug := hr_utility.debug_enabled;
593 if g_debug then
594 hr_utility.set_location('Entering:'|| l_proc, 10);
595 end if;
596 --
597 -- Issue a savepoint
598 --
599 savepoint delete_template;
600 if g_debug then
601 hr_utility.set_location(l_proc, 20);
602 end if;
603 --
604 -- Check mandatory arguments.
605 --
606 hr_api.mandatory_arg_error
607 (p_api_name => l_proc,
608 p_argument => 'p_template_id',
609 p_argument_value => p_template_id);
610 --
611 -- Truncate the time portion from all IN date parameters
612 --
613 --
614 -- Call Before Process User Hook
615 --
616 if g_debug then
617 hr_utility.set_location(l_proc, 30);
618 end if;
619 --
620 -- Validation in addition to Row Handlers
621 --
622 -- Process Logic
623 --
624 if g_debug then
625 hr_utility.set_location(l_proc, 50);
626 end if;
627 pay_element_template_util.create_plsql_template
628 (p_lock => true
629 ,p_template_id => p_template_id
630 ,p_element_template => l_element_template
631 ,p_core_objects => l_core_objects
632 ,p_exclusion_rules => l_exclusion_rules
633 ,p_formulas => l_formulas
634 ,p_balance_types => l_balance_types
635 ,p_defined_balances => l_defined_balances
636 ,p_element_types => l_element_types
637 ,p_sub_classi_rules => l_sub_classi_rules
638 ,p_balance_classis => l_balance_classis
639 ,p_input_values => l_input_values
640 ,p_balance_feeds => l_balance_feeds
641 ,p_formula_rules => l_formula_rules
642 ,p_iterative_rules => l_iterative_rules
643 ,p_ele_type_usages => l_ele_type_usages
644 ,p_gu_bal_exclusions => l_gu_bal_exclusions
645 ,p_template_ff_usages => l_template_ff_usages
646 ,p_bal_attributes => l_bal_attributes
647 );
648 --
649 if g_debug then
650 hr_utility.set_location(l_proc, 55);
651 end if;
652 pay_element_template_util.delete_template
653 (p_template_id => p_template_id
654 ,p_formulas => l_formulas
655 ,p_delete_formulas => false
656 );
657 --
658 -- Call After Process User Hook
659 --
660 if g_debug then
661 hr_utility.set_location(l_proc, 60);
662 end if;
663 --
664 -- When in validation only mode raise the Validate_Enabled exception
665 --
666 if p_validate then
667 raise hr_api.validate_enabled;
668 end if;
669 --
670 -- Set all output arguments
671 --
672 if g_debug then
673 hr_utility.set_location(' Leaving:'||l_proc, 70);
674 end if;
675 exception
676 when hr_api.validate_enabled then
677 --
678 -- As the Validate_Enabled exception has been raised
679 -- we must rollback to the savepoint
680 --
681 rollback to delete_template;
682 --
683 -- Only set output warning arguments
684 -- (Any key or derived arguments must be set to null
685 -- when validation only mode is being used.)
686 --
687 if g_debug then
688 hr_utility.set_location(' Leaving:'||l_proc, 80);
689 end if;
690 when others then
691 --
692 -- A validation or unexpected error has occured
693 --
694 rollback to delete_template;
695 if g_debug then
696 hr_utility.set_location(' Leaving:'||l_proc, 90);
697 end if;
698 raise;
699 end delete_template;
700 -- ----------------------------------------------------------------------------
701 -- |-------------------------< delete_user_structure >----------------------|
702 -- ----------------------------------------------------------------------------
703 procedure delete_user_structure
704 (p_validate in boolean default false
705 ,p_drop_formula_packages in boolean
706 ,p_template_id in number
707 ) is
708 l_proc varchar2(72) := g_package||'delete_user_structure';
709 l_effective_date date;
710 l_drop_formula_packages boolean;
711 -----------------------------
712 -- PL/SQL template tables. --
713 -----------------------------
714 l_element_template pay_etm_shd.g_rec_type;
715 l_core_objects pay_element_template_util.t_core_objects;
716 l_exclusion_rules pay_element_template_util.t_exclusion_rules;
717 l_formulas pay_element_template_util.t_formulas;
718 l_balance_types pay_element_template_util.t_balance_types;
719 l_defined_balances pay_element_template_util.t_defined_balances;
720 l_element_types pay_element_template_util.t_element_types;
721 l_sub_classi_rules pay_element_template_util.t_sub_classi_rules;
722 l_balance_classis pay_element_template_util.t_balance_classis;
723 l_input_values pay_element_template_util.t_input_values;
724 l_balance_feeds pay_element_template_util.t_balance_feeds;
725 l_formula_rules pay_element_template_util.t_formula_rules;
726 l_iterative_rules pay_element_template_util.t_iterative_rules;
727 l_ele_type_usages pay_element_template_util.t_ele_type_usages;
728 l_gu_bal_exclusions pay_element_template_util.t_gu_bal_exclusions;
729 l_template_ff_usages pay_element_template_util.t_template_ff_usages;
730 l_bal_attributes pay_element_template_util.t_bal_attributes;
731 begin
732 g_debug := hr_utility.debug_enabled;
733 if g_debug then
734 hr_utility.set_location('Entering:'|| l_proc, 10);
735 end if;
736 --
737 -- Issue a savepoint
738 --
739 savepoint delete_template;
740 if g_debug then
741 hr_utility.set_location(l_proc, 20);
742 end if;
743 --
744 -- Check mandatory arguments.
745 --
746 hr_api.mandatory_arg_error
747 (p_api_name => l_proc,
748 p_argument => 'p_template_id',
749 p_argument_value => p_template_id);
750 --
751 -- Truncate the time portion from all IN date parameters
752 --
753 --
754 -- Call Before Process User Hook
755 --
756 hr_utility.set_location(l_proc, 30);
757 --
758 -- Validation in addition to Row Handlers
759 --
760 -- Process Logic
761 --
762 if g_debug then
763 hr_utility.set_location(l_proc, 50);
764 end if;
765 pay_element_template_util.create_plsql_template
766 (p_lock => true
767 ,p_template_id => p_template_id
768 ,p_element_template => l_element_template
769 ,p_core_objects => l_core_objects
770 ,p_exclusion_rules => l_exclusion_rules
771 ,p_formulas => l_formulas
772 ,p_balance_types => l_balance_types
773 ,p_defined_balances => l_defined_balances
774 ,p_element_types => l_element_types
775 ,p_sub_classi_rules => l_sub_classi_rules
776 ,p_balance_classis => l_balance_classis
777 ,p_input_values => l_input_values
778 ,p_balance_feeds => l_balance_feeds
779 ,p_formula_rules => l_formula_rules
780 ,p_iterative_rules => l_iterative_rules
781 ,p_ele_type_usages => l_ele_type_usages
782 ,p_gu_bal_exclusions => l_gu_bal_exclusions
783 ,p_template_ff_usages => l_template_ff_usages
784 ,p_bal_attributes => l_bal_attributes
785 );
786 --
787 -- Zap the generated objects. Don't drop formula packages if
788 -- p_validate is true.
789 --
790 if g_debug then
791 hr_utility.set_location(l_proc, 51);
792 end if;
793 l_drop_formula_packages := not p_validate and p_drop_formula_packages;
794 pay_element_template_gen.zap_core_objects
795 (p_all_core_objects => l_core_objects
796 ,p_drop_formula_packages => l_drop_formula_packages
797 );
798 --
799 -- Delete the template.
800 --
801 if g_debug then
802 hr_utility.set_location(l_proc, 52);
803 end if;
804 pay_element_template_util.delete_template
805 (p_template_id => p_template_id
806 ,p_formulas => l_formulas
807 ,p_delete_formulas => true
808 );
809 --
810 -- Call After Process User Hook
811 --
812 if g_debug then
813 hr_utility.set_location(l_proc, 60);
814 end if;
815 --
816 -- When in validation only mode raise the Validate_Enabled exception
817 --
818 if p_validate then
819 raise hr_api.validate_enabled;
820 end if;
821 --
822 -- Set all output arguments
823 --
824 if g_debug then
825 hr_utility.set_location(' Leaving:'||l_proc, 70);
826 end if;
827 exception
828 when hr_api.validate_enabled then
829 --
830 -- As the Validate_Enabled exception has been raised
831 -- we must rollback to the savepoint
832 --
833 rollback to delete_template;
834 --
835 -- Only set output warning arguments
836 -- (Any key or derived arguments must be set to null
837 -- when validation only mode is being used.)
838 --
839 if g_debug then
840 hr_utility.set_location(' Leaving:'||l_proc, 80);
841 end if;
842 when others then
843 --
844 -- A validation or unexpected error has occured
845 --
846 rollback to delete_template;
847 if g_debug then
848 hr_utility.set_location(' Leaving:'||l_proc, 90);
849 end if;
850 raise;
851 end delete_user_structure;
852 --
853 end pay_element_template_api;