DBA Data[Home] [Help]

PACKAGE BODY: APPS.BEN_CLP_DEL

Source


1 Package Body ben_clp_del as
2 /* $Header: beclprhi.pkb 120.0.12010000.2 2008/08/05 14:17:49 ubhat ship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33)	:= '  ben_clp_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_clp_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_clp_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_clpse_lf_evt_f
72     where       clpse_lf_evt_id = p_rec.clpse_lf_evt_id
73     and	  effective_start_date = p_validation_start_date;
74     --
75     ben_clp_shd.g_api_dml := false;   -- Unset the api dml status
76   Else
77     hr_utility.set_location(l_proc, 15);
78     ben_clp_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_clpse_lf_evt_f
84     where        clpse_lf_evt_id = p_rec.clpse_lf_evt_id
85     and	  effective_start_date >= p_validation_start_date;
86     --
87     ben_clp_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_clp_shd.g_api_dml := false;   -- Unset the api dml status
95     Raise;
96 End dt_delete_dml;
97 --
98 -- ----------------------------------------------------------------------------
99 -- |------------------------------< delete_dml >------------------------------|
100 -- ----------------------------------------------------------------------------
101 Procedure delete_dml
102 	(p_rec 			 in out nocopy ben_clp_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) is
107 --
108   l_proc	varchar2(72) := g_package||'delete_dml';
109 --
110 Begin
111   hr_utility.set_location('Entering:'||l_proc, 5);
112   --
113   dt_delete_dml(p_rec			=> p_rec,
114 		p_effective_date	=> p_effective_date,
115 		p_datetrack_mode	=> p_datetrack_mode,
116        		p_validation_start_date	=> p_validation_start_date,
117 		p_validation_end_date	=> p_validation_end_date);
118   --
119   hr_utility.set_location(' Leaving:'||l_proc, 10);
120 End delete_dml;
121 --
122 -- ----------------------------------------------------------------------------
123 -- |----------------------------< dt_pre_delete >-----------------------------|
124 -- ----------------------------------------------------------------------------
125 -- {Start Of Comments}
126 --
127 -- Description:
128 --   The dt_pre_delete process controls the execution of dml
129 --   for the datetrack modes: DELETE, FUTURE_CHANGE
130 --   and DELETE_NEXT_CHANGE only.
131 --
132 -- Prerequisites:
133 --   This is an internal procedure which is called from the pre_delete
134 --   procedure.
135 --
136 -- In Parameters:
137 --   A Pl/Sql record structre.
138 --
139 -- Post Success:
140 --   Processing continues.
141 --
142 -- Post Failure:
143 --   If an error has occurred, an error message and exception will be raised
144 --   but not handled.
145 --
146 -- Developer Implementation Notes:
147 --   This is an internal procedure which is required by Datetrack. Don't
148 --   remove or modify.
149 --
150 -- Access Status:
151 --   Internal Row Handler Use Only.
152 --
153 -- {End Of Comments}
154 -- ----------------------------------------------------------------------------
155 Procedure dt_pre_delete
156 	(p_rec 			 in out nocopy ben_clp_shd.g_rec_type,
157 	 p_effective_date	 in	date,
158 	 p_datetrack_mode	 in	varchar2,
159 	 p_validation_start_date in	date,
160 	 p_validation_end_date	 in	date) is
161 --
162   l_proc	varchar2(72) := g_package||'dt_pre_delete';
163 --
164 Begin
165   hr_utility.set_location('Entering:'||l_proc, 5);
166   --
167   If (p_datetrack_mode <> 'ZAP') then
168     --
169     p_rec.effective_start_date := ben_clp_shd.g_old_rec.effective_start_date;
170     --
171     If (p_datetrack_mode = 'DELETE') then
172       p_rec.effective_end_date := p_validation_start_date - 1;
173     Else
174       p_rec.effective_end_date := p_validation_end_date;
175     End If;
176     --
177     -- Update the current effective end date record
178     --
179     ben_clp_shd.upd_effective_end_date
180       (p_effective_date	        => p_effective_date,
181        p_base_key_value	        => p_rec.clpse_lf_evt_id,
182        p_new_effective_end_date => p_rec.effective_end_date,
183        p_validation_start_date  => p_validation_start_date,
184        p_validation_end_date	=> p_validation_end_date,
185        p_object_version_number  => p_rec.object_version_number);
186   Else
187     p_rec.effective_start_date := null;
188     p_rec.effective_end_date   := null;
189   End If;
190   hr_utility.set_location(' Leaving:'||l_proc, 10);
191 End dt_pre_delete;
192 --
193 -- ----------------------------------------------------------------------------
194 -- |------------------------------< pre_delete >------------------------------|
195 -- ----------------------------------------------------------------------------
196 -- {Start Of Comments}
197 --
198 -- Description:
199 --   This private procedure contains any processing which is required before
200 --   the delete dml.
201 --
202 -- Prerequisites:
203 --   This is an internal procedure which is called from the del procedure.
204 --
205 -- In Parameters:
206 --   A Pl/Sql record structre.
207 --
208 -- Post Success:
209 --   Processing continues.
210 --
211 -- Post Failure:
212 --   If an error has occurred, an error message and exception will be raised
213 --   but not handled.
214 --
215 -- Developer Implementation Notes:
216 --   Any pre-processing required before the delete dml is issued should be
217 --   coded within this procedure. It is important to note that any 3rd party
218 --   maintenance should be reviewed before placing in this procedure. The call
219 --   to the dt_delete_dml procedure should NOT be removed.
220 --
221 -- Access Status:
222 --   Internal Row Handler Use Only.
223 --
224 -- {End Of Comments}
225 -- ----------------------------------------------------------------------------
226 Procedure pre_delete
227 	(p_rec 			 in out nocopy ben_clp_shd.g_rec_type,
228 	 p_effective_date	 in	date,
229 	 p_datetrack_mode	 in	varchar2,
230 	 p_validation_start_date in	date,
231 	 p_validation_end_date	 in	date) is
232 --
233   l_proc	varchar2(72) := g_package||'pre_delete';
234 --
235   --
236 --
237 Begin
238   hr_utility.set_location('Entering:'||l_proc, 5);
239   --
240   --
241   --
242   dt_pre_delete
243     (p_rec 		     => p_rec,
244      p_effective_date	     => p_effective_date,
245      p_datetrack_mode	     => p_datetrack_mode,
246      p_validation_start_date => p_validation_start_date,
247      p_validation_end_date   => p_validation_end_date);
248   --
249   hr_utility.set_location(' Leaving:'||l_proc, 10);
250 End pre_delete;
251 --
252 -- ----------------------------------------------------------------------------
253 -- |-----------------------------< post_delete >------------------------------|
254 -- ----------------------------------------------------------------------------
255 -- {Start Of Comments}
256 --
257 -- Description:
258 --   This private procedure contains any processing which is required after the
259 --   delete dml.
260 --
261 -- Prerequisites:
262 --   This is an internal procedure which is called from the del procedure.
263 --
264 -- In Parameters:
265 --   A Pl/Sql record structre.
266 --
267 -- Post Success:
268 --   Processing continues.
269 --
270 -- Post Failure:
271 --   If an error has occurred, an error message and exception will be raised
272 --   but not handled.
273 --
274 -- Developer Implementation Notes:
275 --   Any post-processing required after the delete dml is issued should be
276 --   coded within this procedure. It is important to note that any 3rd party
277 --   maintenance should be reviewed before placing in this procedure.
278 --
279 -- Access Status:
280 --   Internal Row Handler Use Only.
281 --
282 -- {End Of Comments}
283 -- ----------------------------------------------------------------------------
284 Procedure post_delete
285 	(p_rec 			 in ben_clp_shd.g_rec_type,
286 	 p_effective_date	 in date,
287 	 p_datetrack_mode	 in varchar2,
288 	 p_validation_start_date in date,
289 	 p_validation_end_date	 in date) is
290 --
291   l_proc	varchar2(72) := g_package||'post_delete';
292 --
293 Begin
294   hr_utility.set_location('Entering:'||l_proc, 5);
295   --
296   -- Start of API User Hook for post_delete.
297   --
298   begin
299     --
300     ben_clp_rkd.after_delete
301       (p_clpse_lf_evt_id                => p_rec.clpse_lf_evt_id
302       ,p_datetrack_mode                 => p_datetrack_mode
303       ,p_validation_start_date          => p_validation_start_date
304       ,p_validation_end_date            => p_validation_end_date
305       ,p_effective_start_date           => p_rec.effective_start_date
306       ,p_effective_end_date             => p_rec.effective_end_date
307       ,p_effective_start_date_o         => ben_clp_shd.g_old_rec.effective_start_date
308       ,p_effective_end_date_o           => ben_clp_shd.g_old_rec.effective_end_date
309       ,p_business_group_id_o            => ben_clp_shd.g_old_rec.business_group_id
310       ,p_seq_o                          => ben_clp_shd.g_old_rec.seq
311       ,p_ler1_id_o                      => ben_clp_shd.g_old_rec.ler1_id
312       ,p_bool1_cd_o                     => ben_clp_shd.g_old_rec.bool1_cd
313       ,p_ler2_id_o                      => ben_clp_shd.g_old_rec.ler2_id
314       ,p_bool2_cd_o                     => ben_clp_shd.g_old_rec.bool2_cd
315       ,p_ler3_id_o                      => ben_clp_shd.g_old_rec.ler3_id
316       ,p_bool3_cd_o                     => ben_clp_shd.g_old_rec.bool3_cd
317       ,p_ler4_id_o                      => ben_clp_shd.g_old_rec.ler4_id
318       ,p_bool4_cd_o                     => ben_clp_shd.g_old_rec.bool4_cd
319       ,p_ler5_id_o                      => ben_clp_shd.g_old_rec.ler5_id
320       ,p_bool5_cd_o                     => ben_clp_shd.g_old_rec.bool5_cd
321       ,p_ler6_id_o                      => ben_clp_shd.g_old_rec.ler6_id
322       ,p_bool6_cd_o                     => ben_clp_shd.g_old_rec.bool6_cd
323       ,p_ler7_id_o                      => ben_clp_shd.g_old_rec.ler7_id
324       ,p_bool7_cd_o                     => ben_clp_shd.g_old_rec.bool7_cd
325       ,p_ler8_id_o                      => ben_clp_shd.g_old_rec.ler8_id
326       ,p_bool8_cd_o                     => ben_clp_shd.g_old_rec.bool8_cd
327       ,p_ler9_id_o                      => ben_clp_shd.g_old_rec.ler9_id
328       ,p_bool9_cd_o                     => ben_clp_shd.g_old_rec.bool9_cd
329       ,p_ler10_id_o                     => ben_clp_shd.g_old_rec.ler10_id
330       ,p_eval_cd_o                      => ben_clp_shd.g_old_rec.eval_cd
331       ,p_eval_rl_o                      => ben_clp_shd.g_old_rec.eval_rl
332       ,p_tlrnc_dys_num_o                => ben_clp_shd.g_old_rec.tlrnc_dys_num
333       ,p_eval_ler_id_o                  => ben_clp_shd.g_old_rec.eval_ler_id
334       ,p_eval_ler_det_cd_o              => ben_clp_shd.g_old_rec.eval_ler_det_cd
335       ,p_eval_ler_det_rl_o              => ben_clp_shd.g_old_rec.eval_ler_det_rl
336       ,p_clp_attribute_category_o       => ben_clp_shd.g_old_rec.clp_attribute_category
337       ,p_clp_attribute1_o               => ben_clp_shd.g_old_rec.clp_attribute1
338       ,p_clp_attribute2_o               => ben_clp_shd.g_old_rec.clp_attribute2
339       ,p_clp_attribute3_o               => ben_clp_shd.g_old_rec.clp_attribute3
340       ,p_clp_attribute4_o               => ben_clp_shd.g_old_rec.clp_attribute4
341       ,p_clp_attribute5_o               => ben_clp_shd.g_old_rec.clp_attribute5
342       ,p_clp_attribute6_o               => ben_clp_shd.g_old_rec.clp_attribute6
343       ,p_clp_attribute7_o               => ben_clp_shd.g_old_rec.clp_attribute7
344       ,p_clp_attribute8_o               => ben_clp_shd.g_old_rec.clp_attribute8
345       ,p_clp_attribute9_o               => ben_clp_shd.g_old_rec.clp_attribute9
346       ,p_clp_attribute10_o              => ben_clp_shd.g_old_rec.clp_attribute10
347       ,p_clp_attribute11_o              => ben_clp_shd.g_old_rec.clp_attribute11
348       ,p_clp_attribute12_o              => ben_clp_shd.g_old_rec.clp_attribute12
349       ,p_clp_attribute13_o              => ben_clp_shd.g_old_rec.clp_attribute13
350       ,p_clp_attribute14_o              => ben_clp_shd.g_old_rec.clp_attribute14
351       ,p_clp_attribute15_o              => ben_clp_shd.g_old_rec.clp_attribute15
352       ,p_clp_attribute16_o              => ben_clp_shd.g_old_rec.clp_attribute16
353       ,p_clp_attribute17_o              => ben_clp_shd.g_old_rec.clp_attribute17
354       ,p_clp_attribute18_o              => ben_clp_shd.g_old_rec.clp_attribute18
355       ,p_clp_attribute19_o              => ben_clp_shd.g_old_rec.clp_attribute19
356       ,p_clp_attribute20_o              => ben_clp_shd.g_old_rec.clp_attribute20
357       ,p_clp_attribute21_o              => ben_clp_shd.g_old_rec.clp_attribute21
358       ,p_clp_attribute22_o              => ben_clp_shd.g_old_rec.clp_attribute22
359       ,p_clp_attribute23_o              => ben_clp_shd.g_old_rec.clp_attribute23
360       ,p_clp_attribute24_o              => ben_clp_shd.g_old_rec.clp_attribute24
361       ,p_clp_attribute25_o              => ben_clp_shd.g_old_rec.clp_attribute25
362       ,p_clp_attribute26_o              => ben_clp_shd.g_old_rec.clp_attribute26
363       ,p_clp_attribute27_o              => ben_clp_shd.g_old_rec.clp_attribute27
364       ,p_clp_attribute28_o              => ben_clp_shd.g_old_rec.clp_attribute28
365       ,p_clp_attribute29_o              => ben_clp_shd.g_old_rec.clp_attribute29
366       ,p_clp_attribute30_o              => ben_clp_shd.g_old_rec.clp_attribute30
367       ,p_object_version_number_o        => ben_clp_shd.g_old_rec.object_version_number);
368     --
369   exception
370     --
371     when hr_api.cannot_find_prog_unit then
372       --
373       hr_api.cannot_find_prog_unit_error
374         (p_module_name => 'ben_clpse_lf_evt_f'
375         ,p_hook_type   => 'AD');
376       --
377   end;
378   --
379   -- End of API User Hook for post_delete.
380   --
381   hr_utility.set_location(' Leaving:'||l_proc, 10);
382   --
383 End post_delete;
384 --
385 -- ----------------------------------------------------------------------------
386 -- |---------------------------------< del >----------------------------------|
387 -- ----------------------------------------------------------------------------
388 Procedure del
389   (
390   p_rec			in out nocopy 	ben_clp_shd.g_rec_type,
391   p_effective_date	in 	date,
392   p_datetrack_mode	in 	varchar2
393   ) is
394 --
395   l_proc			varchar2(72) := g_package||'del';
396   l_validation_start_date	date;
397   l_validation_end_date		date;
398 --
399 Begin
400   hr_utility.set_location('Entering:'||l_proc, 5);
401   --
402   -- Ensure that the DateTrack delete mode is valid
403   --
404   dt_api.validate_dt_del_mode(p_datetrack_mode => p_datetrack_mode);
405   --
406   -- We must lock the row which we need to delete.
407   --
408   ben_clp_shd.lck
409 	(p_effective_date	 => p_effective_date,
410       	 p_datetrack_mode	 => p_datetrack_mode,
411       	 p_clpse_lf_evt_id	 => p_rec.clpse_lf_evt_id,
412       	 p_object_version_number => p_rec.object_version_number,
413       	 p_validation_start_date => l_validation_start_date,
414       	 p_validation_end_date	 => l_validation_end_date);
415   --
416   -- Call the supporting delete validate operation
417   --
418   ben_clp_bus.delete_validate
419 	(p_rec			 => p_rec,
420 	 p_effective_date	 => p_effective_date,
421 	 p_datetrack_mode	 => p_datetrack_mode,
422 	 p_validation_start_date => l_validation_start_date,
423 	 p_validation_end_date	 => l_validation_end_date);
424   --
425   -- Call the supporting pre-delete operation
426   --
427   pre_delete
428 	(p_rec			 => p_rec,
429 	 p_effective_date	 => p_effective_date,
430 	 p_datetrack_mode	 => p_datetrack_mode,
431 	 p_validation_start_date => l_validation_start_date,
432 	 p_validation_end_date	 => l_validation_end_date);
433   --
434   -- Delete the row.
435   --
436   delete_dml
437 	(p_rec			 => p_rec,
438 	 p_effective_date	 => p_effective_date,
439 	 p_datetrack_mode	 => p_datetrack_mode,
440 	 p_validation_start_date => l_validation_start_date,
441 	 p_validation_end_date	 => l_validation_end_date);
442   --
443   -- Call the supporting post-delete operation
444   --
445   post_delete
446 	(p_rec			 => p_rec,
447 	 p_effective_date	 => p_effective_date,
448 	 p_datetrack_mode	 => p_datetrack_mode,
449 	 p_validation_start_date => l_validation_start_date,
450 	 p_validation_end_date	 => l_validation_end_date);
451 End del;
452 --
453 -- ----------------------------------------------------------------------------
454 -- |---------------------------------< del >----------------------------------|
455 -- ----------------------------------------------------------------------------
456 Procedure del
457   (
458   p_clpse_lf_evt_id	  in 	 number,
459   p_effective_start_date     out nocopy date,
460   p_effective_end_date	     out nocopy date,
461   p_object_version_number in out nocopy number,
462   p_effective_date	  in     date,
463   p_datetrack_mode  	  in     varchar2
464   ) is
465 --
466   l_rec		ben_clp_shd.g_rec_type;
467   l_proc	varchar2(72) := g_package||'del';
468 --
469 Begin
470   hr_utility.set_location('Entering:'||l_proc, 5);
471   --
472   -- As the delete procedure accepts a plsql record structure we do need to
473   -- convert the  arguments into the record structure.
474   -- We don't need to call the supplied conversion argument routine as we
475   -- only need a few attributes.
476   --
477   l_rec.clpse_lf_evt_id		:= p_clpse_lf_evt_id;
478   l_rec.object_version_number 	:= p_object_version_number;
479   --
480   -- Having converted the arguments into the ben_clp_rec
481   -- plsql record structure we must call the corresponding entity
482   -- business process
483   --
484   del(l_rec, p_effective_date, p_datetrack_mode);
485   --
486   -- Set the out arguments
487   --
488   p_object_version_number := l_rec.object_version_number;
489   p_effective_start_date  := l_rec.effective_start_date;
490   p_effective_end_date    := l_rec.effective_end_date;
491   --
492   hr_utility.set_location(' Leaving:'||l_proc, 10);
493 End del;
494 --
495 end ben_clp_del;