1 Package Body per_bba_del as
2 /* $Header: pebbarhi.pkb 115.8 2002/12/02 13:03:45 apholt noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- | Private Global Definitions |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package varchar2(33) := ' per_bba_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 per_bba_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 --
59 -- Delete the per_bf_balance_amounts row.
60 --
61 delete from per_bf_balance_amounts
62 where balance_amount_id = p_rec.balance_amount_id;
63 --
64 --
65 hr_utility.set_location(' Leaving:'||l_proc, 10);
66 --
67 Exception
68 When hr_api.child_integrity_violated then
69 -- Child integrity has been violated
70 per_bba_shd.constraint_error
71 (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
72 When Others Then
73 Raise;
74 End delete_dml;
75 --
76 -- ----------------------------------------------------------------------------
77 -- |------------------------------< pre_delete >------------------------------|
78 -- ----------------------------------------------------------------------------
79 -- {Start Of Comments}
80 --
81 -- Description:
82 -- This private procedure contains any processing which is required before
83 -- the delete dml.
84 --
85 -- Prerequisites:
86 -- This is an internal procedure which is called from the del procedure.
87 --
88 -- In Parameters:
89 -- A Pl/Sql record structre.
90 --
91 -- Post Success:
92 -- Processing continues.
93 --
94 -- Post Failure:
95 -- If an error has occurred, an error message and exception will be raised
96 -- but not handled.
97 --
98 -- Developer Implementation Notes:
99 -- Any pre-processing required before the delete dml is issued should be
100 -- coded within this procedure. It is important to note that any 3rd party
101 -- maintenance should be reviewed before placing in this procedure.
102 --
103 -- Access Status:
104 -- Internal Row Handler Use Only.
105 --
106 -- {End Of Comments}
107 -- ----------------------------------------------------------------------------
108 Procedure pre_delete(p_rec in per_bba_shd.g_rec_type) is
109 --
110 l_proc varchar2(72) := g_package||'pre_delete';
111 --
112 Begin
113 hr_utility.set_location('Entering:'||l_proc, 5);
114 --
115 hr_utility.set_location(' Leaving:'||l_proc, 10);
116 End pre_delete;
117 --
118 -- ----------------------------------------------------------------------------
119 -- |-----------------------------< post_delete >------------------------------|
120 -- ----------------------------------------------------------------------------
121 -- {Start Of Comments}
122 --
123 -- Description:
124 -- This private procedure contains any processing which is required after the
125 -- delete dml.
126 --
127 -- Prerequistes:
128 -- This is an internal procedure which is called from the del procedure.
129 --
130 -- In Parameters:
131 -- A Pl/Sql record structure.
132 --
133 -- Post Success:
134 -- Processing continues.
135 --
136 -- Post Failure:
137 -- If an error has occurred, an error message and exception will be raised
138 -- but not handled.
139 --
140 -- Developer Implementation Notes:
141 -- Any post-processing required after the delete dml is issued should be
142 -- coded within this procedure. It is important to note that any 3rd party
143 -- maintenance should be reviewed before placing in this procedure.
144 --
145 -- Access Status:
146 -- Internal Row Handler Use Only.
147 --
148 -- {End Of Comments}
149 -- -----------------------------------------------------------------------------
150 Procedure post_delete(p_rec in per_bba_shd.g_rec_type) is
151 --
152 l_proc varchar2(72) := g_package||'post_delete';
153 --
154 Begin
155 hr_utility.set_location('Entering:'||l_proc, 5);
156 begin
157 --
158 per_bba_rkd.after_delete
159 (
160 p_balance_amount_id
161 => p_rec.balance_amount_id,
162 p_balance_type_id_o
163 => per_bba_shd.g_old_rec.balance_type_id,
164 p_processed_assignment_id_o
165 => per_bba_shd.g_old_rec.processed_assignment_id,
166 p_business_group_id_o
167 => per_bba_shd.g_old_rec.business_group_id,
168 p_ytd_amount_o
169 => per_bba_shd.g_old_rec.ytd_amount,
170 p_fytd_amount_o
171 => per_bba_shd.g_old_rec.fytd_amount,
172 p_ptd_amount_o
173 => per_bba_shd.g_old_rec.ptd_amount,
174 p_mtd_amount_o
175 => per_bba_shd.g_old_rec.mtd_amount,
176 p_qtd_amount_o
177 => per_bba_shd.g_old_rec.qtd_amount,
178 p_run_amount_o
179 => per_bba_shd.g_old_rec.run_amount,
180 p_object_version_number_o
181 => per_bba_shd.g_old_rec.object_version_number,
182 p_bba_attribute_category_o
183 => per_bba_shd.g_old_rec.bba_attribute_category,
184 p_bba_attribute1_o
185 => per_bba_shd.g_old_rec.bba_attribute1,
186 p_bba_attribute2_o
187 => per_bba_shd.g_old_rec.bba_attribute2,
188 p_bba_attribute3_o
189 => per_bba_shd.g_old_rec.bba_attribute3,
190 p_bba_attribute4_o
191 => per_bba_shd.g_old_rec.bba_attribute4,
192 p_bba_attribute5_o
193 => per_bba_shd.g_old_rec.bba_attribute5,
194 p_bba_attribute6_o
195 => per_bba_shd.g_old_rec.bba_attribute6,
196 p_bba_attribute7_o
197 => per_bba_shd.g_old_rec.bba_attribute7,
198 p_bba_attribute8_o
199 => per_bba_shd.g_old_rec.bba_attribute8,
200 p_bba_attribute9_o
201 => per_bba_shd.g_old_rec.bba_attribute9,
202 p_bba_attribute10_o
203 => per_bba_shd.g_old_rec.bba_attribute10,
204 p_bba_attribute11_o
205 => per_bba_shd.g_old_rec.bba_attribute11,
206 p_bba_attribute12_o
207 => per_bba_shd.g_old_rec.bba_attribute12,
208 p_bba_attribute13_o
209 => per_bba_shd.g_old_rec.bba_attribute13,
210 p_bba_attribute14_o
211 => per_bba_shd.g_old_rec.bba_attribute14,
212 p_bba_attribute15_o
213 => per_bba_shd.g_old_rec.bba_attribute15,
214 p_bba_attribute16_o
215 => per_bba_shd.g_old_rec.bba_attribute16,
216 p_bba_attribute17_o
217 => per_bba_shd.g_old_rec.bba_attribute17,
218 p_bba_attribute18_o
219 => per_bba_shd.g_old_rec.bba_attribute18,
220 p_bba_attribute19_o
221 => per_bba_shd.g_old_rec.bba_attribute19,
222 p_bba_attribute20_o
223 => per_bba_shd.g_old_rec.bba_attribute20,
224 p_bba_attribute21_o
225 => per_bba_shd.g_old_rec.bba_attribute21,
226 p_bba_attribute22_o
227 => per_bba_shd.g_old_rec.bba_attribute22,
228 p_bba_attribute23_o
229 => per_bba_shd.g_old_rec.bba_attribute23,
230 p_bba_attribute24_o
231 => per_bba_shd.g_old_rec.bba_attribute24,
232 p_bba_attribute25_o
233 => per_bba_shd.g_old_rec.bba_attribute25,
234 p_bba_attribute26_o
235 => per_bba_shd.g_old_rec.bba_attribute26,
236 p_bba_attribute27_o
237 => per_bba_shd.g_old_rec.bba_attribute27,
238 p_bba_attribute28_o
239 => per_bba_shd.g_old_rec.bba_attribute28,
240 p_bba_attribute29_o
241 => per_bba_shd.g_old_rec.bba_attribute29,
242 p_bba_attribute30_o
243 => per_bba_shd.g_old_rec.bba_attribute30
244 );
245 --
246 exception
247 --
248 when hr_api.cannot_find_prog_unit then
249 --
250 hr_api.cannot_find_prog_unit_error
251 (p_module_name => 'PER_BF_BALANCE_AMOUNTS'
252 ,p_hook_type => 'AD');
253 --
254 end;
255 --
256 hr_utility.set_location(' Leaving:'||l_proc, 10);
257 End post_delete;
258 --
259 -- ----------------------------------------------------------------------------
260 -- |---------------------------------< del >----------------------------------|
261 -- ----------------------------------------------------------------------------
262 Procedure del
263 (
264 p_rec in per_bba_shd.g_rec_type
265 ) is
266 --
267 l_proc varchar2(72) := g_package||'del';
268 --
269 Begin
270 hr_utility.set_location('Entering:'||l_proc, 5);
271 --
272 -- We must lock the row which we need to delete.
273 --
274 per_bba_shd.lck
275 (
276 p_rec.balance_amount_id,
277 p_rec.object_version_number
278 );
279 --
280 -- Call the supporting delete validate operation
281 --
282 per_bba_bus.delete_validate(p_rec);
283 --
284 -- Call the supporting pre-delete operation
285 --
286 pre_delete(p_rec);
287 --
288 -- Delete the row.
289 --
290 delete_dml(p_rec);
291 --
292 -- Call the supporting post-delete operation
293 --
294 post_delete(p_rec);
295 End del;
296 --
297 -- ----------------------------------------------------------------------------
298 -- |---------------------------------< del >----------------------------------|
299 -- ----------------------------------------------------------------------------
300 Procedure del
301 (
302 p_balance_amount_id in number,
303 p_object_version_number in number
304 ) is
305 --
306 l_rec per_bba_shd.g_rec_type;
307 l_proc varchar2(72) := g_package||'del';
308 --
309 Begin
310 hr_utility.set_location('Entering:'||l_proc, 5);
311 --
312 -- As the delete procedure accepts a plsql record structure we do need to
313 -- convert the arguments into the record structure.
314 -- We don't need to call the supplied conversion argument routine as we
315 -- only need a few attributes.
316 --
317 l_rec.balance_amount_id := p_balance_amount_id;
318 l_rec.object_version_number := p_object_version_number;
319 --
320 -- Having converted the arguments into the per_bba_rec
321 -- plsql record structure we must call the corresponding entity
322 -- business process
323 --
324 del(l_rec);
325 --
326 hr_utility.set_location(' Leaving:'||l_proc, 10);
327 End del;
328 --
329 end per_bba_del;