1 Package Body per_bpr_del as
2 /* $Header: pebprrhi.pkb 115.6 2002/12/02 14:33:23 apholt noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- | Private Global Definitions |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package varchar2(33) := ' per_bpr_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_bpr_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_payroll_runs row.
60 --
61 delete from per_bf_payroll_runs
62 where payroll_run_id = p_rec.payroll_run_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_bpr_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_bpr_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_bpr_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_bpr_rkd.after_delete
159 (
160 p_payroll_run_id
161 => p_rec.payroll_run_id,
162 p_payroll_id_o
163 => per_bpr_shd.g_old_rec.payroll_id,
164 p_business_group_id_o
165 => per_bpr_shd.g_old_rec.business_group_id,
166 p_payroll_identifier_o
167 => per_bpr_shd.g_old_rec.payroll_identifier,
168 p_period_start_date_o
169 => per_bpr_shd.g_old_rec.period_start_date,
170 p_period_end_date_o
171 => per_bpr_shd.g_old_rec.period_end_date,
172 p_processing_date_o
173 => per_bpr_shd.g_old_rec.processing_date,
174 p_object_version_number_o
175 => per_bpr_shd.g_old_rec.object_version_number,
176 p_bpr_attribute_category_o
177 => per_bpr_shd.g_old_rec.bpr_attribute_category,
178 p_bpr_attribute1_o
179 => per_bpr_shd.g_old_rec.bpr_attribute1,
180 p_bpr_attribute2_o
181 => per_bpr_shd.g_old_rec.bpr_attribute2,
182 p_bpr_attribute3_o
183 => per_bpr_shd.g_old_rec.bpr_attribute3,
184 p_bpr_attribute4_o
185 => per_bpr_shd.g_old_rec.bpr_attribute4,
186 p_bpr_attribute5_o
187 => per_bpr_shd.g_old_rec.bpr_attribute5,
188 p_bpr_attribute6_o
189 => per_bpr_shd.g_old_rec.bpr_attribute6,
190 p_bpr_attribute7_o
191 => per_bpr_shd.g_old_rec.bpr_attribute7,
192 p_bpr_attribute8_o
193 => per_bpr_shd.g_old_rec.bpr_attribute8,
194 p_bpr_attribute9_o
195 => per_bpr_shd.g_old_rec.bpr_attribute9,
196 p_bpr_attribute10_o
197 => per_bpr_shd.g_old_rec.bpr_attribute10,
198 p_bpr_attribute11_o
199 => per_bpr_shd.g_old_rec.bpr_attribute11,
200 p_bpr_attribute12_o
201 => per_bpr_shd.g_old_rec.bpr_attribute12,
202 p_bpr_attribute13_o
203 => per_bpr_shd.g_old_rec.bpr_attribute13,
204 p_bpr_attribute14_o
205 => per_bpr_shd.g_old_rec.bpr_attribute14,
206 p_bpr_attribute15_o
207 => per_bpr_shd.g_old_rec.bpr_attribute15,
208 p_bpr_attribute16_o
209 => per_bpr_shd.g_old_rec.bpr_attribute16,
210 p_bpr_attribute17_o
211 => per_bpr_shd.g_old_rec.bpr_attribute17,
212 p_bpr_attribute18_o
213 => per_bpr_shd.g_old_rec.bpr_attribute18,
214 p_bpr_attribute19_o
215 => per_bpr_shd.g_old_rec.bpr_attribute19,
216 p_bpr_attribute20_o
217 => per_bpr_shd.g_old_rec.bpr_attribute20,
218 p_bpr_attribute21_o
219 => per_bpr_shd.g_old_rec.bpr_attribute21,
220 p_bpr_attribute22_o
221 => per_bpr_shd.g_old_rec.bpr_attribute22,
222 p_bpr_attribute23_o
223 => per_bpr_shd.g_old_rec.bpr_attribute23,
224 p_bpr_attribute24_o
225 => per_bpr_shd.g_old_rec.bpr_attribute24,
226 p_bpr_attribute25_o
227 => per_bpr_shd.g_old_rec.bpr_attribute25,
228 p_bpr_attribute26_o
229 => per_bpr_shd.g_old_rec.bpr_attribute26,
230 p_bpr_attribute27_o
231 => per_bpr_shd.g_old_rec.bpr_attribute27,
232 p_bpr_attribute28_o
233 => per_bpr_shd.g_old_rec.bpr_attribute28,
234 p_bpr_attribute29_o
235 => per_bpr_shd.g_old_rec.bpr_attribute29,
236 p_bpr_attribute30_o
237 => per_bpr_shd.g_old_rec.bpr_attribute30
238 );
239 --
240 exception
241 --
242 when hr_api.cannot_find_prog_unit then
243 --
244 hr_api.cannot_find_prog_unit_error
245 (p_module_name => 'PER_BF_PAYROLL_RUNS'
246 ,p_hook_type => 'AD');
247 --
248 end;
249 --
250 hr_utility.set_location(' Leaving:'||l_proc, 10);
251 End post_delete;
252 --
253 -- ----------------------------------------------------------------------------
254 -- |---------------------------------< del >----------------------------------|
255 -- ----------------------------------------------------------------------------
256 Procedure del
257 (
258 p_rec in per_bpr_shd.g_rec_type
259 ) is
260 --
261 l_proc varchar2(72) := g_package||'del';
262 --
263 Begin
264 hr_utility.set_location('Entering:'||l_proc, 5);
265 --
266 -- We must lock the row which we need to delete.
267 --
268 per_bpr_shd.lck
269 (
270 p_rec.payroll_run_id,
271 p_rec.object_version_number
272 );
273 --
274 -- Call the supporting delete validate operation
275 --
276 per_bpr_bus.delete_validate(p_rec);
277 --
278 -- Call the supporting pre-delete operation
279 --
280 pre_delete(p_rec);
281 --
282 -- Delete the row.
283 --
284 delete_dml(p_rec);
285 --
286 -- Call the supporting post-delete operation
287 --
288 post_delete(p_rec);
289 End del;
290 --
291 -- ----------------------------------------------------------------------------
292 -- |---------------------------------< del >----------------------------------|
293 -- ----------------------------------------------------------------------------
294 Procedure del
295 (
296 p_payroll_run_id in number,
297 p_object_version_number in number
298 ) is
299 --
300 l_rec per_bpr_shd.g_rec_type;
301 l_proc varchar2(72) := g_package||'del';
302 --
303 Begin
304 hr_utility.set_location('Entering:'||l_proc, 5);
305 --
306 -- As the delete procedure accepts a plsql record structure we do need to
307 -- convert the arguments into the record structure.
308 -- We don't need to call the supplied conversion argument routine as we
309 -- only need a few attributes.
310 --
311 l_rec.payroll_run_id := p_payroll_run_id;
312 l_rec.object_version_number := p_object_version_number;
313 --
314 -- Having converted the arguments into the per_bpr_rec
315 -- plsql record structure we must call the corresponding entity
316 -- business process
317 --
318 del(l_rec);
319 --
320 hr_utility.set_location(' Leaving:'||l_proc, 10);
321 End del;
322 --
323 end per_bpr_del;