DBA Data[Home] [Help]

PACKAGE BODY: APPS.PAY_BLD_DEL

Source


1 Package Body pay_bld_del as
2 /* $Header: pybldrhi.pkb 120.0 2005/05/29 03:19 appldev noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33) := '  pay_bld_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 -- |------------------------------< delete_dml >------------------------------|
46 -- ----------------------------------------------------------------------------
47 -- {Start Of Comments}
48 --
49 -- Description:
50 --   This procedure controls the actual dml delete logic. The functions of
51 --   this procedure are as follows:
52 --   1) To set and unset the g_api_dml status as required (as we are about to
53 --      perform dml).
54 --   2) To delete the specified row from the schema using the primary key in
55 --      the predicates.
56 --   3) To trap any constraint violations that may have occurred.
57 --   4) To raise any other errors.
58 --
59 -- Prerequisites:
60 --   This is an internal private procedure which must be called from the del
61 --   procedure.
62 --
63 -- In Parameters:
64 --   A Pl/Sql record structre.
65 --
66 -- Post Success:
67 --   The specified row will be delete from the schema.
68 --
69 -- Post Failure:
70 --   On the delete dml failure it is important to note that we always reset the
71 --   g_api_dml status to false.
72 --   If a child integrity constraint violation is raised the
73 --   constraint_error procedure will be called.
74 --   If any other error is reported, the error will be raised after the
75 --   g_api_dml status is reset.
76 --
77 -- Developer Implementation Notes:
78 --   None.
79 --
80 -- Access Status:
81 --   Internal Row Handler Use Only.
82 --
83 -- {End Of Comments}
84 -- ----------------------------------------------------------------------------
85 Procedure delete_dml
86   (p_rec in pay_bld_shd.g_rec_type
87   ) is
88 --
89   l_proc  varchar2(72) := g_package||'delete_dml';
90 --
91 Begin
92   hr_utility.set_location('Entering:'||l_proc, 5);
93   --
94   --
95   --
96   -- Delete the pay_balance_dimensions row.
97   --
98   delete from pay_balance_dimensions
99   where balance_dimension_id = p_rec.balance_dimension_id;
100   --
101   --
102   --
103   hr_utility.set_location(' Leaving:'||l_proc, 10);
104 --
105 Exception
106   When hr_api.child_integrity_violated then
107     -- Child integrity has been violated
108     --
109     pay_bld_shd.constraint_error
110       (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
111   When Others Then
112     --
113     Raise;
114 End delete_dml;
115 --
116 -- ----------------------------------------------------------------------------
117 -- |------------------------------< pre_delete >------------------------------|
118 -- ----------------------------------------------------------------------------
119 -- {Start Of Comments}
120 --
121 -- Description:
122 --   This private procedure contains any processing which is required before
123 --   the delete dml.
124 --
125 -- Prerequisites:
126 --   This is an internal procedure which is called from the del procedure.
127 --
128 -- In Parameters:
129 --   A Pl/Sql record structre.
130 --
131 -- Post Success:
132 --   Processing continues.
133 --
134 -- Post Failure:
135 --   If an error has occurred, an error message and exception will be raised
136 --   but not handled.
137 --
138 -- Developer Implementation Notes:
139 --   Any pre-processing required before the delete dml is issued should be
140 --   coded within this procedure. It is important to note that any 3rd party
141 --   maintenance should be reviewed before placing in this procedure.
142 --
143 -- Access Status:
144 --   Internal Row Handler Use Only.
145 --
146 -- {End Of Comments}
147 -- ----------------------------------------------------------------------------
148 Procedure pre_delete(p_rec in pay_bld_shd.g_rec_type) is
149 --
150   l_proc  varchar2(72) := g_package||'pre_delete';
151 --
152 Begin
153   hr_utility.set_location('Entering:'||l_proc, 5);
154   --
155   hr_utility.set_location(' Leaving:'||l_proc, 10);
156 End pre_delete;
157 --
158 -- ----------------------------------------------------------------------------
159 -- |-----------------------------< post_delete >------------------------------|
160 -- ----------------------------------------------------------------------------
161 -- {Start Of Comments}
162 --
163 -- Description:
164 --   This private procedure contains any processing which is required after
165 --   the delete dml.
166 --
167 -- Prerequistes:
168 --   This is an internal procedure which is called from the del procedure.
169 --
170 -- In Parameters:
171 --   A Pl/Sql record structure.
172 --
173 -- Post Success:
174 --   Processing continues.
175 --
176 -- Post Failure:
177 --   If an error has occurred, an error message and exception will be raised
178 --   but not handled.
179 --
180 -- Developer Implementation Notes:
181 --   Any post-processing required after the delete dml is issued should be
182 --   coded within this procedure. It is important to note that any 3rd party
183 --   maintenance should be reviewed before placing in this procedure.
184 --
185 -- Access Status:
186 --   Internal Row Handler Use Only.
187 --
188 -- {End Of Comments}
189 -- -----------------------------------------------------------------------------
190 Procedure post_delete(p_rec in pay_bld_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   begin
197     --
198     -- Delete ownerships if applicable
199     delete_app_ownerships
200       ('BALANCE_DIMENSION_ID', p_rec.balance_dimension_id
201       );
202     --
203     pay_bld_rkd.after_delete
204       (p_balance_dimension_id
205       => p_rec.balance_dimension_id
206       ,p_business_group_id_o
207       => pay_bld_shd.g_old_rec.business_group_id
208       ,p_legislation_code_o
209       => pay_bld_shd.g_old_rec.legislation_code
210       ,p_route_id_o
211       => pay_bld_shd.g_old_rec.route_id
212       ,p_database_item_suffix_o
213       => pay_bld_shd.g_old_rec.database_item_suffix
214       ,p_dimension_name_o
215       => pay_bld_shd.g_old_rec.dimension_name
216       ,p_dimension_type_o
217       => pay_bld_shd.g_old_rec.dimension_type
218       ,p_description_o
219       => pay_bld_shd.g_old_rec.description
220       ,p_feed_checking_code_o
221       => pay_bld_shd.g_old_rec.feed_checking_code
222       ,p_legislation_subgroup_o
223       => pay_bld_shd.g_old_rec.legislation_subgroup
224       ,p_payments_flag_o
225       => pay_bld_shd.g_old_rec.payments_flag
226       ,p_expiry_checking_code_o
227       => pay_bld_shd.g_old_rec.expiry_checking_code
228       ,p_expiry_checking_level_o
229       => pay_bld_shd.g_old_rec.expiry_checking_level
230       ,p_feed_checking_type_o
231       => pay_bld_shd.g_old_rec.feed_checking_type
232       ,p_dimension_level_o
233       => pay_bld_shd.g_old_rec.dimension_level
234       ,p_period_type_o
235       => pay_bld_shd.g_old_rec.period_type
236       ,p_asg_action_balance_dim_id_o
237       => pay_bld_shd.g_old_rec.asg_action_balance_dim_id
238       ,p_database_item_function_o
239       => pay_bld_shd.g_old_rec.database_item_function
240       ,p_save_run_balance_enabled_o
241       => pay_bld_shd.g_old_rec.save_run_balance_enabled
242       ,p_start_date_code_o
243       => pay_bld_shd.g_old_rec.start_date_code
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 => 'PAY_BALANCE_DIMENSIONS'
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   (p_rec              in pay_bld_shd.g_rec_type
264   ) is
265 --
266   l_proc  varchar2(72) := g_package||'del';
267 --
268 Begin
269   hr_utility.set_location('Entering:'||l_proc, 5);
270   --
271   -- We must lock the row which we need to delete.
272   --
273   pay_bld_shd.lck
274     (p_rec.balance_dimension_id
275     );
276   --
277   -- Call the supporting delete validate operation
278   --
279   pay_bld_bus.delete_validate(p_rec);
280   --
281   -- Call to raise any errors on multi-message list
282   hr_multi_message.end_validation_set;
283   --
284   -- Call the supporting pre-delete operation
285   --
286   pay_bld_del.pre_delete(p_rec);
287   --
288   -- Delete the row.
289   --
290   pay_bld_del.delete_dml(p_rec);
291   --
292   -- Call the supporting post-delete operation
293   --
294   pay_bld_del.post_delete(p_rec);
295   --
296   -- Call to raise any errors on multi-message list
297   hr_multi_message.end_validation_set;
298   --
299 End del;
300 --
301 -- ----------------------------------------------------------------------------
302 -- |---------------------------------< del >----------------------------------|
303 -- ----------------------------------------------------------------------------
304 Procedure del
305   (p_balance_dimension_id                 in     number
306   ) is
307 --
308   l_rec   pay_bld_shd.g_rec_type;
309   l_proc  varchar2(72) := g_package||'del';
310 --
311 Begin
312   hr_utility.set_location('Entering:'||l_proc, 5);
313   --
314   -- As the delete procedure accepts a plsql record structure we do need to
315   -- convert the  arguments into the record structure.
316   -- We don't need to call the supplied conversion argument routine as we
317   -- only need a few attributes.
318   --
319   l_rec.balance_dimension_id := p_balance_dimension_id;
320   --
321   --
322   -- Having converted the arguments into the pay_bld_rec
323   -- plsql record structure we must call the corresponding entity
324   -- business process
325   --
326   pay_bld_del.del(l_rec);
327   --
328   hr_utility.set_location(' Leaving:'||l_proc, 10);
329 End del;
330 --
331 end pay_bld_del;