1 Package Body ben_bft_del as
2 /* $Header: bebftrhi.pkb 115.23 2003/08/18 05:05:29 rpgupta ship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- | Private Global Definitions |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package varchar2(33) := ' ben_bft_del.'; -- Global package name
9 --
10 -- ----------------------------------------------------------------------------
11 -- |------------------------------< delete_dml >------------------------------|
12 -- ----------------------------------------------------------------------------
13 -- {Start Of Comments}
14 --
15 -- Description:
16 -- This procedure controls the actual dml delete logic. The functions of
17 -- this procedure are as follows:
18 -- 1) To set and unset the g_api_dml status as required (as we are about to
19 -- perform dml).
20 -- 2) To delete the specified row from the schema using the primary key in
21 -- the predicates.
22 -- 3) To trap any constraint violations that may have occurred.
23 -- 4) To raise any other errors.
24 --
25 -- Prerequisites:
26 -- This is an internal private procedure which must be called from the del
27 -- procedure.
28 --
29 -- In Parameters:
30 -- A Pl/Sql record structre.
31 --
32 -- Post Success:
33 -- The specified row will be delete from the schema.
34 --
35 -- Post Failure:
36 -- On the delete dml failure it is important to note that we always reset the
37 -- g_api_dml status to false.
38 -- If a child integrity constraint violation is raised the
39 -- constraint_error procedure will be called.
40 -- If any other error is reported, the error will be raised after the
41 -- g_api_dml status is reset.
42 --
43 -- Developer Implementation Notes:
44 -- None.
45 --
46 -- Access Status:
47 -- Internal Row Handler Use Only.
48 --
49 -- {End Of Comments}
50 -- ----------------------------------------------------------------------------
51 Procedure delete_dml(p_rec in ben_bft_shd.g_rec_type) is
52 --
53 l_proc varchar2(72) := g_package||'delete_dml';
54 --
55 Begin
56 hr_utility.set_location('Entering:'||l_proc, 5);
57 --
58 ben_bft_shd.g_api_dml := true; -- Set the api dml status
59 --
60 -- Delete the ben_benefit_actions row.
61 --
62 delete from ben_benefit_actions
63 where benefit_action_id = p_rec.benefit_action_id;
64 --
65 ben_bft_shd.g_api_dml := false; -- Unset the api dml status
66 --
67 hr_utility.set_location(' Leaving:'||l_proc, 10);
68 --
69 Exception
70 When hr_api.child_integrity_violated then
71 -- Child integrity has been violated
72 ben_bft_shd.g_api_dml := false; -- Unset the api dml status
73 ben_bft_shd.constraint_error
74 (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
75 When Others Then
76 ben_bft_shd.g_api_dml := false; -- Unset the api dml status
77 Raise;
78 End delete_dml;
79 --
80 -- ----------------------------------------------------------------------------
81 -- |------------------------------< pre_delete >------------------------------|
82 -- ----------------------------------------------------------------------------
83 -- {Start Of Comments}
84 --
85 -- Description:
86 -- This private procedure contains any processing which is required before
87 -- the delete dml.
88 --
89 -- Prerequisites:
90 -- This is an internal procedure which is called from the del procedure.
91 --
92 -- In Parameters:
93 -- A Pl/Sql record structre.
94 --
95 -- Post Success:
96 -- Processing continues.
97 --
98 -- Post Failure:
99 -- If an error has occurred, an error message and exception will be raised
100 -- but not handled.
101 --
102 -- Developer Implementation Notes:
103 -- Any pre-processing required before the delete dml is issued should be
104 -- coded within this procedure. It is important to note that any 3rd party
105 -- maintenance should be reviewed before placing in this procedure.
106 --
107 -- Access Status:
108 -- Internal Row Handler Use Only.
109 --
110 -- {End Of Comments}
111 -- ----------------------------------------------------------------------------
112 Procedure pre_delete(p_rec in ben_bft_shd.g_rec_type) is
113 --
114 l_proc varchar2(72) := g_package||'pre_delete';
115 --
116 Begin
117 hr_utility.set_location('Entering:'||l_proc, 5);
118 --
119 hr_utility.set_location(' Leaving:'||l_proc, 10);
120 End pre_delete;
121 --
122 -- ----------------------------------------------------------------------------
123 -- |-----------------------------< post_delete >------------------------------|
124 -- ----------------------------------------------------------------------------
125 -- {Start Of Comments}
126 --
127 -- Description:
128 -- This private procedure contains any processing which is required after the
129 -- delete dml.
130 --
131 -- Prerequisites:
132 -- This is an internal procedure which is called from the del procedure.
133 --
134 -- In Parameters:
135 -- A Pl/Sql record structre.
136 --
137 -- Post Success:
138 -- Processing continues.
139 --
140 -- Post Failure:
141 -- If an error has occurred, an error message and exception will be raised
142 -- but not handled.
143 --
144 -- Developer Implementation Notes:
145 -- Any post-processing required after the delete dml is issued should be
146 -- coded within this procedure. It is important to note that any 3rd party
147 -- maintenance should be reviewed before placing in this procedure.
148 --
149 -- Access Status:
150 -- Internal table Handler Use Only.
151 --
152 -- {End Of Comments}
153 -- ----------------------------------------------------------------------------
154 Procedure post_delete(p_effective_date in date,
155 p_rec in ben_bft_shd.g_rec_type) is
156 --
157 l_proc varchar2(72) := g_package||'post_delete';
158 --
159 Begin
160 hr_utility.set_location('Entering:'||l_proc, 5);
161 --
162 --
163 -- Start of API User Hook for post_delete.
164 --
165 begin
166 --
167 ben_bft_rkd.after_delete
168 (
169 p_benefit_action_id =>p_rec.benefit_action_id
170 ,p_process_date_o =>ben_bft_shd.g_old_rec.process_date
171 ,p_uneai_effective_date_o =>ben_bft_shd.g_old_rec.uneai_effective_date
172 ,p_mode_cd_o =>ben_bft_shd.g_old_rec.mode_cd
173 ,p_derivable_factors_flag_o =>ben_bft_shd.g_old_rec.derivable_factors_flag
174 ,p_close_uneai_flag_o =>ben_bft_shd.g_old_rec.close_uneai_flag
175 ,p_validate_flag_o =>ben_bft_shd.g_old_rec.validate_flag
176 ,p_person_id_o =>ben_bft_shd.g_old_rec.person_id
177 ,p_person_type_id_o =>ben_bft_shd.g_old_rec.person_type_id
178 ,p_pgm_id_o =>ben_bft_shd.g_old_rec.pgm_id
179 ,p_business_group_id_o =>ben_bft_shd.g_old_rec.business_group_id
180 ,p_pl_id_o =>ben_bft_shd.g_old_rec.pl_id
181 ,p_popl_enrt_typ_cycl_id_o =>ben_bft_shd.g_old_rec.popl_enrt_typ_cycl_id
182 ,p_no_programs_flag_o =>ben_bft_shd.g_old_rec.no_programs_flag
183 ,p_no_plans_flag_o =>ben_bft_shd.g_old_rec.no_plans_flag
184 ,p_comp_selection_rl_o =>ben_bft_shd.g_old_rec.comp_selection_rl
185 ,p_person_selection_rl_o =>ben_bft_shd.g_old_rec.person_selection_rl
186 ,p_ler_id_o =>ben_bft_shd.g_old_rec.ler_id
187 ,p_organization_id_o =>ben_bft_shd.g_old_rec.organization_id
188 ,p_benfts_grp_id_o =>ben_bft_shd.g_old_rec.benfts_grp_id
189 ,p_location_id_o =>ben_bft_shd.g_old_rec.location_id
190 ,p_pstl_zip_rng_id_o =>ben_bft_shd.g_old_rec.pstl_zip_rng_id
191 ,p_rptg_grp_id_o =>ben_bft_shd.g_old_rec.rptg_grp_id
192 ,p_pl_typ_id_o =>ben_bft_shd.g_old_rec.pl_typ_id
193 ,p_opt_id_o =>ben_bft_shd.g_old_rec.opt_id
194 ,p_eligy_prfl_id_o =>ben_bft_shd.g_old_rec.eligy_prfl_id
195 ,p_vrbl_rt_prfl_id_o =>ben_bft_shd.g_old_rec.vrbl_rt_prfl_id
196 ,p_legal_entity_id_o =>ben_bft_shd.g_old_rec.legal_entity_id
197 ,p_payroll_id_o =>ben_bft_shd.g_old_rec.payroll_id
198 ,p_debug_messages_flag_o =>ben_bft_shd.g_old_rec.debug_messages_flag
199 ,p_cm_trgr_typ_cd_o =>ben_bft_shd.g_old_rec.cm_trgr_typ_cd
200 ,p_cm_typ_id_o =>ben_bft_shd.g_old_rec.cm_typ_id
201 ,p_age_fctr_id_o =>ben_bft_shd.g_old_rec.age_fctr_id
202 ,p_min_age_o =>ben_bft_shd.g_old_rec.min_age
203 ,p_max_age_o =>ben_bft_shd.g_old_rec.max_age
204 ,p_los_fctr_id_o =>ben_bft_shd.g_old_rec.los_fctr_id
205 ,p_min_los_o =>ben_bft_shd.g_old_rec.min_los
206 ,p_max_los_o =>ben_bft_shd.g_old_rec.max_los
207 ,p_cmbn_age_los_fctr_id_o =>ben_bft_shd.g_old_rec.cmbn_age_los_fctr_id
208 ,p_min_cmbn_o =>ben_bft_shd.g_old_rec.min_cmbn
209 ,p_max_cmbn_o =>ben_bft_shd.g_old_rec.max_cmbn
210 ,p_date_from_o =>ben_bft_shd.g_old_rec.date_from
211 ,p_elig_enrol_cd_o =>ben_bft_shd.g_old_rec.elig_enrol_cd
212 ,p_actn_typ_id_o =>ben_bft_shd.g_old_rec.actn_typ_id
213 ,p_use_fctr_to_sel_flag_o =>ben_bft_shd.g_old_rec.use_fctr_to_sel_flag
214 ,p_los_det_to_use_cd_o =>ben_bft_shd.g_old_rec.los_det_to_use_cd
215 ,p_audit_log_flag_o =>ben_bft_shd.g_old_rec.audit_log_flag
216 ,p_lmt_prpnip_by_org_flag_o =>ben_bft_shd.g_old_rec.lmt_prpnip_by_org_flag
217 ,p_lf_evt_ocrd_dt_o =>ben_bft_shd.g_old_rec.lf_evt_ocrd_dt
218 ,p_ptnl_ler_for_per_stat_cd_o =>ben_bft_shd.g_old_rec.ptnl_ler_for_per_stat_cd
219 ,p_bft_attribute_category_o =>ben_bft_shd.g_old_rec.bft_attribute_category
220 ,p_bft_attribute1_o =>ben_bft_shd.g_old_rec.bft_attribute1
221 ,p_bft_attribute3_o =>ben_bft_shd.g_old_rec.bft_attribute3
222 ,p_bft_attribute4_o =>ben_bft_shd.g_old_rec.bft_attribute4
223 ,p_bft_attribute5_o =>ben_bft_shd.g_old_rec.bft_attribute5
224 ,p_bft_attribute6_o =>ben_bft_shd.g_old_rec.bft_attribute6
225 ,p_bft_attribute7_o =>ben_bft_shd.g_old_rec.bft_attribute7
226 ,p_bft_attribute8_o =>ben_bft_shd.g_old_rec.bft_attribute8
227 ,p_bft_attribute9_o =>ben_bft_shd.g_old_rec.bft_attribute9
228 ,p_bft_attribute10_o =>ben_bft_shd.g_old_rec.bft_attribute10
229 ,p_bft_attribute11_o =>ben_bft_shd.g_old_rec.bft_attribute11
230 ,p_bft_attribute12_o =>ben_bft_shd.g_old_rec.bft_attribute12
231 ,p_bft_attribute13_o =>ben_bft_shd.g_old_rec.bft_attribute13
232 ,p_bft_attribute14_o =>ben_bft_shd.g_old_rec.bft_attribute14
233 ,p_bft_attribute15_o =>ben_bft_shd.g_old_rec.bft_attribute15
234 ,p_bft_attribute16_o =>ben_bft_shd.g_old_rec.bft_attribute16
235 ,p_bft_attribute17_o =>ben_bft_shd.g_old_rec.bft_attribute17
236 ,p_bft_attribute18_o =>ben_bft_shd.g_old_rec.bft_attribute18
237 ,p_bft_attribute19_o =>ben_bft_shd.g_old_rec.bft_attribute19
238 ,p_bft_attribute20_o =>ben_bft_shd.g_old_rec.bft_attribute20
239 ,p_bft_attribute21_o =>ben_bft_shd.g_old_rec.bft_attribute21
240 ,p_bft_attribute22_o =>ben_bft_shd.g_old_rec.bft_attribute22
241 ,p_bft_attribute23_o =>ben_bft_shd.g_old_rec.bft_attribute23
242 ,p_bft_attribute24_o =>ben_bft_shd.g_old_rec.bft_attribute24
243 ,p_bft_attribute25_o =>ben_bft_shd.g_old_rec.bft_attribute25
244 ,p_bft_attribute26_o =>ben_bft_shd.g_old_rec.bft_attribute26
245 ,p_bft_attribute27_o =>ben_bft_shd.g_old_rec.bft_attribute27
246 ,p_bft_attribute28_o =>ben_bft_shd.g_old_rec.bft_attribute28
247 ,p_bft_attribute29_o =>ben_bft_shd.g_old_rec.bft_attribute29
248 ,p_bft_attribute30_o =>ben_bft_shd.g_old_rec.bft_attribute30
249 ,p_object_version_number_o =>ben_bft_shd.g_old_rec.object_version_number
250 ,p_enrt_perd_id_o =>ben_bft_shd.g_old_rec.enrt_perd_id
251 ,p_inelg_action_cd_o =>ben_bft_shd.g_old_rec.inelg_action_cd
252 ,p_org_hierarchy_id_o =>ben_bft_shd.g_old_rec.org_hierarchy_id
253 ,p_org_starting_node_id_o =>ben_bft_shd.g_old_rec.org_starting_node_id
254 ,p_grade_ladder_id_o =>ben_bft_shd.g_old_rec.grade_ladder_id
255 ,p_asg_events_to_all_sel_dt_o =>ben_bft_shd.g_old_rec.asg_events_to_all_sel_dt
256 ,p_rate_id_o =>ben_bft_shd.g_old_rec.rate_id
257 ,p_per_sel_dt_cd_o =>ben_bft_shd.g_old_rec.per_sel_dt_cd
258 ,p_per_sel_freq_cd_o =>ben_bft_shd.g_old_rec.per_sel_freq_cd
259 ,p_per_sel_dt_from_o =>ben_bft_shd.g_old_rec.per_sel_dt_from
260 ,p_per_sel_dt_to_o =>ben_bft_shd.g_old_rec.per_sel_dt_to
261 ,p_year_from_o =>ben_bft_shd.g_old_rec.year_from
262 ,p_year_to_o =>ben_bft_shd.g_old_rec.year_to
263 ,p_cagr_id_o =>ben_bft_shd.g_old_rec.cagr_id
264 ,p_qual_type_o =>ben_bft_shd.g_old_rec.qual_type
265 ,p_qual_status_o =>ben_bft_shd.g_old_rec.qual_status
266 ,p_concat_segs_o =>ben_bft_shd.g_old_rec.concat_segs
267 ,p_grant_price_val_o =>ben_bft_shd.g_old_rec.grant_price_val
268 );
269 --
270 exception
271 --
272 when hr_api.cannot_find_prog_unit then
273 --
274 hr_api.cannot_find_prog_unit_error
275 (p_module_name => 'ben_benefit_actions'
276 ,p_hook_type => 'AD');
277 --
278 end;
279 --
280 -- End of API User Hook for post_delete.
281 --
282 --
283 hr_utility.set_location(' Leaving:'||l_proc, 10);
284 End post_delete;
285 --
286 -- ----------------------------------------------------------------------------
287 -- |---------------------------------< del >----------------------------------|
288 -- ----------------------------------------------------------------------------
289 Procedure del
290 (
291 p_effective_date in date,
292 p_rec in ben_bft_shd.g_rec_type
293 ) is
294 --
295 l_proc varchar2(72) := g_package||'del';
296 --
297 Begin
298 hr_utility.set_location('Entering:'||l_proc, 5);
299 --
300 -- We must lock the row which we need to delete.
301 --
302 ben_bft_shd.lck
303 (
304 p_rec.benefit_action_id,
305 p_rec.object_version_number
306 );
307 --
308 -- Call the supporting delete validate operation
309 --
310 ben_bft_bus.delete_validate(p_rec,p_effective_date);
311 --
312 -- Call the supporting pre-delete operation
313 --
314 pre_delete(p_rec);
315 --
316 -- Delete the row.
317 --
318 delete_dml(p_rec);
319 --
320 -- Call the supporting post-delete operation
321 --
322 post_delete(p_effective_date,p_rec);
323 End del;
324 --
325 -- ----------------------------------------------------------------------------
326 -- |---------------------------------< del >----------------------------------|
327 -- ----------------------------------------------------------------------------
328 Procedure del
329 (
330 p_effective_date in date,
331 p_benefit_action_id in number,
332 p_object_version_number in number
333 ) is
334 --
335 l_rec ben_bft_shd.g_rec_type;
336 l_proc varchar2(72) := g_package||'del';
337 --
338 Begin
339 hr_utility.set_location('Entering:'||l_proc, 5);
340 --
341 -- As the delete procedure accepts a plsql record structure we do need to
342 -- convert the arguments into the record structure.
343 -- We don't need to call the supplied conversion argument routine as we
344 -- only need a few attributes.
345 --
346 l_rec.benefit_action_id:= p_benefit_action_id;
347 l_rec.object_version_number := p_object_version_number;
348 --
349 -- Having converted the arguments into the ben_bft_rec
350 -- plsql record structure we must call the corresponding entity
351 -- business process
352 --
353 del(p_effective_date,l_rec);
354 --
355 hr_utility.set_location(' Leaving:'||l_proc, 10);
356 End del;
357 --
358 end ben_bft_del;