[Home] [Help]
PACKAGE BODY: APPS.PAY_ETP_DEL
Source
1 Package Body pay_etp_del as
2 /* $Header: pyetprhi.pkb 120.6.12010000.5 2008/10/16 09:39:45 asnell ship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- | Private Global Definitions |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package varchar2(33) := ' pay_etp_del.'; -- Global package name
9 --
10 -- ----------------------------------------------------------------------------
11 -- |----------------------------< dt_delete_dml >-----------------------------|
12 -- ----------------------------------------------------------------------------
13 -- {Start Of Comments}
14 --
15 -- Description:
16 -- This procedure controls the actual dml delete logic for the datetrack
17 -- delete modes: ZAP, DELETE, FUTURE_CHANGE and DELETE_NEXT_CHANGE. The
18 -- execution is as follows:
19 -- 1) To set and unset the g_api_dml status as required (as we are about to
20 -- perform dml).
21 -- 2) If the delete mode is DELETE_NEXT_CHANGE then delete where the
22 -- effective start date is equal to the validation start date.
23 -- 3) If the delete mode is not DELETE_NEXT_CHANGE then delete
24 -- all rows for the entity where the effective start date is greater
25 -- than or equal to the validation start date.
26 -- 4) To raise any errors.
27 --
28 -- Prerequisites:
29 -- This is an internal private procedure which must be called from the
30 -- delete_dml procedure.
31 --
32 -- In Parameters:
33 -- A Pl/Sql record structure.
34 --
35 -- Post Success:
36 -- The specified row will be delete from the schema.
37 --
38 -- Post Failure:
39 -- On the delete dml failure it is important to note that we always reset the
40 -- g_api_dml status to false.
41 -- If any other error is reported, the error will be raised after the
42 -- g_api_dml status is reset.
43 --
44 -- Developer Implementation Notes:
45 -- This is an internal private procedure which must be called from the
46 -- delete_dml procedure.
47 --
48 -- Access Status:
49 -- Internal Row Handler Use Only.
50 --
51 -- {End Of Comments}
52 -- ----------------------------------------------------------------------------
53 Procedure dt_delete_dml
54 (p_rec in out nocopy pay_etp_shd.g_rec_type
55 ,p_effective_date in date
56 ,p_datetrack_mode in varchar2
57 ,p_validation_start_date in date
58 ,p_validation_end_date in date
59 ) is
60 --
61 l_proc varchar2(72) := g_package||'dt_delete_dml';
62 --
63 Begin
64 hr_utility.set_location('Entering:'||l_proc, 5);
65 If (p_datetrack_mode = hr_api.g_delete_next_change) then
66 pay_etp_shd.g_api_dml := true; -- Set the api dml status
67 --
68 -- Delete the where the effective start date is equal
69 -- to the validation end date.
70 --
71 delete from pay_element_types_f
72 where element_type_id = p_rec.element_type_id
73 and effective_start_date = p_validation_start_date;
74 --
75 pay_etp_shd.g_api_dml := false; -- Unset the api dml status
76 Else
77 pay_etp_shd.g_api_dml := true; -- Set the api dml status
78 --
79 -- Delete the row(s) where the effective start date is greater than
80 -- or equal to the validation start date.
81 --
82 delete from pay_element_types_f
83 where element_type_id = p_rec.element_type_id
84 and effective_start_date >= p_validation_start_date;
85 --
86 pay_etp_shd.g_api_dml := false; -- Unset the api dml status
87 End If;
88 --
89 hr_utility.set_location(' Leaving:'||l_proc, 20);
90 --
91 Exception
92 When Others Then
93 pay_etp_shd.g_api_dml := false; -- Unset the api dml status
94 Raise;
95 --
96 End dt_delete_dml;
97 --
98 -- ----------------------------------------------------------------------------
99 -- ----------------------< delete_app_ownerships >----------------------------|
100 -- ----------------------------------------------------------------------------
101 --
102 -- Description:
103 -- Deletes row(s) from hr_application_ownerships depending on the mode that
104 -- the row handler has been called in.
105 --
106 -- ----------------------------------------------------------------------------
107 PROCEDURE delete_app_ownerships(p_pk_column IN varchar2
108 ,p_pk_value IN varchar2
109 ,p_datetrack_mode IN varchar2) IS
110 --
111 BEGIN
112 --
113 IF ((hr_startup_data_api_support.return_startup_mode
114 IN ('STARTUP','GENERIC')) AND
115 p_datetrack_mode = hr_api.g_zap) THEN
116 --
117 DELETE FROM hr_application_ownerships
118 WHERE key_name = p_pk_column
119 AND key_value = p_pk_value;
120 --
121 END IF;
122 END delete_app_ownerships;
123 --
124 -- ----------------------------------------------------------------------------
125 -- ----------------------< delete_app_ownerships >----------------------------|
126 -- ----------------------------------------------------------------------------
127 PROCEDURE delete_app_ownerships(p_pk_column IN varchar2
128 ,p_pk_value IN number
129 ,p_datetrack_mode IN varchar2) IS
130 --
131 BEGIN
132 delete_app_ownerships(p_pk_column, to_char(p_pk_value), p_datetrack_mode);
133 END delete_app_ownerships;
134 --
135 -- ----------------------------------------------------------------------------
136 -- |------------------------------< delete_dml >------------------------------|
137 -- ----------------------------------------------------------------------------
138 Procedure delete_dml
139 (p_rec in out nocopy pay_etp_shd.g_rec_type
140 ,p_effective_date in date
141 ,p_datetrack_mode in varchar2
142 ,p_validation_start_date in date
143 ,p_validation_end_date in date
144 ) is
145 --
146 l_proc varchar2(72) := g_package||'delete_dml';
147 --
148 Begin
149 hr_utility.set_location('Entering:'||l_proc, 5);
150 --
151 pay_etp_del.dt_delete_dml
152 (p_rec => p_rec
153 ,p_effective_date => p_effective_date
154 ,p_datetrack_mode => p_datetrack_mode
155 ,p_validation_start_date => p_validation_start_date
156 ,p_validation_end_date => p_validation_end_date
157 );
158 --
159 hr_utility.set_location(' Leaving:'||l_proc, 10);
160 End delete_dml;
161 --
162 -- ----------------------------------------------------------------------------
163 -- |----------------------------< dt_pre_delete >-----------------------------|
164 -- ----------------------------------------------------------------------------
165 -- {Start Of Comments}
166 --
167 -- Description:
168 -- The dt_pre_delete process controls the execution of dml
169 -- for the datetrack modes: DELETE, FUTURE_CHANGE
170 -- and DELETE_NEXT_CHANGE only.
171 --
172 -- Prerequisites:
173 -- This is an internal procedure which is called from the pre_delete
174 -- procedure.
175 --
176 -- In Parameters:
177 -- A Pl/Sql record structure.
178 --
179 -- Post Success:
180 -- Processing continues.
181 --
182 -- Post Failure:
183 -- If an error has occurred, an error message and exception will be raised
184 -- but not handled.
185 --
186 -- Developer Implementation Notes:
187 -- This is an internal procedure which is required by Datetrack. Don't
188 -- remove or modify.
189 --
190 -- Access Status:
191 -- Internal Row Handler Use Only.
192 --
193 -- {End Of Comments}
194 -- ----------------------------------------------------------------------------
195 Procedure dt_pre_delete
196 (p_rec in out nocopy pay_etp_shd.g_rec_type
197 ,p_effective_date in date
198 ,p_datetrack_mode in varchar2
199 ,p_validation_start_date in date
200 ,p_validation_end_date in date
201 ) is
202 --
203 l_proc varchar2(72) := g_package||'dt_pre_delete';
204 --
205 Begin
206 hr_utility.set_location('Entering:'||l_proc, 5);
207 --
208 If (p_datetrack_mode <> hr_api.g_zap) then
209 --
210 p_rec.effective_start_date
211 := pay_etp_shd.g_old_rec.effective_start_date;
212 --
213 If (p_datetrack_mode = hr_api.g_delete) then
214 p_rec.effective_end_date := p_validation_start_date - 1;
215 Else
216 p_rec.effective_end_date := p_validation_end_date;
217 End If;
218 --
219 -- Update the current effective end date record
220 --
221 pay_etp_shd.upd_effective_end_date
222 (p_effective_date => p_effective_date
223 ,p_base_key_value => p_rec.element_type_id
224 ,p_new_effective_end_date => p_rec.effective_end_date
225 ,p_validation_start_date => p_validation_start_date
226 ,p_validation_end_date => p_validation_end_date
227 ,p_object_version_number => p_rec.object_version_number
228 );
229 Else
230 p_rec.effective_start_date := null;
231 p_rec.effective_end_date := null;
232 End If;
233 hr_utility.set_location(' Leaving:'||l_proc, 10);
234 End dt_pre_delete;
235 --
236 -- ----------------------------------------------------------------------------
237 -- |------------------------------< pre_delete >------------------------------|
238 -- ----------------------------------------------------------------------------
239 -- {Start Of Comments}
240 --
241 -- Description:
242 -- This private procedure contains any processing which is required before
243 -- the delete dml.
244 --
245 -- Prerequisites:
246 -- This is an internal procedure which is called from the del procedure.
247 --
248 -- In Parameters:
249 -- A Pl/Sql record structure.
250 --
251 -- Post Success:
252 -- Processing continues.
253 --
254 -- Post Failure:
255 -- If an error has occurred, an error message and exception will be raised
256 -- but not handled.
257 --
258 -- Developer Implementation Notes:
259 -- Any pre-processing required before the delete dml is issued should be
260 -- coded within this procedure. It is important to note that any 3rd party
261 -- maintenance should be reviewed before placing in this procedure. The call
262 -- to the dt_delete_dml procedure should NOT be removed.
263 --
264 -- Access Status:
265 -- Internal Row Handler Use Only.
266 --
267 -- {End Of Comments}
268 -- ----------------------------------------------------------------------------
269 Procedure pre_delete
270 (p_rec in out nocopy pay_etp_shd.g_rec_type
271 ,p_effective_date in date
272 ,p_datetrack_mode in varchar2
273 ,p_validation_start_date in date
274 ,p_validation_end_date in date
275 ) is
276 --
277 l_proc varchar2(72) := g_package||'pre_delete';
278 --
279 -- Cursor C_Sel1 select comments to be deleted
280 --
281 Cursor C_Sel1 is
282 select t1.comment_id
283 from pay_element_types_f t1
284 where t1.comment_id is not null
285 and t1.element_type_id = p_rec.element_type_id
286 and t1.effective_start_date <= p_validation_end_date
287 and t1.effective_end_date >= p_validation_start_date
288 and not exists
289 (select 1
290 from pay_element_types_f t2
291 where t2.comment_id = t1.comment_id
292 and t2.element_type_id = t1.element_type_id
293 and (t2.effective_start_date > p_validation_end_date
294 or t2.effective_end_date < p_validation_start_date));
295 --
296 --
297 Begin
298 hr_utility.set_location('Entering:'||l_proc, 5);
299 --
300 --
301 -- Delete any possible comments
302 --
303 For Comm_Del In C_Sel1 Loop
304 hr_comm_api.del(p_comment_id => Comm_Del.comment_id);
305 End Loop;
306 --
307 --
308 pay_etp_del.dt_pre_delete
309 (p_rec => p_rec
310 ,p_effective_date => p_effective_date
311 ,p_datetrack_mode => p_datetrack_mode
312 ,p_validation_start_date => p_validation_start_date
313 ,p_validation_end_date => p_validation_end_date
314 );
315 --
316 hr_utility.set_location(' Leaving:'||l_proc, 10);
317 End pre_delete;
318 --
319 -- ----------------------------------------------------------------------------
320 -- |----------------------------< post_delete >-------------------------------|
321 -- ----------------------------------------------------------------------------
322 -- {Start Of Comments}
323 --
324 -- Description:
325 -- This private procedure contains any processing which is required after
326 -- the delete dml.
327 --
328 -- Prerequisites:
329 -- This is an internal procedure which is called from the del procedure.
330 --
331 -- In Parameters:
332 -- A Pl/Sql record structure.
333 --
334 -- Post Success:
335 -- Processing continues.
336 --
337 -- Post Failure:
338 -- If an error has occurred, an error message and exception will be raised
339 -- but not handled.
340 --
341 -- Developer Implementation Notes:
342 -- Any post-processing required after the delete dml is issued should be
343 -- coded within this procedure. It is important to note that any 3rd party
344 -- maintenance should be reviewed before placing in this procedure.
345 --
346 -- Access Status:
347 -- Internal Row Handler Use Only.
348 --
349 -- {End Of Comments}
350 -- ----------------------------------------------------------------------------
351 Procedure post_delete
352 (p_rec in pay_etp_shd.g_rec_type
353 ,p_effective_date in date
354 ,p_datetrack_mode in varchar2
355 ,p_validation_start_date in date
356 ,p_validation_end_date in date
357 ) is
358 --
359 l_proc varchar2(72) := g_package||'post_delete';
360 --
361 Begin
362 hr_utility.set_location('Entering:'||l_proc, 5);
363 begin
364 --
365 -- Delete ownerships if applicable
366 delete_app_ownerships
367 ('ELEMENT_TYPE_ID', p_rec.element_type_id, p_datetrack_mode
368 );
369 --
370 pay_etp_rkd.after_delete
371 (p_effective_date
372 => p_effective_date
373 ,p_datetrack_mode
374 => p_datetrack_mode
375 ,p_validation_start_date
376 => p_validation_start_date
377 ,p_validation_end_date
378 => p_validation_end_date
379 ,p_element_type_id
380 => p_rec.element_type_id
381 ,p_effective_start_date
382 => p_rec.effective_start_date
383 ,p_effective_end_date
384 => p_rec.effective_end_date
385 ,p_effective_start_date_o
386 => pay_etp_shd.g_old_rec.effective_start_date
387 ,p_effective_end_date_o
388 => pay_etp_shd.g_old_rec.effective_end_date
389 ,p_business_group_id_o
390 => pay_etp_shd.g_old_rec.business_group_id
391 ,p_legislation_code_o
392 => pay_etp_shd.g_old_rec.legislation_code
393 ,p_formula_id_o
394 => pay_etp_shd.g_old_rec.formula_id
398 => pay_etp_shd.g_old_rec.output_currency_code
395 ,p_input_currency_code_o
396 => pay_etp_shd.g_old_rec.input_currency_code
397 ,p_output_currency_code_o
399 ,p_classification_id_o
400 => pay_etp_shd.g_old_rec.classification_id
401 ,p_benefit_classification_id_o
402 => pay_etp_shd.g_old_rec.benefit_classification_id
403 ,p_additional_entry_allowed_f_o
404 => pay_etp_shd.g_old_rec.additional_entry_allowed_flag
405 ,p_adjustment_only_flag_o
406 => pay_etp_shd.g_old_rec.adjustment_only_flag
407 ,p_closed_for_entry_flag_o
408 => pay_etp_shd.g_old_rec.closed_for_entry_flag
409 ,p_element_name_o
410 => pay_etp_shd.g_old_rec.element_name
411 ,p_indirect_only_flag_o
412 => pay_etp_shd.g_old_rec.indirect_only_flag
413 ,p_multiple_entries_allowed_f_o
414 => pay_etp_shd.g_old_rec.multiple_entries_allowed_flag
415 ,p_multiply_value_flag_o
416 => pay_etp_shd.g_old_rec.multiply_value_flag
417 ,p_post_termination_rule_o
418 => pay_etp_shd.g_old_rec.post_termination_rule
419 ,p_process_in_run_flag_o
420 => pay_etp_shd.g_old_rec.process_in_run_flag
421 ,p_processing_priority_o
422 => pay_etp_shd.g_old_rec.processing_priority
423 ,p_processing_type_o
424 => pay_etp_shd.g_old_rec.processing_type
425 ,p_standard_link_flag_o
426 => pay_etp_shd.g_old_rec.standard_link_flag
427 ,p_comment_id_o
428 => pay_etp_shd.g_old_rec.comment_id
429 ,p_comments_o
430 => pay_etp_shd.g_old_rec.comments
431 ,p_description_o
432 => pay_etp_shd.g_old_rec.description
433 ,p_legislation_subgroup_o
434 => pay_etp_shd.g_old_rec.legislation_subgroup
435 ,p_qualifying_age_o
436 => pay_etp_shd.g_old_rec.qualifying_age
437 ,p_qualifying_length_of_servi_o
438 => pay_etp_shd.g_old_rec.qualifying_length_of_service
439 ,p_qualifying_units_o
440 => pay_etp_shd.g_old_rec.qualifying_units
441 ,p_reporting_name_o
442 => pay_etp_shd.g_old_rec.reporting_name
443 ,p_attribute_category_o
444 => pay_etp_shd.g_old_rec.attribute_category
445 ,p_attribute1_o
446 => pay_etp_shd.g_old_rec.attribute1
447 ,p_attribute2_o
448 => pay_etp_shd.g_old_rec.attribute2
449 ,p_attribute3_o
450 => pay_etp_shd.g_old_rec.attribute3
451 ,p_attribute4_o
452 => pay_etp_shd.g_old_rec.attribute4
453 ,p_attribute5_o
454 => pay_etp_shd.g_old_rec.attribute5
455 ,p_attribute6_o
456 => pay_etp_shd.g_old_rec.attribute6
457 ,p_attribute7_o
458 => pay_etp_shd.g_old_rec.attribute7
459 ,p_attribute8_o
460 => pay_etp_shd.g_old_rec.attribute8
461 ,p_attribute9_o
462 => pay_etp_shd.g_old_rec.attribute9
463 ,p_attribute10_o
464 => pay_etp_shd.g_old_rec.attribute10
465 ,p_attribute11_o
466 => pay_etp_shd.g_old_rec.attribute11
467 ,p_attribute12_o
468 => pay_etp_shd.g_old_rec.attribute12
469 ,p_attribute13_o
470 => pay_etp_shd.g_old_rec.attribute13
471 ,p_attribute14_o
472 => pay_etp_shd.g_old_rec.attribute14
473 ,p_attribute15_o
474 => pay_etp_shd.g_old_rec.attribute15
475 ,p_attribute16_o
476 => pay_etp_shd.g_old_rec.attribute16
477 ,p_attribute17_o
478 => pay_etp_shd.g_old_rec.attribute17
479 ,p_attribute18_o
480 => pay_etp_shd.g_old_rec.attribute18
481 ,p_attribute19_o
482 => pay_etp_shd.g_old_rec.attribute19
483 ,p_attribute20_o
484 => pay_etp_shd.g_old_rec.attribute20
485 ,p_element_information_catego_o
486 => pay_etp_shd.g_old_rec.element_information_category
487 ,p_element_information1_o
488 => pay_etp_shd.g_old_rec.element_information1
489 ,p_element_information2_o
490 => pay_etp_shd.g_old_rec.element_information2
491 ,p_element_information3_o
492 => pay_etp_shd.g_old_rec.element_information3
493 ,p_element_information4_o
494 => pay_etp_shd.g_old_rec.element_information4
495 ,p_element_information5_o
499 ,p_element_information7_o
496 => pay_etp_shd.g_old_rec.element_information5
497 ,p_element_information6_o
498 => pay_etp_shd.g_old_rec.element_information6
500 => pay_etp_shd.g_old_rec.element_information7
501 ,p_element_information8_o
502 => pay_etp_shd.g_old_rec.element_information8
503 ,p_element_information9_o
504 => pay_etp_shd.g_old_rec.element_information9
505 ,p_element_information10_o
506 => pay_etp_shd.g_old_rec.element_information10
507 ,p_element_information11_o
508 => pay_etp_shd.g_old_rec.element_information11
509 ,p_element_information12_o
510 => pay_etp_shd.g_old_rec.element_information12
511 ,p_element_information13_o
512 => pay_etp_shd.g_old_rec.element_information13
513 ,p_element_information14_o
514 => pay_etp_shd.g_old_rec.element_information14
515 ,p_element_information15_o
516 => pay_etp_shd.g_old_rec.element_information15
517 ,p_element_information16_o
518 => pay_etp_shd.g_old_rec.element_information16
519 ,p_element_information17_o
520 => pay_etp_shd.g_old_rec.element_information17
521 ,p_element_information18_o
522 => pay_etp_shd.g_old_rec.element_information18
523 ,p_element_information19_o
524 => pay_etp_shd.g_old_rec.element_information19
525 ,p_element_information20_o
526 => pay_etp_shd.g_old_rec.element_information20
527 ,p_third_party_pay_only_flag_o
528 => pay_etp_shd.g_old_rec.third_party_pay_only_flag
529 ,p_object_version_number_o
530 => pay_etp_shd.g_old_rec.object_version_number
531 ,p_iterative_flag_o
532 => pay_etp_shd.g_old_rec.iterative_flag
533 ,p_iterative_formula_id_o
534 => pay_etp_shd.g_old_rec.iterative_formula_id
535 ,p_iterative_priority_o
536 => pay_etp_shd.g_old_rec.iterative_priority
537 ,p_creator_type_o
538 => pay_etp_shd.g_old_rec.creator_type
539 ,p_retro_summ_ele_id_o
540 => pay_etp_shd.g_old_rec.retro_summ_ele_id
541 ,p_grossup_flag_o
542 => pay_etp_shd.g_old_rec.grossup_flag
543 ,p_process_mode_o
544 => pay_etp_shd.g_old_rec.process_mode
545 ,p_advance_indicator_o
546 => pay_etp_shd.g_old_rec.advance_indicator
547 ,p_advance_payable_o
548 => pay_etp_shd.g_old_rec.advance_payable
549 ,p_advance_deduction_o
550 => pay_etp_shd.g_old_rec.advance_deduction
551 ,p_process_advance_entry_o
552 => pay_etp_shd.g_old_rec.process_advance_entry
553 ,p_proration_group_id_o
554 => pay_etp_shd.g_old_rec.proration_group_id
555 ,p_proration_formula_id_o
556 => pay_etp_shd.g_old_rec.proration_formula_id
557 ,p_recalc_event_group_id_o
558 => pay_etp_shd.g_old_rec.recalc_event_group_id
559 ,p_once_each_period_flag_o
560 => pay_etp_shd.g_old_rec.once_each_period_flag
561 ,p_time_definition_type_o
562 => pay_etp_shd.g_old_rec.time_definition_type
563 ,p_time_definition_id_o
564 => pay_etp_shd.g_old_rec.time_definition_id
565 ,p_advance_element_type_id_o
566 => pay_etp_shd.g_old_rec.advance_element_type_id
567 ,p_deduction_element_type_id_o
568 => pay_etp_shd.g_old_rec.deduction_element_type_id
569 );
570 --
571 exception
572 --
573 when hr_api.cannot_find_prog_unit then
574 --
575 hr_api.cannot_find_prog_unit_error
576 (p_module_name => 'PAY_ELEMENT_TYPES_F'
577 ,p_hook_type => 'AD');
578 --
579 end;
580 --
581 hr_utility.set_location(' Leaving:'||l_proc, 10);
582 End post_delete;
583 --
584 -- ----------------------------------------------------------------------------
585 -- |---------------------------------< del >----------------------------------|
586 -- ----------------------------------------------------------------------------
587 Procedure del
588 (p_effective_date in date
589 ,p_datetrack_mode in varchar2
590 ,p_rec in out nocopy pay_etp_shd.g_rec_type
591 ,p_balance_feeds_warning out nocopy boolean
592 ,p_processing_rules_warning out nocopy boolean
593 ) is
594 --
595 l_proc varchar2(72) := g_package||'del';
596 l_validation_start_date date;
597 l_validation_end_date date;
598 l_object_version_number pay_element_types_f.object_version_number%type;
599 l_effective_start_date date;
600 l_effective_end_date date;
601 l_balance_feeds_warning boolean;
602
603 Cursor c_input_values
604 is
605 select input_value_id, object_version_number
606 from pay_input_values_f
607 where element_type_id=p_rec.element_type_id
608 and p_effective_date between effective_start_date
609 and effective_end_date
610 for update;
611 --
612 Begin
613 hr_utility.set_location('Entering:'||l_proc, 5);
614 --
615 -- Ensure that the DateTrack delete mode is valid
616 --
617 dt_api.validate_dt_del_mode(p_datetrack_mode => p_datetrack_mode);
618 --
619 dt_api.validate_dt_mode
623 ,p_base_key_column => 'element_type_id'
620 (p_effective_date => p_effective_date
621 ,p_datetrack_mode => p_datetrack_mode
622 ,p_base_table_name => 'pay_element_types_f'
624 ,p_base_key_value => p_rec.element_type_id
625 ,p_enforce_foreign_locking => false
626 ,p_validation_start_date => l_validation_start_date
627 ,p_validation_end_date => l_validation_end_date
628 );
629 --
630 -- Cascade delete the child entities
631 --
632 If p_datetrack_mode = hr_api.g_zap Then
633 -- We need to delete the database items for the deleted element
634 hrdyndbi.delete_element_type_dict (p_rec.element_type_id);
635 -- -- We need to delete any payroll frequency rules for the element
636 --
637 delete from pay_ele_payroll_freq_rules
638 where element_type_id = p_rec.element_type_id;
639 --
640 -- Delete the child retro component usages.
641 --
642 pay_retro_comp_usage_internal.delete_child_retro_comp_usages
643 (p_effective_date => p_effective_date
644 ,p_element_type_id => p_rec.element_type_id
645 );
646
647 --
648 -- Delete from TL table
649 --
650 pay_ett_del.del_tl(p_rec.element_type_id);
651 --
652 Elsif p_datetrack_mode = hr_api.g_delete Then
653 -- -- We need to remove any payroll frequency rules starting after the new end
654 -- date
655 --
656 delete from pay_ele_payroll_freq_rules
657 where element_type_id = p_rec.element_type_id
658 and start_date > p_effective_date;
659 --
660 End If;
661 --
662 For l_input_values in c_input_values
663 Loop
664 l_object_version_number := l_input_values.object_version_number;
665 --
666 pay_ivl_del.del
667 (p_effective_date => p_effective_date
668 ,p_datetrack_mode => p_datetrack_mode
669 ,p_input_value_id => l_input_values.input_value_id
670 ,p_object_version_number => l_object_version_number
671 ,p_effective_start_date => l_effective_start_date
672 ,p_effective_end_date => l_effective_end_date
673 ,p_balance_feeds_warning => l_balance_feeds_warning
674 );
675 --
676 End Loop;
677 --
678 p_balance_feeds_warning := l_balance_feeds_warning;
679 --
680 If p_datetrack_mode <> hr_api.g_delete_next_change Then
681 --
682 ben_benefit_contributions_pkg.parent_deleted
683 (p_rec.element_type_id,
684 p_datetrack_mode,
685 p_effective_date,
686 'PAY_ELEMENT_TYPES_F');
687 --
688 pay_status_rules_pkg.parent_deleted
689 (p_rec.element_type_id,
690 p_effective_date,
691 p_datetrack_mode);
692 --
693 pay_sub_class_rules_pkg.parent_deleted
694 (p_rec.element_type_id,
695 p_effective_date,
696 l_validation_start_date,
697 l_validation_end_date,
698 p_datetrack_mode,
699 'PAY_ELEMENT_TYPES_F');
700 --
701 pay_formula_result_rules_pkg.parent_deleted
702 ('PAY_ELEMENT_TYPES_F',
703 p_rec.element_type_id,
704 p_effective_date,
705 p_datetrack_mode);
706 --
707 End If;
708 --
709 -- We must lock the row which we need to delete.
710 --
711 pay_etp_shd.lck
712 (p_effective_date => p_effective_date
713 ,p_datetrack_mode => p_datetrack_mode
714 ,p_element_type_id => p_rec.element_type_id
715 ,p_object_version_number => p_rec.object_version_number
716 ,p_validation_start_date => l_validation_start_date
717 ,p_validation_end_date => l_validation_end_date
718 );
719 --
720 p_rec.business_group_id := pay_etp_shd.g_old_rec.business_group_id;
721 p_rec.legislation_code := pay_etp_shd.g_old_rec.legislation_code;
722 p_rec.legislation_subgroup := pay_etp_shd.g_old_rec.legislation_subgroup;
723 --
724 -- Set the processing_rules_warning parameter
725 --
726 If (l_validation_end_date = hr_api.g_eot and
727 p_datetrack_mode = hr_api.g_delete_next_change) Then
728 --
729 p_processing_rules_warning := True;
730 --
731 End If;
732 --
733 -- Call the supporting delete validate operation
734 --
735 pay_etp_bus.delete_validate
736 (p_rec => p_rec
737 ,p_effective_date => p_effective_date
738 ,p_datetrack_mode => p_datetrack_mode
739 ,p_validation_start_date => l_validation_start_date
740 ,p_validation_end_date => l_validation_end_date
741 );
742 --
743 -- Call to raise any errors on multi-message list
744 hr_multi_message.end_validation_set;
745 --
746 -- Call the supporting pre-delete operation
747 --
748 pay_etp_del.pre_delete
749 (p_rec => p_rec
750 ,p_effective_date => p_effective_date
751 ,p_datetrack_mode => p_datetrack_mode
752 ,p_validation_start_date => l_validation_start_date
753 ,p_validation_end_date => l_validation_end_date
754 );
755 --
756 -- Delete the row.
757 --
758 pay_etp_del.delete_dml
759 (p_rec => p_rec
760 ,p_effective_date => p_effective_date
761 ,p_datetrack_mode => p_datetrack_mode
762 ,p_validation_start_date => l_validation_start_date
763 ,p_validation_end_date => l_validation_end_date
764 );
765 -- Call the supporting post-delete operation
766 --
767 pay_etp_del.post_delete
768 (p_rec => p_rec
769 ,p_effective_date => p_effective_date
770 ,p_datetrack_mode => p_datetrack_mode
771 ,p_validation_start_date => l_validation_start_date
772 ,p_validation_end_date => l_validation_end_date
773 );
774 --
775 -- Call to raise any errors on multi-message list
776 hr_multi_message.end_validation_set;
777 --
778 hr_utility.set_location(' Leaving:'||l_proc, 5);
779 End del;
780 --
781 -- ----------------------------------------------------------------------------
782 -- |--------------------------------< del >-----------------------------------|
783 -- ----------------------------------------------------------------------------
784 Procedure del
785 (p_effective_date in date
786 ,p_datetrack_mode in varchar2
787 ,p_element_type_id in number
788 ,p_object_version_number in out nocopy number
789 ,p_effective_start_date out nocopy date
790 ,p_effective_end_date out nocopy date
791 ,p_balance_feeds_warning out nocopy boolean
792 ,p_processing_rules_warning out nocopy boolean
793 ) is
794 --
795 l_rec pay_etp_shd.g_rec_type;
796 l_proc varchar2(72) := g_package||'del';
797 l_balance_feeds_warning boolean;
798 l_processing_rules_warning boolean;
799 --
800 Begin
801 hr_utility.set_location('Entering:'||l_proc, 5);
802 --
803 -- As the delete procedure accepts a plsql record structure we do need to
804 -- convert the arguments into the record structure.
805 -- We don't need to call the supplied conversion argument routine as we
806 -- only need a few attributes.
807 --
808 l_rec.element_type_id := p_element_type_id;
809 l_rec.object_version_number := p_object_version_number;
810 --
811 -- Having converted the arguments into the pay_etp_rec
812 -- plsql record structure we must call the corresponding entity
813 -- business process
814 --
815 pay_etp_del.del
816 (p_effective_date
817 ,p_datetrack_mode
818 ,l_rec
819 ,l_balance_feeds_warning
820 ,l_processing_rules_warning
821 );
822 --
823 --
824 -- Set the out arguments
825 --
826 p_object_version_number := l_rec.object_version_number;
827 p_effective_start_date := l_rec.effective_start_date;
828 p_effective_end_date := l_rec.effective_end_date;
829 p_balance_feeds_warning := l_balance_feeds_warning;
830 p_processing_rules_warning := l_processing_rules_warning;
831 --
832 hr_utility.set_location(' Leaving:'||l_proc, 10);
833 End del;
834 --
835 end pay_etp_del;