1 Package Body ben_xel_del as
2 /* $Header: bexelrhi.pkb 120.1 2005/06/08 13:15:34 tjesumic noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- | Private Global Definitions |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package varchar2(33) := ' ben_xel_del.'; -- Global package name
9 --
10 --
11 -- ----------------------------------------------------------------------------
12 -- ----------------------< delete_app_ownerships >----------------------------|
13 -- ----------------------------------------------------------------------------
14 --
15 -- Description:
16 -- Deletes row(s) from hr_application_ownerships depending on the mode that
17 -- the row handler has been called in.
18 --
19 -- ----------------------------------------------------------------------------
20 PROCEDURE delete_app_ownerships(p_pk_column IN varchar2
21 ,p_pk_value IN varchar2) IS
22 --
23 BEGIN
24 --
25 IF (hr_startup_data_api_support.return_startup_mode
26 IN ('STARTUP','GENERIC')) THEN
27 --
28 DELETE FROM hr_application_ownerships
29 WHERE key_name = p_pk_column
30 AND key_value = p_pk_value;
31 --
32 END IF;
33 END delete_app_ownerships;
34 --
35 -- ----------------------------------------------------------------------------
36 -- ----------------------< delete_app_ownerships >----------------------------|
37 -- ----------------------------------------------------------------------------
38 PROCEDURE delete_app_ownerships(p_pk_column IN varchar2
39 ,p_pk_value IN number) IS
40 --
41 BEGIN
42 delete_app_ownerships(p_pk_column, to_char(p_pk_value));
43 END delete_app_ownerships;
44 --
45 -- ----------------------------------------------------------------------------
46 -- |------------------------------< delete_dml >------------------------------|
47 -- ----------------------------------------------------------------------------
48 -- {Start Of Comments}
49 --
50 -- Description:
51 -- This procedure controls the actual dml delete logic. The functions of
52 -- this procedure are as follows:
53 -- 1) To set and unset the g_api_dml status as required (as we are about to
54 -- perform dml).
55 -- 2) To delete the specified row from the schema using the primary key in
56 -- the predicates.
57 -- 3) To trap any constraint violations that may have occurred.
58 -- 4) To raise any other errors.
59 --
60 -- Prerequisites:
61 -- This is an internal private procedure which must be called from the del
62 -- procedure.
63 --
64 -- In Parameters:
65 -- A Pl/Sql record structre.
66 --
67 -- Post Success:
68 -- The specified row will be delete from the schema.
69 --
70 -- Post Failure:
71 -- On the delete dml failure it is important to note that we always reset the
72 -- g_api_dml status to false.
73 -- If a child integrity constraint violation is raised the
74 -- constraint_error procedure will be called.
75 -- If any other error is reported, the error will be raised after the
76 -- g_api_dml status is reset.
77 --
78 -- Developer Implementation Notes:
79 -- None.
80 --
81 -- Access Status:
82 -- Internal Row Handler Use Only.
83 --
84 -- {End Of Comments}
85 -- ----------------------------------------------------------------------------
86 Procedure delete_dml(p_rec in ben_xel_shd.g_rec_type) is
87 --
88 l_proc varchar2(72) := g_package||'delete_dml';
89 --
90 Begin
91 hr_utility.set_location('Entering:'||l_proc, 5);
92 --
93 ben_xel_shd.g_api_dml := true; -- Set the api dml status
94 --
95 -- Delete the ben_ext_data_elmt row.
96 --
97 delete from ben_ext_data_elmt
98 where ext_data_elmt_id = p_rec.ext_data_elmt_id;
99 --
100 ben_xel_shd.g_api_dml := false; -- Unset the api dml status
101 --
102 hr_utility.set_location(' Leaving:'||l_proc, 10);
103 --
104 Exception
105 When hr_api.child_integrity_violated then
106 -- Child integrity has been violated
107 ben_xel_shd.g_api_dml := false; -- Unset the api dml status
108 ben_xel_shd.constraint_error
109 (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
110 When Others Then
111 ben_xel_shd.g_api_dml := false; -- Unset the api dml status
112 Raise;
113 End delete_dml;
114 --
115 -- ----------------------------------------------------------------------------
116 -- |------------------------------< pre_delete >------------------------------|
117 -- ----------------------------------------------------------------------------
118 -- {Start Of Comments}
119 --
120 -- Description:
121 -- This private procedure contains any processing which is required before
122 -- the delete dml.
123 --
124 -- Prerequisites:
125 -- This is an internal procedure which is called from the del procedure.
126 --
127 -- In Parameters:
128 -- A Pl/Sql record structre.
129 --
130 -- Post Success:
131 -- Processing continues.
132 --
133 -- Post Failure:
134 -- If an error has occurred, an error message and exception will be raised
135 -- but not handled.
136 --
137 -- Developer Implementation Notes:
138 -- Any pre-processing required before the delete dml is issued should be
139 -- coded within this procedure. It is important to note that any 3rd party
140 -- maintenance should be reviewed before placing in this procedure.
141 --
142 -- Access Status:
143 -- Internal Row Handler Use Only.
144 --
145 -- {End Of Comments}
146 -- ----------------------------------------------------------------------------
147 Procedure pre_delete(p_rec in ben_xel_shd.g_rec_type) is
148 --
149 l_proc varchar2(72) := g_package||'pre_delete';
150 --
151 Begin
152 hr_utility.set_location('Entering:'||l_proc, 5);
153 --
154 hr_utility.set_location(' Leaving:'||l_proc, 10);
155 End pre_delete;
156 --
157 -- ----------------------------------------------------------------------------
158 -- |-----------------------------< post_delete >------------------------------|
159 -- ----------------------------------------------------------------------------
160 -- {Start Of Comments}
161 --
162 -- Description:
163 -- This private procedure contains any processing which is required after the
164 -- delete dml.
165 --
166 -- Prerequisites:
167 -- This is an internal procedure which is called from the del procedure.
168 --
169 -- In Parameters:
170 -- A Pl/Sql record structre.
171 --
172 -- Post Success:
173 -- Processing continues.
174 --
175 -- Post Failure:
176 -- If an error has occurred, an error message and exception will be raised
177 -- but not handled.
178 --
179 -- Developer Implementation Notes:
180 -- Any post-processing required after the delete dml is issued should be
181 -- coded within this procedure. It is important to note that any 3rd party
182 -- maintenance should be reviewed before placing in this procedure.
183 --
184 -- Access Status:
185 -- Internal table Handler Use Only.
186 --
187 -- {End Of Comments}
188 -- ----------------------------------------------------------------------------
189 Procedure post_delete(
190 p_effective_date in date,p_rec in ben_xel_shd.g_rec_type) is
191 --
192 l_proc varchar2(72) := g_package||'post_delete';
193 --
194 Begin
195 hr_utility.set_location('Entering:'||l_proc, 5);
196 --
197 --
198 -- Start of API User Hook for post_delete.
199 --
200 begin
201 --
202 -- Delete ownerships if applicable
203 --
204 delete_app_ownerships('EXT_DATA_ELMT_ID', p_rec.ext_data_elmt_id);
205 --
206 --
207 ben_xel_rkd.after_delete
208 (
209 p_ext_data_elmt_id =>p_rec.ext_data_elmt_id
210 ,p_name_o =>ben_xel_shd.g_old_rec.name
211 ,p_xml_tag_name_o =>ben_xel_shd.g_old_rec.name
212 ,p_data_elmt_typ_cd_o =>ben_xel_shd.g_old_rec.data_elmt_typ_cd
213 ,p_data_elmt_rl_o =>ben_xel_shd.g_old_rec.data_elmt_rl
214 ,p_frmt_mask_cd_o =>ben_xel_shd.g_old_rec.frmt_mask_cd
215 ,p_string_val_o =>ben_xel_shd.g_old_rec.string_val
216 ,p_dflt_val_o =>ben_xel_shd.g_old_rec.dflt_val
217 ,p_max_length_num_o =>ben_xel_shd.g_old_rec.max_length_num
218 ,p_just_cd_o =>ben_xel_shd.g_old_rec.just_cd
219 ,p_ttl_fnctn_cd_o =>ben_xel_shd.g_old_rec.ttl_fnctn_cd,
220 p_ttl_cond_oper_cd_o =>ben_xel_shd.g_old_rec.ttl_cond_oper_cd,
221 p_ttl_cond_val_o =>ben_xel_shd.g_old_rec.ttl_cond_val,
222 p_ttl_sum_ext_data_elmt_id_o =>ben_xel_shd.g_old_rec.ttl_sum_ext_data_elmt_id,
223 p_ttl_cond_ext_data_elmt_id_o =>ben_xel_shd.g_old_rec.ttl_cond_ext_data_elmt_id ,
224 p_ext_fld_id_o =>ben_xel_shd.g_old_rec.ext_fld_id
225 ,p_business_group_id_o =>ben_xel_shd.g_old_rec.business_group_id
226 ,p_legislation_code_o =>ben_xel_shd.g_old_rec.legislation_code
227 ,p_xel_attribute_category_o =>ben_xel_shd.g_old_rec.xel_attribute_category
228 ,p_xel_attribute1_o =>ben_xel_shd.g_old_rec.xel_attribute1
229 ,p_xel_attribute2_o =>ben_xel_shd.g_old_rec.xel_attribute2
230 ,p_xel_attribute3_o =>ben_xel_shd.g_old_rec.xel_attribute3
231 ,p_xel_attribute4_o =>ben_xel_shd.g_old_rec.xel_attribute4
232 ,p_xel_attribute5_o =>ben_xel_shd.g_old_rec.xel_attribute5
233 ,p_xel_attribute6_o =>ben_xel_shd.g_old_rec.xel_attribute6
234 ,p_xel_attribute7_o =>ben_xel_shd.g_old_rec.xel_attribute7
235 ,p_xel_attribute8_o =>ben_xel_shd.g_old_rec.xel_attribute8
236 ,p_xel_attribute9_o =>ben_xel_shd.g_old_rec.xel_attribute9
237 ,p_xel_attribute10_o =>ben_xel_shd.g_old_rec.xel_attribute10
238 ,p_xel_attribute11_o =>ben_xel_shd.g_old_rec.xel_attribute11
239 ,p_xel_attribute12_o =>ben_xel_shd.g_old_rec.xel_attribute12
240 ,p_xel_attribute13_o =>ben_xel_shd.g_old_rec.xel_attribute13
241 ,p_xel_attribute14_o =>ben_xel_shd.g_old_rec.xel_attribute14
242 ,p_xel_attribute15_o =>ben_xel_shd.g_old_rec.xel_attribute15
243 ,p_xel_attribute16_o =>ben_xel_shd.g_old_rec.xel_attribute16
244 ,p_xel_attribute17_o =>ben_xel_shd.g_old_rec.xel_attribute17
245 ,p_xel_attribute18_o =>ben_xel_shd.g_old_rec.xel_attribute18
246 ,p_xel_attribute19_o =>ben_xel_shd.g_old_rec.xel_attribute19
247 ,p_xel_attribute20_o =>ben_xel_shd.g_old_rec.xel_attribute20
248 ,p_xel_attribute21_o =>ben_xel_shd.g_old_rec.xel_attribute21
249 ,p_xel_attribute22_o =>ben_xel_shd.g_old_rec.xel_attribute22
250 ,p_xel_attribute23_o =>ben_xel_shd.g_old_rec.xel_attribute23
251 ,p_xel_attribute24_o =>ben_xel_shd.g_old_rec.xel_attribute24
252 ,p_xel_attribute25_o =>ben_xel_shd.g_old_rec.xel_attribute25
253 ,p_xel_attribute26_o =>ben_xel_shd.g_old_rec.xel_attribute26
254 ,p_xel_attribute27_o =>ben_xel_shd.g_old_rec.xel_attribute27
255 ,p_xel_attribute28_o =>ben_xel_shd.g_old_rec.xel_attribute28
256 ,p_xel_attribute29_o =>ben_xel_shd.g_old_rec.xel_attribute29
257 ,p_xel_attribute30_o =>ben_xel_shd.g_old_rec.xel_attribute30
258 ,p_defined_balance_id_o =>ben_xel_shd.g_old_rec.defined_balance_id
259 ,p_object_version_number_o =>ben_xel_shd.g_old_rec.object_version_number
260 );
261 --
262 exception
263 --
264 when hr_api.cannot_find_prog_unit then
265 --
266 hr_api.cannot_find_prog_unit_error
267 (p_module_name => 'ben_ext_data_elmt'
268 ,p_hook_type => 'AD');
269 --
270 end;
271 --
272 -- End of API User Hook for post_delete.
273 --
274 --
275 hr_utility.set_location(' Leaving:'||l_proc, 10);
276 End post_delete;
277 --
278 -- ----------------------------------------------------------------------------
279 -- |---------------------------------< del >----------------------------------|
280 -- ----------------------------------------------------------------------------
281 Procedure del
282 (
283 p_effective_date in date,
284 p_rec in ben_xel_shd.g_rec_type
285 ) is
286 --
287 l_proc varchar2(72) := g_package||'del';
288 --
289 Begin
290 hr_utility.set_location('Entering:'||l_proc, 5);
291 --
292 -- We must lock the row which we need to delete.
293 --
294 ben_xel_shd.lck
295 (
296 p_rec.ext_data_elmt_id,
297 p_rec.object_version_number
298 );
299 --
300 -- Call the supporting delete validate operation
301 --
302 ben_xel_bus.delete_validate(p_rec
303 ,p_effective_date);
304 --
305 -- Call the supporting pre-delete operation
306 --
307 pre_delete(p_rec);
308 --
309 -- Delete the row.
310 --
311 delete_dml(p_rec);
312 --
313 -- Call the supporting post-delete operation
314 --
315 post_delete(
316 p_effective_date,p_rec);
317 End del;
318 --
319 -- ----------------------------------------------------------------------------
320 -- |---------------------------------< del >----------------------------------|
321 -- ----------------------------------------------------------------------------
322 Procedure del
323 (
324 p_effective_date in date,
325 p_ext_data_elmt_id in number,
326 p_legislation_code in varchar2 default null,
327 p_object_version_number in number
328 ) is
329 --
330 l_rec ben_xel_shd.g_rec_type;
331 l_proc varchar2(72) := g_package||'del';
332 --
333 Begin
334 hr_utility.set_location('Entering:'||l_proc, 5);
335 --
336 -- As the delete procedure accepts a plsql record structure we do need to
337 -- convert the arguments into the record structure.
338 -- We don't need to call the supplied conversion argument routine as we
339 -- only need a few attributes.
340 --
341 l_rec.ext_data_elmt_id:= p_ext_data_elmt_id;
342 l_rec.legislation_code := p_legislation_code;
343 l_rec.object_version_number := p_object_version_number;
344 --
345 -- Having converted the arguments into the ben_xel_rec
346 -- plsql record structure we must call the corresponding entity
347 -- business process
348 --
349 del(
350 p_effective_date,l_rec);
351 --
352 hr_utility.set_location(' Leaving:'||l_proc, 10);
353 End del;
354 --
355 end ben_xel_del;