1 Package Body ben_pcg_del as
2 /* $Header: bepcgrhi.pkb 115.8 2002/12/16 11:58:08 vsethi ship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- | Private Global Definitions |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package varchar2(33) := ' ben_pcg_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_pcg_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_pcg_shd.g_api_dml := true; -- Set the api dml status
59 --
60 -- Delete the ben_prtt_clm_gd_or_svc_typ row.
61 --
62 delete from ben_prtt_clm_gd_or_svc_typ
63 where prtt_clm_gd_or_svc_typ_id = p_rec.prtt_clm_gd_or_svc_typ_id;
64 --
65 ben_pcg_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_pcg_shd.g_api_dml := false; -- Unset the api dml status
73 ben_pcg_shd.constraint_error
74 (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
75 When Others Then
76 ben_pcg_shd.g_api_dml := false; -- Unset the api dml status
77 Raise;
78 End delete_dml;
79 --
80 -- ----------------------------------------------------------------------------
81 -- |------------------------------< chk_reimbmt_status >------------------------------|
82 -- ----------------------------------------------------------------------------
83
84 Procedure chk_reimbmt_status(p_prtt_reimbmt_rqst_id in number ) is
85 --
86 l_proc varchar2(72) := g_package||'chk_reimbmt_status';
87 cursor c_prc is
88 select prtt_reimbmt_rqst_stat_cd
89 from ben_prtt_reimbmt_rqst_f
90 where prtt_reimbmt_rqst_id = p_prtt_reimbmt_rqst_id
91 and prtt_reimbmt_rqst_stat_cd in ('APPRVD','VOIDED','PDINFL','PRTLYPD') ;
92
93 l_prtt_reimbmt_rqst_stat_cd ben_prtt_reimbmt_rqst_f.prtt_reimbmt_rqst_stat_cd%TYPE; -- UTF8 varchar2(15) ;
94 --
95 Begin
96 hr_utility.set_location('Entering:'||l_proc, 5);
97 --
98 open c_prc ;
99 fetch c_prc into l_prtt_reimbmt_rqst_stat_cd ;
100 if c_prc%found then
101 close c_prc ;
102 if l_prtt_reimbmt_rqst_stat_cd in ( 'APPRVD','PDINFL','PRTLYPD') then
103 fnd_message.set_name('BEN','BEN_92705_REIMB_RQST_APPROVD');
104 fnd_message.raise_error;
105 end if ;
106 if l_prtt_reimbmt_rqst_stat_cd = 'VOIDED' then
107 fnd_message.set_name('BEN','BEN_92708_REIMB_RQST_VOIDED');
108 fnd_message.raise_error;
109 end if ;
110 else
111 close c_prc ;
112 end if ;
113 hr_utility.set_location(' Leaving:'||l_proc, 10);
114 End chk_reimbmt_status;
115
116
117
118 -- ----------------------------------------------------------------------------
119 -- |------------------------------< pre_delete >------------------------------|
120 -- ----------------------------------------------------------------------------
121 -- {Start Of Comments}
122 --
123 -- Description:
124 -- This private procedure contains any processing which is required before
125 -- the delete dml.
126 --
127 -- Prerequisites:
128 -- This is an internal procedure which is called from the del procedure.
129 --
130 -- In Parameters:
131 -- A Pl/Sql record structre.
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 pre-processing required before 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 pre_delete(p_rec in ben_pcg_shd.g_rec_type) is
151 --
152 l_proc varchar2(72) := g_package||'pre_delete';
153 --
154 Begin
155 hr_utility.set_location('Entering:'||l_proc, 5);
156 --
157 hr_utility.set_location(' Leaving:'||l_proc, 10);
158 End pre_delete;
159 --
160 -- ----------------------------------------------------------------------------
161 -- |-----------------------------< post_delete >------------------------------|
162 -- ----------------------------------------------------------------------------
163 -- {Start Of Comments}
164 --
165 -- Description:
166 -- This private procedure contains any processing which is required after the
167 -- delete dml.
168 --
169 -- Prerequisites:
170 -- This is an internal procedure which is called from the del procedure.
171 --
172 -- In Parameters:
173 -- A Pl/Sql record structre.
174 --
175 -- Post Success:
176 -- Processing continues.
177 --
178 -- Post Failure:
179 -- If an error has occurred, an error message and exception will be raised
180 -- but not handled.
181 --
182 -- Developer Implementation Notes:
183 -- Any post-processing required after the delete dml is issued should be
184 -- coded within this procedure. It is important to note that any 3rd party
185 -- maintenance should be reviewed before placing in this procedure.
186 --
187 -- Access Status:
188 -- Internal table Handler Use Only.
189 --
190 -- {End Of Comments}
191 -- ----------------------------------------------------------------------------
192 Procedure post_delete(p_rec in ben_pcg_shd.g_rec_type) is
193 --
194 l_proc varchar2(72) := g_package||'post_delete';
195 --
196 Begin
197 hr_utility.set_location('Entering:'||l_proc, 5);
198 --
199 --
200 -- Start of API User Hook for post_delete.
201 --
202 begin
203 --
204 ben_pcg_rkd.after_delete
205 (
206 p_prtt_clm_gd_or_svc_typ_id =>p_rec.prtt_clm_gd_or_svc_typ_id
207 ,p_prtt_reimbmt_rqst_id_o =>ben_pcg_shd.g_old_rec.prtt_reimbmt_rqst_id
208 ,p_gd_or_svc_typ_id_o =>ben_pcg_shd.g_old_rec.gd_or_svc_typ_id
209 ,p_business_group_id_o =>ben_pcg_shd.g_old_rec.business_group_id
210 ,p_pcg_attribute_category_o =>ben_pcg_shd.g_old_rec.pcg_attribute_category
211 ,p_pcg_attribute1_o =>ben_pcg_shd.g_old_rec.pcg_attribute1
212 ,p_pcg_attribute2_o =>ben_pcg_shd.g_old_rec.pcg_attribute2
213 ,p_pcg_attribute3_o =>ben_pcg_shd.g_old_rec.pcg_attribute3
214 ,p_pcg_attribute4_o =>ben_pcg_shd.g_old_rec.pcg_attribute4
215 ,p_pcg_attribute5_o =>ben_pcg_shd.g_old_rec.pcg_attribute5
216 ,p_pcg_attribute6_o =>ben_pcg_shd.g_old_rec.pcg_attribute6
217 ,p_pcg_attribute7_o =>ben_pcg_shd.g_old_rec.pcg_attribute7
218 ,p_pcg_attribute8_o =>ben_pcg_shd.g_old_rec.pcg_attribute8
219 ,p_pcg_attribute9_o =>ben_pcg_shd.g_old_rec.pcg_attribute9
220 ,p_pcg_attribute10_o =>ben_pcg_shd.g_old_rec.pcg_attribute10
221 ,p_pcg_attribute11_o =>ben_pcg_shd.g_old_rec.pcg_attribute11
222 ,p_pcg_attribute12_o =>ben_pcg_shd.g_old_rec.pcg_attribute12
223 ,p_pcg_attribute13_o =>ben_pcg_shd.g_old_rec.pcg_attribute13
224 ,p_pcg_attribute14_o =>ben_pcg_shd.g_old_rec.pcg_attribute14
225 ,p_pcg_attribute15_o =>ben_pcg_shd.g_old_rec.pcg_attribute15
226 ,p_pcg_attribute16_o =>ben_pcg_shd.g_old_rec.pcg_attribute16
227 ,p_pcg_attribute17_o =>ben_pcg_shd.g_old_rec.pcg_attribute17
228 ,p_pcg_attribute18_o =>ben_pcg_shd.g_old_rec.pcg_attribute18
229 ,p_pcg_attribute19_o =>ben_pcg_shd.g_old_rec.pcg_attribute19
230 ,p_pcg_attribute20_o =>ben_pcg_shd.g_old_rec.pcg_attribute20
231 ,p_pcg_attribute21_o =>ben_pcg_shd.g_old_rec.pcg_attribute21
232 ,p_pcg_attribute22_o =>ben_pcg_shd.g_old_rec.pcg_attribute22
233 ,p_pcg_attribute23_o =>ben_pcg_shd.g_old_rec.pcg_attribute23
234 ,p_pcg_attribute24_o =>ben_pcg_shd.g_old_rec.pcg_attribute24
235 ,p_pcg_attribute25_o =>ben_pcg_shd.g_old_rec.pcg_attribute25
236 ,p_pcg_attribute26_o =>ben_pcg_shd.g_old_rec.pcg_attribute26
237 ,p_pcg_attribute27_o =>ben_pcg_shd.g_old_rec.pcg_attribute27
238 ,p_pcg_attribute28_o =>ben_pcg_shd.g_old_rec.pcg_attribute28
239 ,p_pcg_attribute29_o =>ben_pcg_shd.g_old_rec.pcg_attribute29
240 ,p_pcg_attribute30_o =>ben_pcg_shd.g_old_rec.pcg_attribute30
241 ,p_object_version_number_o =>ben_pcg_shd.g_old_rec.object_version_number
242 ,p_pl_gd_or_svc_id_o =>ben_pcg_shd.g_old_rec.pl_gd_or_svc_id
243 );
244 --
245 exception
246 --
247 when hr_api.cannot_find_prog_unit then
248 --
249 hr_api.cannot_find_prog_unit_error
250 (p_module_name => 'ben_prtt_clm_gd_or_svc_typ'
251 ,p_hook_type => 'AD');
252 --
253 end;
254 --
255 -- End of API User Hook for post_delete.
256 --
257 --
258 hr_utility.set_location(' Leaving:'||l_proc, 10);
259 End post_delete;
260 --
261 -- ----------------------------------------------------------------------------
262 -- |---------------------------------< del >----------------------------------|
263 -- ----------------------------------------------------------------------------
264 Procedure del
265 (
266 p_rec in ben_pcg_shd.g_rec_type
267 ) is
268 --
269 l_proc varchar2(72) := g_package||'del';
270 --
271 Begin
272 hr_utility.set_location('Entering:'||l_proc, 5);
273 --
274 -- We must lock the row which we need to delete.
275 --
276 ben_pcg_shd.lck
277 (
278 p_rec.prtt_clm_gd_or_svc_typ_id,
279 p_rec.object_version_number
280 );
281 --
282 -- Call the supporting delete validate operation
283 --
284 ben_pcg_bus.delete_validate(p_rec);
285 --
286 -- Call the supporting pre-delete operation
287 --
288 chk_reimbmt_Status ( p_rec.prtt_reimbmt_rqst_id ) ;
289 pre_delete(p_rec);
290 --
291 -- Delete the row.
292 --
293 delete_dml(p_rec);
294 --
295 -- Call the supporting post-delete operation
296 --
297 post_delete(p_rec);
298 End del;
299 --
300 -- ----------------------------------------------------------------------------
301 -- |---------------------------------< del >----------------------------------|
302 -- ----------------------------------------------------------------------------
303 Procedure del
304 (
305 p_prtt_clm_gd_or_svc_typ_id in number,
306 p_object_version_number in number
307 ) is
308 --
309 l_rec ben_pcg_shd.g_rec_type;
310 l_proc varchar2(72) := g_package||'del';
311 --
312 Begin
313 hr_utility.set_location('Entering:'||l_proc, 5);
314 --
315 -- As the delete procedure accepts a plsql record structure we do need to
316 -- convert the arguments into the record structure.
317 -- We don't need to call the supplied conversion argument routine as we
318 -- only need a few attributes.
319 --
320 l_rec.prtt_clm_gd_or_svc_typ_id:= p_prtt_clm_gd_or_svc_typ_id;
321 l_rec.object_version_number := p_object_version_number;
322 --
323 -- Having converted the arguments into the ben_pcg_rec
324 -- plsql record structure we must call the corresponding entity
325 -- business process
326 --
327 del(l_rec);
328 --
329 hr_utility.set_location(' Leaving:'||l_proc, 10);
330 End del;
331 --
332 end ben_pcg_del;