[Home] [Help]
PACKAGE BODY: APPS.PER_SPS_DEL
Source
1 Package Body per_sps_del as
2 /* $Header: pespsrhi.pkb 120.5.12000000.1 2007/01/22 04:39:24 appldev noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- | Private Global Definitions |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package varchar2(33) := ' per_sps_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 per_sps_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 per_sps_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 per_spinal_point_steps_f
72 where step_id = p_rec.step_id
73 and effective_start_date = p_validation_start_date;
74 --
75 per_sps_shd.g_api_dml := false; -- Unset the api dml status
76 Else
77 per_sps_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 per_spinal_point_steps_f
83 where step_id = p_rec.step_id
84 and effective_start_date >= p_validation_start_date;
85 --
86 per_sps_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 per_sps_shd.g_api_dml := false; -- Unset the api dml status
94 Raise;
95 --
96 End dt_delete_dml;
97 --
98 -- ----------------------------------------------------------------------------
99 -- |------------------------------< delete_dml >------------------------------|
100 -- ----------------------------------------------------------------------------
101 Procedure delete_dml
102 (p_rec in out nocopy per_sps_shd.g_rec_type
103 ,p_effective_date in date
104 ,p_datetrack_mode in varchar2
105 ,p_validation_start_date in date
106 ,p_validation_end_date in date
107 ) is
108 --
109 l_proc varchar2(72) := g_package||'delete_dml';
110 --
111 Begin
112 hr_utility.set_location('Entering:'||l_proc, 5);
113 --
114 per_sps_del.dt_delete_dml
115 (p_rec => p_rec
116 ,p_effective_date => p_effective_date
117 ,p_datetrack_mode => p_datetrack_mode
118 ,p_validation_start_date => p_validation_start_date
119 ,p_validation_end_date => p_validation_end_date
120 );
121 --
122 hr_utility.set_location(' Leaving:'||l_proc, 10);
123 End delete_dml;
124 --
125 -- ----------------------------------------------------------------------------
126 -- |----------------------------< dt_pre_delete >-----------------------------|
127 -- ----------------------------------------------------------------------------
128 -- {Start Of Comments}
129 --
130 -- Description:
131 -- The dt_pre_delete process controls the execution of dml
132 -- for the datetrack modes: DELETE, FUTURE_CHANGE
133 -- and DELETE_NEXT_CHANGE only.
134 --
135 -- Prerequisites:
136 -- This is an internal procedure which is called from the pre_delete
137 -- procedure.
138 --
139 -- In Parameters:
140 -- A Pl/Sql record structure.
141 --
142 -- Post Success:
143 -- Processing continues.
144 --
145 -- Post Failure:
146 -- If an error has occurred, an error message and exception will be raised
147 -- but not handled.
148 --
149 -- Developer Implementation Notes:
150 -- This is an internal procedure which is required by Datetrack. Don't
151 -- remove or modify.
152 --
153 -- Access Status:
154 -- Internal Row Handler Use Only.
155 --
156 -- {End Of Comments}
157 -- ----------------------------------------------------------------------------
158 Procedure dt_pre_delete
159 (p_rec in out nocopy per_sps_shd.g_rec_type
160 ,p_effective_date in date
161 ,p_datetrack_mode in varchar2
162 ,p_validation_start_date in date
163 ,p_validation_end_date in date
164 ) is
165 --
166 l_proc varchar2(72) := g_package||'dt_pre_delete';
167 l_return varchar2(30);
168 l_grade_id number;
169 l_spinal_point_id number;
170 l_message varchar2(2000) := null;
171 --
172 cursor csr_get_grade_id is
173 select spine.grade_id
174 ,step.spinal_point_id
175 from per_grade_spines_f spine
176 ,per_spinal_point_steps_f step
177 where step.step_id = p_rec.step_id
178 and p_effective_date between
179 step.effective_start_date and step.effective_end_date
180 and step.grade_spine_id = spine.grade_spine_id
181 and p_effective_date between
182 spine.effective_start_date and spine.effective_end_date;
183
184 Begin
185 hr_utility.set_location('Entering:'||l_proc, 5);
186 --
187 --
188 -- Call pqh_gsp_sync_compensation_obj.delete_oipl_for_step
189 --
190 --
191 open csr_get_grade_id;
192 fetch csr_get_grade_id into l_grade_id,l_spinal_point_id;
193 if csr_get_grade_id%notfound then
194 close csr_get_grade_id;
195 hr_utility.set_location(l_proc, 40);
196 else
197 close csr_get_grade_id;
198 l_return := pqh_gsp_sync_compensation_obj.delete_oipl_for_step
199 (p_grade_id => l_grade_id
200 ,p_spinal_point_id => l_spinal_point_id
201 ,p_step_id => p_rec.step_id
202 ,p_effective_date => p_effective_date
203 ,p_datetrack_mode => p_datetrack_mode
204 );
205 --
206 hr_utility.trace('pqh_gsp_sync_compensation_obj.delete_oipl_for_step : '
207 || l_return);
208 if l_return <> 'SUCCESS' Then
209 l_message := fnd_message.get;
210 hr_utility.trace('error message : ' || l_message);
211 fnd_message.set_name('PER','HR_289570_DEL_OPTION_IN_PLAN');
212 if l_message is not null then
213 fnd_message.set_token('ERR_CODE',l_message);
214 else
215 fnd_message.set_token('ERR_CODE','-1');
216 end if;
217 --
218 fnd_message.raise_error;
219 End if;
220 end if;
221 --
222 If (p_datetrack_mode <> hr_api.g_zap) then
223 --
224 p_rec.effective_start_date
225 := per_sps_shd.g_old_rec.effective_start_date;
226 --
227 If (p_datetrack_mode = hr_api.g_delete) then
228 p_rec.effective_end_date := p_validation_start_date - 1;
229 Else
230 p_rec.effective_end_date := p_validation_end_date;
231 End If;
232 --
233 -- Update the current effective end date record
234 --
235 per_sps_shd.upd_effective_end_date
236 (p_effective_date => p_effective_date
237 ,p_base_key_value => p_rec.step_id
238 ,p_new_effective_end_date => p_rec.effective_end_date
239 ,p_validation_start_date => p_validation_start_date
240 ,p_validation_end_date => p_validation_end_date
241 ,p_object_version_number => p_rec.object_version_number
242 );
243 Else
244 p_rec.effective_start_date := null;
245 p_rec.effective_end_date := null;
246 End If;
247 hr_utility.set_location(' Leaving:'||l_proc, 10);
248 End dt_pre_delete;
249 --
250 -- ----------------------------------------------------------------------------
251 -- |------------------------------< pre_delete >------------------------------|
252 -- ----------------------------------------------------------------------------
253 -- {Start Of Comments}
254 --
255 -- Description:
256 -- This private procedure contains any processing which is required before
257 -- the delete dml.
258 --
259 -- Prerequisites:
260 -- This is an internal procedure which is called from the del procedure.
261 --
262 -- In Parameters:
263 -- A Pl/Sql record structure.
264 --
265 -- Post Success:
266 -- Processing continues.
267 --
268 -- Post Failure:
269 -- If an error has occurred, an error message and exception will be raised
270 -- but not handled.
271 --
272 -- Developer Implementation Notes:
273 -- Any pre-processing required before the delete dml is issued should be
274 -- coded within this procedure. It is important to note that any 3rd party
275 -- maintenance should be reviewed before placing in this procedure. The call
276 -- to the dt_delete_dml procedure should NOT be removed.
277 --
278 -- Access Status:
279 -- Internal Row Handler Use Only.
280 --
281 -- {End Of Comments}
282 -- ----------------------------------------------------------------------------
283 Procedure pre_delete
284 (p_rec in out nocopy per_sps_shd.g_rec_type
285 ,p_effective_date in date
286 ,p_datetrack_mode in varchar2
287 ,p_validation_start_date in date
288 ,p_validation_end_date in date
289 ) is
290 --
291 l_proc varchar2(72) := g_package||'pre_delete';
292 --
293 --
294 --
295 Begin
296 hr_utility.set_location('Entering:'||l_proc, 5);
297 --
298 --
299 --
300 per_sps_del.dt_pre_delete
301 (p_rec => p_rec
302 ,p_effective_date => p_effective_date
303 ,p_datetrack_mode => p_datetrack_mode
304 ,p_validation_start_date => p_validation_start_date
305 ,p_validation_end_date => p_validation_end_date
306 );
307 --
308 hr_utility.set_location(' Leaving:'||l_proc, 10);
309 End pre_delete;
310 --
311 -- ----------------------------------------------------------------------------
312 -- |----------------------------< post_delete >-------------------------------|
313 -- ----------------------------------------------------------------------------
314 -- {Start Of Comments}
315 --
316 -- Description:
317 -- This private procedure contains any processing which is required after
318 -- the delete dml.
319 --
320 -- Prerequisites:
321 -- This is an internal procedure which is called from the del procedure.
322 --
323 -- In Parameters:
324 -- A Pl/Sql record structure.
325 --
326 -- Post Success:
327 -- Processing continues.
328 --
329 -- Post Failure:
330 -- If an error has occurred, an error message and exception will be raised
331 -- but not handled.
332 --
333 -- Developer Implementation Notes:
334 -- Any post-processing required after the delete dml is issued should be
335 -- coded within this procedure. It is important to note that any 3rd party
336 -- maintenance should be reviewed before placing in this procedure.
337 --
338 -- Access Status:
339 -- Internal Row Handler Use Only.
340 --
341 -- {End Of Comments}
342 -- ----------------------------------------------------------------------------
343 Procedure post_delete
344 (p_rec in per_sps_shd.g_rec_type
345 ,p_effective_date in date
346 ,p_datetrack_mode in varchar2
347 ,p_validation_start_date in date
348 ,p_validation_end_date in date
349 ) is
350 --
351 l_proc varchar2(72) := g_package||'post_delete';
352 --
353 Begin
354 hr_utility.set_location('Entering:'||l_proc, 5);
355 begin
356 --
357 per_sps_rkd.after_delete
358 (p_effective_date
359 => p_effective_date
360 ,p_datetrack_mode
361 => p_datetrack_mode
362 ,p_validation_start_date
363 => p_validation_start_date
364 ,p_validation_end_date
365 => p_validation_end_date
366 ,p_step_id
367 => p_rec.step_id
368 ,p_effective_start_date
369 => p_rec.effective_start_date
370 ,p_effective_end_date
371 => p_rec.effective_end_date
372 ,p_effective_start_date_o
373 => per_sps_shd.g_old_rec.effective_start_date
374 ,p_effective_end_date_o
375 => per_sps_shd.g_old_rec.effective_end_date
376 ,p_business_group_id_o
377 => per_sps_shd.g_old_rec.business_group_id
378 ,p_spinal_point_id_o
379 => per_sps_shd.g_old_rec.spinal_point_id
380 ,p_grade_spine_id_o
381 => per_sps_shd.g_old_rec.grade_spine_id
382 ,p_sequence_o
383 => per_sps_shd.g_old_rec.sequence
384 ,p_request_id_o
385 => per_sps_shd.g_old_rec.request_id
386 ,p_program_application_id_o
387 => per_sps_shd.g_old_rec.program_application_id
388 ,p_program_id_o
389 => per_sps_shd.g_old_rec.program_id
390 ,p_program_update_date_o
391 => per_sps_shd.g_old_rec.program_update_date
392 ,p_information1_o
393 => per_sps_shd.g_old_rec.information1
394 ,p_information2_o
395 => per_sps_shd.g_old_rec.information2
396 ,p_information3_o
397 => per_sps_shd.g_old_rec.information3
398 ,p_information4_o
399 => per_sps_shd.g_old_rec.information4
400 ,p_information5_o
401 => per_sps_shd.g_old_rec.information5
402 ,p_information6_o
403 => per_sps_shd.g_old_rec.information6
404 ,p_information7_o
405 => per_sps_shd.g_old_rec.information7
406 ,p_information8_o
407 => per_sps_shd.g_old_rec.information8
408 ,p_information9_o
409 => per_sps_shd.g_old_rec.information9
410 ,p_information10_o
411 => per_sps_shd.g_old_rec.information10
412 ,p_information11_o
413 => per_sps_shd.g_old_rec.information11
414 ,p_information12_o
415 => per_sps_shd.g_old_rec.information12
416 ,p_information13_o
417 => per_sps_shd.g_old_rec.information13
418 ,p_information14_o
419 => per_sps_shd.g_old_rec.information14
420 ,p_information15_o
421 => per_sps_shd.g_old_rec.information15
422 ,p_information16_o
423 => per_sps_shd.g_old_rec.information16
424 ,p_information17_o
425 => per_sps_shd.g_old_rec.information17
426 ,p_information18_o
427 => per_sps_shd.g_old_rec.information18
428 ,p_information19_o
429 => per_sps_shd.g_old_rec.information19
430 ,p_information20_o
431 => per_sps_shd.g_old_rec.information20
432 ,p_information21_o
433 => per_sps_shd.g_old_rec.information21
434 ,p_information22_o
435 => per_sps_shd.g_old_rec.information22
436 ,p_information23_o
437 => per_sps_shd.g_old_rec.information23
438 ,p_information24_o
439 => per_sps_shd.g_old_rec.information24
440 ,p_information25_o
441 => per_sps_shd.g_old_rec.information25
442 ,p_information26_o
443 => per_sps_shd.g_old_rec.information26
444 ,p_information27_o
445 => per_sps_shd.g_old_rec.information27
446 ,p_information28_o
447 => per_sps_shd.g_old_rec.information28
448 ,p_information29_o
449 => per_sps_shd.g_old_rec.information29
450 ,p_information30_o
451 => per_sps_shd.g_old_rec.information30
452 ,p_information_category_o
453 => per_sps_shd.g_old_rec.information_category
454 ,p_object_version_number_o
455 => per_sps_shd.g_old_rec.object_version_number
456 );
457 --
458 exception
459 --
460 when hr_api.cannot_find_prog_unit then
461 --
462 hr_api.cannot_find_prog_unit_error
463 (p_module_name => 'PER_SPINAL_POINT_STEPS_F'
464 ,p_hook_type => 'AD');
465 --
466 end;
467 --
468 hr_utility.set_location(' Leaving:'||l_proc, 10);
469 End post_delete;
470 --
471 -- ----------------------------------------------------------------------------
472 -- |---------------------------------< del >----------------------------------|
473 -- ----------------------------------------------------------------------------
474 Procedure del
475 (p_effective_date in date
476 ,p_datetrack_mode in varchar2
477 ,p_rec in out nocopy per_sps_shd.g_rec_type
478 ,p_called_from_del_grd_scale in boolean --bug 4096238
479 ) is
480 --
481 l_proc varchar2(72) := g_package||'del';
482 l_validation_start_date date;
483 l_validation_end_date date;
484 --
485 Begin
486 hr_utility.set_location('Entering:' || l_proc, 10);
487 --
488 -- Ensure that the DateTrack delete mode is valid
489 --
490 dt_api.validate_dt_del_mode(p_datetrack_mode => p_datetrack_mode);
491 --
492 per_sps_bus.chk_delete
493 (p_step_id => p_rec.step_id
494 ,p_spinal_point_id => p_rec.spinal_point_id
495 ,p_grade_spine_id => p_rec.grade_spine_id
496 ,p_effective_date => p_effective_date
497 ,p_datetrack_mode => p_datetrack_mode
498 ,p_called_from_del_grd_scale => p_called_from_del_grd_scale -- bug 4096238
499 );
500 -- We must lock the row which we need to delete.
501 --
502 per_sps_shd.lck
503 (p_effective_date => p_effective_date
504 ,p_datetrack_mode => p_datetrack_mode
505 ,p_step_id => p_rec.step_id
506 ,p_object_version_number => p_rec.object_version_number
507 ,p_validation_start_date => l_validation_start_date
508 ,p_validation_end_date => l_validation_end_date
509 );
510 --
511 -- Call the supporting delete validate operation
512 --
513 per_sps_bus.delete_validate
514 (p_rec => p_rec
515 ,p_effective_date => p_effective_date
516 ,p_datetrack_mode => p_datetrack_mode
517 ,p_validation_start_date => l_validation_start_date
518 ,p_validation_end_date => l_validation_end_date
519 ,p_called_from_del_grd_scale => p_called_from_del_grd_scale --bug 4096238
520 );
521 --
522 -- Call to raise any errors on multi-message list
523 hr_multi_message.end_validation_set;
524 --
525 -- Call the supporting pre-delete operation
526 --
527 per_sps_del.pre_delete
528 (p_rec => p_rec
529 ,p_effective_date => p_effective_date
530 ,p_datetrack_mode => p_datetrack_mode
531 ,p_validation_start_date => l_validation_start_date
532 ,p_validation_end_date => l_validation_end_date
533 );
534 --
535 -- Delete the row.
536 --
537 per_sps_del.delete_dml
538 (p_rec => p_rec
539 ,p_effective_date => p_effective_date
540 ,p_datetrack_mode => p_datetrack_mode
541 ,p_validation_start_date => l_validation_start_date
542 ,p_validation_end_date => l_validation_end_date
543 );
544 -- Call the supporting post-delete operation
545 --
546 per_sps_del.post_delete
547 (p_rec => p_rec
548 ,p_effective_date => p_effective_date
549 ,p_datetrack_mode => p_datetrack_mode
550 ,p_validation_start_date => l_validation_start_date
551 ,p_validation_end_date => l_validation_end_date
552 );
553 --
554 -- Call to raise any errors on multi-message list
555 hr_multi_message.end_validation_set;
556 --
557 hr_utility.set_location(' Leaving:' || l_proc, 20);
558 End del;
559 --
560 -- ----------------------------------------------------------------------------
561 -- |--------------------------------< del >-----------------------------------|
562 -- ----------------------------------------------------------------------------
563 Procedure del
564 (p_effective_date in date
565 ,p_datetrack_mode in varchar2
566 ,p_step_id in number
567 ,p_object_version_number in out nocopy number
568 ,p_effective_start_date out nocopy date
569 ,p_effective_end_date out nocopy date
570 ,p_called_from_del_grd_scale in boolean --bug 4096238
571 ) is
572 --
573 l_rec per_sps_shd.g_rec_type;
574 l_proc varchar2(72) := g_package||'del';
575 --
576 Begin
577 hr_utility.set_location('Entering:' || l_proc, 5);
578 --
579 -- As the delete procedure accepts a plsql record structure we do need to
580 -- convert the arguments into the record structure.
581 -- We don't need to call the supplied conversion argument routine as we
582 -- only need a few attributes.
583 --
584 l_rec.step_id := p_step_id;
585 l_rec.object_version_number := p_object_version_number;
586 --
587 -- Having converted the arguments into the per_sps_rec
588 -- plsql record structure we must call the corresponding entity
589 -- business process
590 --
591 per_sps_del.del
592 (p_effective_date
593 ,p_datetrack_mode
594 ,l_rec
595 ,p_called_from_del_grd_scale --bug 4096238
596 );
597 --
598 --
599 -- Set the out arguments
600 --
601 p_object_version_number := l_rec.object_version_number;
602 p_effective_start_date := l_rec.effective_start_date;
603 p_effective_end_date := l_rec.effective_end_date;
604 --
605 hr_utility.set_location(' Leaving:' || l_proc, 10);
606 End del;
607 --
608 end per_sps_del;