4 -- ----------------------------------------------------------------------------
1 Package body ben_dpnt_edc_del as
2 /* $Header: beedvrhi.pkb 120.2 2010/05/18 07:23:55 sgnanama noship $ */
3 --
5 -- | Private Global Definitions |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package varchar2(33) := ' ben_dpnt_edc_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 structre.
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 ben_dpnt_edc_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) is
59 --
60 l_proc varchar2(72) := g_package||'dt_delete_dml';
61 --
62 Begin
63 hr_utility.set_location('Entering:'||l_proc, 5);
64 If (p_datetrack_mode = 'DELETE_NEXT_CHANGE') then
65 hr_utility.set_location(l_proc, 10);
66 ben_dpnt_edc_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 ben_dpnt_eligy_crit_values_f
72 where dpnt_eligy_crit_values_id = p_rec.dpnt_eligy_crit_values_id
73 and effective_start_date = p_validation_start_date;
74 --
75 ben_dpnt_edc_shd.g_api_dml := false; -- Unset the api dml status
76 Else
77 hr_utility.set_location(l_proc, 15);
78 ben_dpnt_edc_shd.g_api_dml := true; -- Set the api dml status
79 --
80 -- Delete the row(s) where the effective start date is greater than
81 -- or equal to the validation start date.
82 --
83 delete from ben_dpnt_eligy_crit_values_f
84 where dpnt_eligy_crit_values_id = p_rec.dpnt_eligy_crit_values_id
85 and effective_start_date >= p_validation_start_date;
86 --
87 ben_dpnt_edc_shd.g_api_dml := false; -- Unset the api dml status
88 End If;
89 --
90 hr_utility.set_location(' Leaving:'||l_proc, 20);
91 --
92 Exception
93 When Others Then
94 ben_dpnt_edc_shd.g_api_dml := false; -- Unset the api dml status
95 Raise;
96 end dt_delete_dml;
100 -- |------------------------------< delete_dml >------------------------------|
97 --
98 --
99 -- ----------------------------------------------------------------------------
101 -- ----------------------------------------------------------------------------
102 Procedure delete_dml
103 (p_rec in out nocopy ben_dpnt_edc_shd.g_rec_type,
104 p_effective_date in date,
105 p_datetrack_mode in varchar2,
106 p_validation_start_date in date,
107 p_validation_end_date in date) 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 dt_delete_dml(p_rec => p_rec,
115 p_effective_date => p_effective_date,
116 p_datetrack_mode => p_datetrack_mode,
117 p_validation_start_date => p_validation_start_date,
118 p_validation_end_date => p_validation_end_date);
119 --
120 hr_utility.set_location(' Leaving:'||l_proc, 10);
121 end delete_dml;
122 --
123 -- ----------------------------------------------------------------------------
124 -- |----------------------------< dt_pre_delete >-----------------------------|
125 -- ----------------------------------------------------------------------------
126 -- {Start Of Comments}
127 --
128 -- Description:
129 -- The dt_pre_delete process controls the execution of dml
130 -- for the datetrack modes: DELETE, FUTURE_CHANGE
131 -- and DELETE_NEXT_CHANGE only.
132 --
133 -- Prerequisites:
134 -- This is an internal procedure which is called from the pre_delete
135 -- procedure.
136 --
137 -- In Parameters:
138 -- A Pl/Sql record structre.
139 --
140 -- Post Success:
141 -- Processing continues.
142 --
143 -- Post Failure:
144 -- If an error has occurred, an error message and exception will be raised
145 -- but not handled.
146 --
147 -- Developer Implementation Notes:
148 -- This is an internal procedure which is required by Datetrack. Don't
149 -- remove or modify.
150 --
151 -- Access Status:
152 -- Internal Row Handler Use Only.
153 --
154 -- {End Of Comments}
155 -- ----------------------------------------------------------------------------
156 Procedure dt_pre_delete
157 (p_rec in out nocopy ben_dpnt_edc_shd.g_rec_type,
158 p_effective_date in date,
159 p_datetrack_mode in varchar2,
160 p_validation_start_date in date,
161 p_validation_end_date in date) is
162 --
163 l_proc varchar2(72) := g_package||'dt_pre_delete';
164 --
165 Begin
166 hr_utility.set_location('Entering:'||l_proc, 5);
167 --
168 If (p_datetrack_mode <> 'ZAP') then
169 --
170 p_rec.effective_start_date := ben_dpnt_edc_shd.g_old_rec.effective_start_date;
171 --
172 If (p_datetrack_mode = 'DELETE') then
173 p_rec.effective_end_date := p_validation_start_date - 1;
174 Else
175 p_rec.effective_end_date := p_validation_end_date;
176 End If;
177 --
178 -- Update the current effective end date record
179 --
180 ben_dpnt_edc_shd.upd_effective_end_date
181 (p_effective_date => p_effective_date,
182 p_base_key_value => p_rec.dpnt_eligy_crit_values_id,
183 p_new_effective_end_date => p_rec.effective_end_date,
184 p_validation_start_date => p_validation_start_date,
185 p_validation_end_date => p_validation_end_date,
186 p_object_version_number => p_rec.object_version_number);
187 Else
188 p_rec.effective_start_date := null;
189 p_rec.effective_end_date := null;
190 End If;
191 hr_utility.set_location(' Leaving:'||l_proc, 10);
192 End dt_pre_delete;
193 --
194 -- ----------------------------------------------------------------------------
195 -- |------------------------------< pre_delete >------------------------------|
196 -- ----------------------------------------------------------------------------
197 -- {Start Of Comments}
198 --
199 -- Description:
200 -- This private procedure contains any processing which is required before
201 -- the delete dml.
202 --
203 -- Prerequisites:
204 -- This is an internal procedure which is called from the del procedure.
205 --
206 -- In Parameters:
207 -- A Pl/Sql record structre.
208 --
209 -- Post Success:
210 -- Processing continues.
211 --
212 -- Post Failure:
213 -- If an error has occurred, an error message and exception will be raised
214 -- but not handled.
215 --
216 -- Developer Implementation Notes:
217 -- Any pre-processing required before the delete dml is issued should be
218 -- coded within this procedure. It is important to note that any 3rd party
219 -- maintenance should be reviewed before placing in this procedure. The call
220 -- to the dt_delete_dml procedure should NOT be removed.
221 --
222 -- Access Status:
223 -- Internal Row Handler Use Only.
224 --
225 -- {End Of Comments}
226 -- ----------------------------------------------------------------------------
227 Procedure pre_delete
228 (p_rec in out nocopy ben_dpnt_edc_shd.g_rec_type,
229 p_effective_date in date,
230 p_datetrack_mode in varchar2,
231 p_validation_start_date in date,
232 p_validation_end_date in date) is
233 --
234 l_proc varchar2(72) := g_package||'pre_delete';
235 --
236 Begin
237 hr_utility.set_location('Entering:'||l_proc, 5);
238 --
239 --
240 --
241 dt_pre_delete
242 (p_rec => p_rec,
243 p_effective_date => p_effective_date,
244 p_datetrack_mode => p_datetrack_mode,
245 p_validation_start_date => p_validation_start_date,
246 p_validation_end_date => p_validation_end_date);
250 --
247 --
248 hr_utility.set_location(' Leaving:'||l_proc, 10);
249 End pre_delete;
251 -- ----------------------------------------------------------------------------
252 -- |-----------------------------< post_delete >------------------------------|
253 -- ----------------------------------------------------------------------------
254 -- {Start Of Comments}
255 --
256 -- Description:
257 -- This private procedure contains any processing which is required after the
258 -- delete dml.
259 --
260 -- Prerequisites:
261 -- This is an internal procedure which is called from the del procedure.
262 --
263 -- In Parameters:
264 -- A Pl/Sql record structre.
265 --
266 -- Post Success:
267 -- Processing continues.
268 --
269 -- Post Failure:
270 -- If an error has occurred, an error message and exception will be raised
271 -- but not handled.
272 --
273 -- Developer Implementation Notes:
274 -- Any post-processing required after the delete dml is issued should be
275 -- coded within this procedure. It is important to note that any 3rd party
276 -- maintenance should be reviewed before placing in this procedure.
277 --
278 -- Access Status:
279 -- Internal Row Handler Use Only.
280 --
281 -- {End Of Comments}
282 -- ----------------------------------------------------------------------------
283 Procedure post_delete
284 (p_rec in ben_dpnt_edc_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) is
289 --
290 l_proc varchar2(72) := g_package||'post_delete';
291 --
292 Begin
293 hr_utility.set_location('Entering:'||l_proc, 5);
294 --
295 --
296 -- Start of API User Hook for post_delete.
297 --
298 begin
299 --
300 ben_dpnt_edc_rkd.after_delete
301 (
302 p_dpnt_eligy_crit_values_id => p_rec.dpnt_eligy_crit_values_id
303 ,p_effective_start_date => p_rec.effective_start_date
304 ,p_effective_end_date => p_rec.effective_end_date
305 ,p_datetrack_mode =>p_datetrack_mode
306 ,p_validation_start_date =>p_validation_start_date
307 ,p_validation_end_date =>p_validation_end_date
308 ,p_dpnt_cvg_eligy_prfl_id_o =>ben_dpnt_edc_shd.g_old_rec.dpnt_cvg_eligy_prfl_id
309 ,p_eligy_criteria_dpnt_id_o =>ben_dpnt_edc_shd.g_old_rec.eligy_criteria_dpnt_id
310 ,p_effective_start_date_o =>ben_dpnt_edc_shd.g_old_rec.effective_start_date
311 ,p_effective_end_date_o =>ben_dpnt_edc_shd.g_old_rec.effective_end_date
312 ,p_ordr_num_o =>ben_dpnt_edc_shd.g_old_rec.ordr_num
313 ,p_number_value1_o =>ben_dpnt_edc_shd.g_old_rec.number_value1
314 ,p_number_value2_o =>ben_dpnt_edc_shd.g_old_rec.number_value2
315 ,p_char_value1_o =>ben_dpnt_edc_shd.g_old_rec.char_value1
316 ,p_char_value2_o =>ben_dpnt_edc_shd.g_old_rec.char_value2
317 ,p_date_value1_o =>ben_dpnt_edc_shd.g_old_rec.date_value1
318 ,p_date_value2_o =>ben_dpnt_edc_shd.g_old_rec.date_value2
319 ,p_excld_flag_o =>ben_dpnt_edc_shd.g_old_rec.excld_flag
320 ,p_business_group_id_o =>ben_dpnt_edc_shd.g_old_rec.business_group_id
321 ,p_edc_attribute_category_o =>ben_dpnt_edc_shd.g_old_rec.edc_attribute_category
322 ,p_edc_attribute1_o =>ben_dpnt_edc_shd.g_old_rec.edc_attribute1
323 ,p_edc_attribute2_o =>ben_dpnt_edc_shd.g_old_rec.edc_attribute2
327 ,p_edc_attribute6_o =>ben_dpnt_edc_shd.g_old_rec.edc_attribute6
324 ,p_edc_attribute3_o =>ben_dpnt_edc_shd.g_old_rec.edc_attribute3
325 ,p_edc_attribute4_o =>ben_dpnt_edc_shd.g_old_rec.edc_attribute4
326 ,p_edc_attribute5_o =>ben_dpnt_edc_shd.g_old_rec.edc_attribute5
328 ,p_edc_attribute7_o =>ben_dpnt_edc_shd.g_old_rec.edc_attribute7
329 ,p_edc_attribute8_o =>ben_dpnt_edc_shd.g_old_rec.edc_attribute8
330 ,p_edc_attribute9_o =>ben_dpnt_edc_shd.g_old_rec.edc_attribute9
331 ,p_edc_attribute10_o =>ben_dpnt_edc_shd.g_old_rec.edc_attribute10
332 ,p_edc_attribute11_o =>ben_dpnt_edc_shd.g_old_rec.edc_attribute11
336 ,p_edc_attribute15_o =>ben_dpnt_edc_shd.g_old_rec.edc_attribute15
333 ,p_edc_attribute12_o =>ben_dpnt_edc_shd.g_old_rec.edc_attribute12
334 ,p_edc_attribute13_o =>ben_dpnt_edc_shd.g_old_rec.edc_attribute13
335 ,p_edc_attribute14_o =>ben_dpnt_edc_shd.g_old_rec.edc_attribute14
337 ,p_edc_attribute16_o =>ben_dpnt_edc_shd.g_old_rec.edc_attribute16
338 ,p_edc_attribute17_o =>ben_dpnt_edc_shd.g_old_rec.edc_attribute17
339 ,p_edc_attribute18_o =>ben_dpnt_edc_shd.g_old_rec.edc_attribute18
340 ,p_edc_attribute19_o =>ben_dpnt_edc_shd.g_old_rec.edc_attribute19
341 ,p_edc_attribute20_o =>ben_dpnt_edc_shd.g_old_rec.edc_attribute20
342 ,p_edc_attribute21_o =>ben_dpnt_edc_shd.g_old_rec.edc_attribute21
343 ,p_edc_attribute22_o =>ben_dpnt_edc_shd.g_old_rec.edc_attribute22
344 ,p_edc_attribute23_o =>ben_dpnt_edc_shd.g_old_rec.edc_attribute23
345 ,p_edc_attribute24_o =>ben_dpnt_edc_shd.g_old_rec.edc_attribute24
346 ,p_edc_attribute25_o =>ben_dpnt_edc_shd.g_old_rec.edc_attribute25
347 ,p_edc_attribute26_o =>ben_dpnt_edc_shd.g_old_rec.edc_attribute26
348 ,p_edc_attribute27_o =>ben_dpnt_edc_shd.g_old_rec.edc_attribute27
349 ,p_edc_attribute28_o =>ben_dpnt_edc_shd.g_old_rec.edc_attribute28
350 ,p_edc_attribute29_o =>ben_dpnt_edc_shd.g_old_rec.edc_attribute29
351 ,p_edc_attribute30_o =>ben_dpnt_edc_shd.g_old_rec.edc_attribute30
352 ,p_object_version_number_o =>ben_dpnt_edc_shd.g_old_rec.object_version_number
353 ,p_Char_value3_o =>ben_dpnt_edc_shd.g_old_rec.Char_value3
354 ,p_Char_value4_o =>ben_dpnt_edc_shd.g_old_rec.Char_value4
355 ,p_Number_value3_o =>ben_dpnt_edc_shd.g_old_rec.Number_value3
356 ,p_Number_value4_o =>ben_dpnt_edc_shd.g_old_rec.Number_value4
357 ,p_Date_value3_o =>ben_dpnt_edc_shd.g_old_rec.Date_value3
358 ,p_Date_value4_o =>ben_dpnt_edc_shd.g_old_rec.Date_value4
359 );
360 --
361 --
362 exception
363 --
364 when hr_api.cannot_find_prog_unit then
365 --
366 hr_api.cannot_find_prog_unit_error
367 (p_module_name => 'ben_dpnt_eligy_crit_values_f'
368 ,p_hook_type => 'AD');
369 --
370 end;
371 --
372 -- End of API User Hook for post_delete.
373 --
374 --
375 hr_utility.set_location(' Leaving:'||l_proc, 10);
376 End post_delete;
377 --
378 -- ----------------------------------------------------------------------------
379 -- |---------------------------------< del >----------------------------------|
380 -- ----------------------------------------------------------------------------
381 Procedure del
382 (
383 p_rec in out nocopy ben_dpnt_edc_shd.g_rec_type,
384 p_effective_date in date,
385 p_datetrack_mode in varchar2
386 ) is
387 --
388 l_proc varchar2(72) := g_package||'del';
389 l_validation_start_date date;
390 l_validation_end_date date;
391 --
392 Begin
393 hr_utility.set_location('Entering:'||l_proc, 5);
394 --
395 -- Ensure that the DateTrack delete mode is valid
396 --
397 dt_api.validate_dt_del_mode(p_datetrack_mode => p_datetrack_mode);
398 --
399 -- We must lock the row which we need to delete.
400 --
401 ben_dpnt_edc_shd.lck
402 (p_effective_date => p_effective_date,
403 p_datetrack_mode => p_datetrack_mode,
404 p_dpnt_eligy_crit_values_id => p_rec.dpnt_eligy_crit_values_id,
405 p_object_version_number => p_rec.object_version_number,
406 p_validation_start_date => l_validation_start_date,
407 p_validation_end_date => l_validation_end_date);
408 --
409 -- Call the supporting delete validate operation
410 --
411 ben_dpnt_edc_bus.delete_validate
412 (p_rec => p_rec,
413 p_effective_date => p_effective_date,
414 p_datetrack_mode => p_datetrack_mode,
415 p_validation_start_date => l_validation_start_date,
416 p_validation_end_date => l_validation_end_date);
417 --
418 -- Call the supporting pre-delete operation
419 --
420 pre_delete
421 (p_rec => p_rec,
422 p_effective_date => p_effective_date,
423 p_datetrack_mode => p_datetrack_mode,
424 p_validation_start_date => l_validation_start_date,
425 p_validation_end_date => l_validation_end_date);
426 --
427 -- Delete the row.
428 --
429 delete_dml
430 (p_rec => p_rec,
431 p_effective_date => p_effective_date,
432 p_datetrack_mode => p_datetrack_mode,
433 p_validation_start_date => l_validation_start_date,
434 p_validation_end_date => l_validation_end_date);
435 --
436 -- Call the supporting post-delete operation
437 --
438 post_delete
439 (p_rec => p_rec,
440 p_effective_date => p_effective_date,
441 p_datetrack_mode => p_datetrack_mode,
442 p_validation_start_date => l_validation_start_date,
443 p_validation_end_date => l_validation_end_date);
444 end del;
445 --
446 -- ----------------------------------------------------------------------------
447 -- |---------------------------------< del >----------------------------------|
448 -- ----------------------------------------------------------------------------
449 Procedure del
450 (
451 p_dpnt_eligy_crit_values_id in number,
455 p_effective_date in date,
452 p_effective_start_date out nocopy date,
453 p_effective_end_date out nocopy date,
454 p_object_version_number in out nocopy number,
456 p_datetrack_mode in varchar2
457 ) is
458 --
459 l_rec ben_dpnt_edc_shd.g_rec_type;
460 l_proc varchar2(72) := g_package||'del';
461 --
462 Begin
466 -- convert the arguments into the record structure.
463 hr_utility.set_location('Entering:'||l_proc, 5);
464 --
465 -- As the delete procedure accepts a plsql record structure we do need to
467 -- We don't need to call the supplied conversion argument routine as we
468 -- only need a few attributes.
469 --
470 l_rec.dpnt_eligy_crit_values_id := p_dpnt_eligy_crit_values_id;
471 l_rec.object_version_number := p_object_version_number;
472 -- Having converted the arguments into the
473 -- plsql record structure we must call the corresponding entity
474 -- business process
475 --
476 del(l_rec, p_effective_date, p_datetrack_mode);
477 --
478 -- Set the out arguments
479 --
480 p_object_version_number := l_rec.object_version_number;
481 p_effective_start_date := l_rec.effective_start_date;
482 p_effective_end_date := l_rec.effective_end_date;
483 --
484 hr_utility.set_location(' Leaving:'||l_proc, 10);
485
486 end del;
487 --
488 end ben_dpnt_edc_del;