1 Package Body ben_xer_del as
2 /* $Header: bexerrhi.pkb 120.1 2006/03/22 13:57:32 tjesumic noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- | Private Global Definitions |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package varchar2(33) := ' ben_xer_del.'; -- Global package name
9 --
10 -- ----------------------------------------------------------------------------
11 -- ----------------------< delete_app_ownerships >----------------------------|
12 -- ----------------------------------------------------------------------------
13 --
14 -- Description:
15 -- Deletes row(s) from hr_application_ownerships depending on the mode that
16 -- the row handler has been called in.
17 --
18 -- ----------------------------------------------------------------------------
19 PROCEDURE delete_app_ownerships(p_pk_column IN varchar2
20 ,p_pk_value IN varchar2) IS
21 --
22 BEGIN
23 --
24 IF (hr_startup_data_api_support.return_startup_mode
25 IN ('STARTUP','GENERIC')) THEN
26 --
27 DELETE FROM hr_application_ownerships
28 WHERE key_name = p_pk_column
29 AND key_value = p_pk_value;
30 --
31 END IF;
32 END delete_app_ownerships;
33 --
34 -- ----------------------------------------------------------------------------
35 -- ----------------------< delete_app_ownerships >----------------------------|
36 -- ----------------------------------------------------------------------------
37 PROCEDURE delete_app_ownerships(p_pk_column IN varchar2
38 ,p_pk_value IN number) IS
39 --
40 BEGIN
41 delete_app_ownerships(p_pk_column, to_char(p_pk_value));
42 END delete_app_ownerships;
43 --
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_xer_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_xer_shd.g_api_dml := true; -- Set the api dml status
94 --
95 -- Delete the ben_ext_data_elmt_in_rcd row.
96 --
97 delete from ben_ext_data_elmt_in_rcd
98 where ext_data_elmt_in_rcd_id = p_rec.ext_data_elmt_in_rcd_id;
99 --
100 ben_xer_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_xer_shd.g_api_dml := false; -- Unset the api dml status
108 ben_xer_shd.constraint_error
109 (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
110 When Others Then
111 ben_xer_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_xer_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_xer_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_IN_RCD_ID', p_rec.ext_data_elmt_in_rcd_id);
205 --
206 --
207 ben_xer_rkd.after_delete
208 (
209 p_ext_data_elmt_in_rcd_id =>p_rec.ext_data_elmt_in_rcd_id
210 ,p_seq_num_o =>ben_xer_shd.g_old_rec.seq_num
211 ,p_strt_pos_o =>ben_xer_shd.g_old_rec.strt_pos
212 ,p_dlmtr_val_o =>ben_xer_shd.g_old_rec.dlmtr_val
213 ,p_rqd_flag_o =>ben_xer_shd.g_old_rec.rqd_flag
214 ,p_sprs_cd_o =>ben_xer_shd.g_old_rec.sprs_cd
215 ,p_any_or_all_cd_o =>ben_xer_shd.g_old_rec.any_or_all_cd
216 ,p_ext_data_elmt_id_o =>ben_xer_shd.g_old_rec.ext_data_elmt_id
217 ,p_ext_rcd_id_o =>ben_xer_shd.g_old_rec.ext_rcd_id
218 ,p_business_group_id_o =>ben_xer_shd.g_old_rec.business_group_id
219 ,p_legislation_code_o =>ben_xer_shd.g_old_rec.legislation_code
220 ,p_object_version_number_o =>ben_xer_shd.g_old_rec.object_version_number
221 ,p_hide_flag_o =>ben_xer_shd.g_old_rec.hide_flag
222 );
223 --
224 exception
225 --
226 when hr_api.cannot_find_prog_unit then
227 --
228 hr_api.cannot_find_prog_unit_error
229 (p_module_name => 'ben_ext_data_elmt_in_rcd'
230 ,p_hook_type => 'AD');
231 --
232 end;
233 --
234 -- End of API User Hook for post_delete.
235 --
236 --
237 hr_utility.set_location(' Leaving:'||l_proc, 10);
238 End post_delete;
239 --
240 -- ----------------------------------------------------------------------------
241 -- |---------------------------------< del >----------------------------------|
242 -- ----------------------------------------------------------------------------
243 Procedure del
244 (
245 p_effective_date in date,
246 p_rec in ben_xer_shd.g_rec_type
247 ) is
248 --
249 l_proc varchar2(72) := g_package||'del';
250 --
251 Begin
252 hr_utility.set_location('Entering:'||l_proc, 5);
253 --
254 -- We must lock the row which we need to delete.
255 --
256 ben_xer_shd.lck
257 (
258 p_rec.ext_data_elmt_in_rcd_id,
259 p_rec.object_version_number
260 );
261 --
262 -- Call the supporting delete validate operation
263 --
264 ben_xer_bus.delete_validate(p_rec
265 ,p_effective_date);
266 --
267 -- Call the supporting pre-delete operation
268 --
269 pre_delete(p_rec);
270 --
271 -- Delete the row.
272 --
273 delete_dml(p_rec);
274 --
275 -- Call the supporting post-delete operation
276 --
277 post_delete(
278 p_effective_date,p_rec);
279 End del;
280 --
281 -- ----------------------------------------------------------------------------
282 -- |---------------------------------< del >----------------------------------|
283 -- ----------------------------------------------------------------------------
284 Procedure del
285 (
286 p_effective_date in date,
287 p_ext_data_elmt_in_rcd_id in number,
288 p_legislation_code in varchar2 default null,
289 p_object_version_number in number
290 ) is
291 --
292 l_rec ben_xer_shd.g_rec_type;
293 l_proc varchar2(72) := g_package||'del';
294 --
295 Begin
296 hr_utility.set_location('Entering:'||l_proc, 5);
297 --
298 -- As the delete procedure accepts a plsql record structure we do need to
299 -- convert the arguments into the record structure.
300 -- We don't need to call the supplied conversion argument routine as we
301 -- only need a few attributes.
302 --
303 l_rec.ext_data_elmt_in_rcd_id:= p_ext_data_elmt_in_rcd_id;
304 l_rec.legislation_code := p_legislation_code;
305 l_rec.object_version_number := p_object_version_number;
306 --
307 -- Having converted the arguments into the ben_xer_rec
308 -- plsql record structure we must call the corresponding entity
309 -- business process
310 --
311 del(
312 p_effective_date,l_rec);
313 --
314 hr_utility.set_location(' Leaving:'||l_proc, 10);
315 End del;
316 --
317 end ben_xer_del;