DBA Data[Home] [Help]

PACKAGE BODY: APPS.PER_PSP_DEL

Source


1 Package Body per_psp_del as
2 /* $Header: pepsprhi.pkb 115.5 2003/11/17 13:06:07 tpapired noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33) := '  per_psp_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
52   (p_rec in per_psp_shd.g_rec_type
53   ) is
54 --
55   l_proc  varchar2(72) := g_package||'delete_dml';
56 --
57 Begin
58   hr_utility.set_location('Entering:'||l_proc, 5);
59   --
60   per_psp_shd.g_api_dml := true;  -- Set the api dml status
61   --
62   -- Delete the per_spinal_points row.
63   --
64   delete from per_spinal_points
65   where spinal_point_id = p_rec.spinal_point_id;
66   --
67   per_psp_shd.g_api_dml := false;   -- Unset the api dml status
68   --
69   hr_utility.set_location(' Leaving:'||l_proc, 10);
70 --
71 Exception
72   When hr_api.child_integrity_violated then
73     -- Child integrity has been violated
74     per_psp_shd.g_api_dml := false;   -- Unset the api dml status
75     per_psp_shd.constraint_error
76       (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
77   When Others Then
78     per_psp_shd.g_api_dml := false;   -- Unset the api dml status
79     Raise;
80 End delete_dml;
81 --
82 -- ----------------------------------------------------------------------------
83 -- |------------------------------< pre_delete >------------------------------|
84 -- ----------------------------------------------------------------------------
85 -- {Start Of Comments}
86 --
87 -- Description:
88 --   This private procedure contains any processing which is required before
89 --   the delete dml.
90 --
91 -- Prerequisites:
92 --   This is an internal procedure which is called from the del procedure.
93 --
94 -- In Parameters:
95 --   A Pl/Sql record structre.
96 --
97 -- Post Success:
98 --   Processing continues.
99 --
100 -- Post Failure:
101 --   If an error has occurred, an error message and exception will be raised
102 --   but not handled.
103 --
104 -- Developer Implementation Notes:
105 --   Any pre-processing required before the delete dml is issued should be
106 --   coded within this procedure. It is important to note that any 3rd party
107 --   maintenance should be reviewed before placing in this procedure.
108 --
109 -- Access Status:
110 --   Internal Row Handler Use Only.
111 --
112 -- {End Of Comments}
113 -- ----------------------------------------------------------------------------
114 Procedure pre_delete(p_rec in per_psp_shd.g_rec_type) is
115 --
116   l_proc   varchar2(72) := g_package||'pre_delete';
117   l_return varchar2(30);
118   l_message varchar2(2000) := null;
119 --
120 Begin
121   hr_utility.set_location('Entering:'||l_proc, 5);
122   --
123   -- Call pqh_gsp_sync_compensation_obj.delete_option_for_point
124   --
125   hr_utility.trace('prec.spinal_point_id : ' || p_rec.spinal_point_id);
126   --
127   l_return := pqh_gsp_sync_compensation_obj.delete_option_for_point
128     (p_spinal_point_id         => p_rec.spinal_point_id
129     );
130   --
131   hr_utility.trace('pqh_gsp_sync_compensation_obj.delete_option_for_point : '
132                   || l_return);
133   if l_return <> 'SUCCESS' Then
134          l_message := fnd_message.get;
135          hr_utility.trace('error message : ' || l_message);
136 
137          fnd_message.set_name('PER','HR_289569_DEL_OPTION_FOR_POINT');
138          if l_message is not null then
139            fnd_message.set_token('ERR_CODE',l_message);
140          else
141            fnd_message.set_token('ERR_CODE','-1');
142          end if;
143          --
144          fnd_message.raise_error;
145   End if;
146   --
147   hr_utility.set_location(' Leaving:'||l_proc, 10);
148 End pre_delete;
149 --
150 -- ----------------------------------------------------------------------------
151 -- |-----------------------------< post_delete >------------------------------|
152 -- ----------------------------------------------------------------------------
153 -- {Start Of Comments}
154 --
155 -- Description:
156 --   This private procedure contains any processing which is required after
157 --   the delete dml.
158 --
159 -- Prerequistes:
160 --   This is an internal procedure which is called from the del procedure.
161 --
162 -- In Parameters:
163 --   A Pl/Sql record structure.
164 --
165 -- Post Success:
166 --   Processing continues.
167 --
168 -- Post Failure:
169 --   If an error has occurred, an error message and exception will be raised
170 --   but not handled.
171 --
172 -- Developer Implementation Notes:
173 --   Any post-processing required after the delete dml is issued should be
174 --   coded within this procedure. It is important to note that any 3rd party
175 --   maintenance should be reviewed before placing in this procedure.
176 --
177 -- Access Status:
178 --   Internal Row Handler Use Only.
179 --
180 -- {End Of Comments}
181 -- -----------------------------------------------------------------------------
182 Procedure post_delete(p_rec in per_psp_shd.g_rec_type) is
183 --
184   l_proc  varchar2(72) := g_package||'post_delete';
185 --
186 Begin
187   hr_utility.set_location('Entering:'||l_proc, 5);
188   begin
189     --
190     per_psp_rkd.after_delete
191       (p_spinal_point_id
192       => p_rec.spinal_point_id
193       ,p_business_group_id_o
194       => per_psp_shd.g_old_rec.business_group_id
195       ,p_parent_spine_id_o
196       => per_psp_shd.g_old_rec.parent_spine_id
197       ,p_sequence_o
198       => per_psp_shd.g_old_rec.sequence
199       ,p_spinal_point_o
200       => per_psp_shd.g_old_rec.spinal_point
201       ,p_request_id_o
202       => per_psp_shd.g_old_rec.request_id
203       ,p_program_application_id_o
204       => per_psp_shd.g_old_rec.program_application_id
205       ,p_program_id_o
206       => per_psp_shd.g_old_rec.program_id
207       ,p_program_update_date_o
208       => per_psp_shd.g_old_rec.program_update_date
209       ,p_object_version_number_o
210       => per_psp_shd.g_old_rec.object_version_number
211       --
212       ,p_information_category_o
213       => per_psp_shd.g_old_rec.information_category
214       ,p_information1_o
215       => per_psp_shd.g_old_rec.information1
216       ,p_information2_o
217       => per_psp_shd.g_old_rec.information2
218       ,p_information3_o
219       => per_psp_shd.g_old_rec.information3
220       ,p_information4_o
221       => per_psp_shd.g_old_rec.information4
222       ,p_information5_o
223       => per_psp_shd.g_old_rec.information5
224       ,p_information6_o
225       => per_psp_shd.g_old_rec.information6
226       ,p_information7_o
227       => per_psp_shd.g_old_rec.information7
228       ,p_information8_o
229       => per_psp_shd.g_old_rec.information8
230       ,p_information9_o
231       => per_psp_shd.g_old_rec.information9
232       ,p_information10_o
233       => per_psp_shd.g_old_rec.information10
234       ,p_information11_o
235       => per_psp_shd.g_old_rec.information11
236       ,p_information12_o
237       => per_psp_shd.g_old_rec.information12
238       ,p_information13_o
239       => per_psp_shd.g_old_rec.information13
240       ,p_information14_o
241       => per_psp_shd.g_old_rec.information14
242       ,p_information15_o
243       => per_psp_shd.g_old_rec.information15
244       ,p_information16_o
245       => per_psp_shd.g_old_rec.information16
246       ,p_information17_o
247       => per_psp_shd.g_old_rec.information17
248       ,p_information18_o
249       => per_psp_shd.g_old_rec.information18
250       ,p_information19_o
251       => per_psp_shd.g_old_rec.information19
252       ,p_information20_o
253       => per_psp_shd.g_old_rec.information20
254       ,p_information21_o
255       => per_psp_shd.g_old_rec.information21
256       ,p_information22_o
257       => per_psp_shd.g_old_rec.information22
258       ,p_information23_o
259       => per_psp_shd.g_old_rec.information23
260       ,p_information24_o
261       => per_psp_shd.g_old_rec.information24
262       ,p_information25_o
263       => per_psp_shd.g_old_rec.information25
264       ,p_information26_o
265       => per_psp_shd.g_old_rec.information26
266       ,p_information27_o
267       => per_psp_shd.g_old_rec.information27
268       ,p_information28_o
269       => per_psp_shd.g_old_rec.information28
270       ,p_information29_o
271       => per_psp_shd.g_old_rec.information29
272       ,p_information30_o
273       => per_psp_shd.g_old_rec.information30
274 --
275       );
276     --
277   exception
278     --
279     when hr_api.cannot_find_prog_unit then
280       --
281       hr_api.cannot_find_prog_unit_error
282         (p_module_name => 'PER_SPINAL_POINTS'
283         ,p_hook_type   => 'AD');
284       --
285   end;
286   --
287   hr_utility.set_location(' Leaving:'||l_proc, 10);
288 End post_delete;
289 --
290 -- ----------------------------------------------------------------------------
291 -- |---------------------------------< del >----------------------------------|
292 -- ----------------------------------------------------------------------------
293 Procedure del
294   (p_rec              in per_psp_shd.g_rec_type
295   ) is
296 --
297   l_proc  varchar2(72) := g_package||'del';
298 --
299 Begin
300   hr_utility.set_location('Entering:'||l_proc, 10);
301   --
302   -- We must lock the row which we need to delete.
303   --
304   per_psp_shd.lck
305     (p_rec.spinal_point_id
306     ,p_rec.object_version_number
307     );
308   --
309   -- Call the supporting delete validate operation
310   --
311   per_psp_bus.delete_validate(p_rec);
312 
313   hr_utility.set_location(l_proc, 20);
314 
315   --
316   -- Call to raise any errors on multi-message list
317   hr_multi_message.end_validation_set;
318   --
319   -- Call the supporting pre-delete operation
320   --
321   per_psp_del.pre_delete(p_rec);
322 
323   hr_utility.set_location(l_proc, 30);
324 
325   --
326   -- Delete the row.
327   --
328   per_psp_del.delete_dml(p_rec);
329 
330   hr_utility.set_location(l_proc, 40);
331 
332   --
333   -- Call the supporting post-delete operation
334   --
335   per_psp_del.post_delete(p_rec);
336 
337   hr_utility.set_location(l_proc, 50);
338 
339   --
340   -- Call to raise any errors on multi-message list
341   hr_multi_message.end_validation_set;
342   --
343 
344   hr_utility.set_location(l_proc, 60);
345 End del;
346 --
347 -- ----------------------------------------------------------------------------
348 -- |---------------------------------< del >----------------------------------|
349 -- ----------------------------------------------------------------------------
350 Procedure del
351   (p_spinal_point_id                      in     number
352   ,p_object_version_number                in     number
353   ) is
354 --
355   l_rec   per_psp_shd.g_rec_type;
356   l_proc  varchar2(72) := g_package||'del';
357 --
358 Begin
359   hr_utility.set_location('Entering:'||l_proc, 5);
360   --
361   -- As the delete procedure accepts a plsql record structure we do need to
362   -- convert the  arguments into the record structure.
363   -- We don't need to call the supplied conversion argument routine as we
364   -- only need a few attributes.
365   --
366   l_rec.spinal_point_id := p_spinal_point_id;
367   l_rec.object_version_number := p_object_version_number;
368   --
369   -- Having converted the arguments into the per_psp_rec
370   -- plsql record structure we must call the corresponding entity
371   -- business process
372   --
373   per_psp_del.del(l_rec);
374   --
375   hr_utility.set_location(' Leaving:'||l_proc, 100);
376 End del;
377 --
378 end per_psp_del;