DBA Data[Home] [Help]

PACKAGE BODY: APPS.PAY_TXR_DEL

Source


1 Package Body pay_txr_del as
2 /* $Header: pytxrrhi.pkb 120.2 2012/01/19 11:27:49 rpahune ship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33) := '  pay_txr_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 pay_txr_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   --
61   --
62   -- Delete the pay_taxability_rules row.
63   --
64   delete from pay_taxability_rules
65   where jurisdiction_code = p_rec.jurisdiction_code
66     and nvl(tax_type, 'X') = nvl(p_rec.tax_type , 'X')
67     and nvl(tax_category, 'X') = nvl(p_rec.tax_category , 'X')
68     and nvl(classification_id, 0) = nvl(p_rec.classification_id, 0)
69     and nvl(secondary_classification_id, 0) =
70                      nvl(p_rec.secondary_classification_id, 0)
71     and taxability_rules_date_id = p_rec.taxability_rules_date_id;
72   --
73   --
74   --
75   hr_utility.set_location(' Leaving:'||l_proc, 10);
76 --
77 Exception
78   When hr_api.child_integrity_violated then
79     -- Child integrity has been violated
80     --
81     pay_txr_shd.constraint_error
82       (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
83   When Others Then
84     --
85     Raise;
86 End delete_dml;
87 --
88 -- ----------------------------------------------------------------------------
89 -- |------------------------------< pre_delete >------------------------------|
90 -- ----------------------------------------------------------------------------
91 -- {Start Of Comments}
92 --
93 -- Description:
94 --   This private procedure contains any processing which is required before
95 --   the delete dml.
96 --
97 -- Prerequisites:
98 --   This is an internal procedure which is called from the del procedure.
99 --
100 -- In Parameters:
101 --   A Pl/Sql record structre.
102 --
103 -- Post Success:
104 --   Processing continues.
105 --
106 -- Post Failure:
107 --   If an error has occurred, an error message and exception will be raised
108 --   but not handled.
109 --
110 -- Developer Implementation Notes:
111 --   Any pre-processing required before the delete dml is issued should be
112 --   coded within this procedure. It is important to note that any 3rd party
113 --   maintenance should be reviewed before placing in this procedure.
114 --
115 -- Access Status:
116 --   Internal Row Handler Use Only.
117 --
118 -- {End Of Comments}
119 -- ----------------------------------------------------------------------------
120 Procedure pre_delete(p_rec in pay_txr_shd.g_rec_type) is
121 --
122   l_proc  varchar2(72) := g_package||'pre_delete';
123 --
124 Begin
125   hr_utility.set_location('Entering:'||l_proc, 5);
126   --
127   hr_utility.set_location(' Leaving:'||l_proc, 10);
128 End pre_delete;
129 --
130 -- ----------------------------------------------------------------------------
131 -- |-----------------------------< post_delete >------------------------------|
132 -- ----------------------------------------------------------------------------
133 -- {Start Of Comments}
134 --
135 -- Description:
136 --   This private procedure contains any processing which is required after
137 --   the delete dml.
138 --
139 -- Prerequistes:
140 --   This is an internal procedure which is called from the del procedure.
141 --
142 -- In Parameters:
143 --   A Pl/Sql record structure.
144 --
145 -- Post Success:
146 --   Processing continues.
147 --
148 -- Post Failure:
149 --   If an error has occurred, an error message and exception will be raised
150 --   but not handled.
151 --
152 -- Developer Implementation Notes:
153 --   Any post-processing required after the delete dml is issued should be
154 --   coded within this procedure. It is important to note that any 3rd party
155 --   maintenance should be reviewed before placing in this procedure.
156 --
157 -- Access Status:
158 --   Internal Row Handler Use Only.
159 --
160 -- {End Of Comments}
161 -- -----------------------------------------------------------------------------
162 Procedure post_delete(p_rec in pay_txr_shd.g_rec_type) is
163 --
164   l_proc  varchar2(72) := g_package||'post_delete';
165 --
166 Begin
167   hr_utility.set_location('Entering:'||l_proc, 5);
168   begin
169     --
170     pay_txr_rkd.after_delete
171       (p_jurisdiction_code
172       => p_rec.jurisdiction_code
173       ,p_tax_type
174       => p_rec.tax_type
175       ,p_tax_category
176       => p_rec.tax_category
177       ,p_classification_id
178       => p_rec.classification_id
179       ,p_taxability_rules_date_id
180       => p_rec.taxability_rules_date_id
181       ,p_legislation_code_o
182       => pay_txr_shd.g_old_rec.legislation_code
183       ,p_status_o
184       => pay_txr_shd.g_old_rec.status
185       ,p_secondary_classification_id
186       => p_rec.secondary_classification_id
187       );
188     --
189   exception
190     --
191     when hr_api.cannot_find_prog_unit then
192       --
193       hr_api.cannot_find_prog_unit_error
194         (p_module_name => 'PAY_TAXABILITY_RULES'
195         ,p_hook_type   => 'AD');
196       --
197   end;
198   --
199   hr_utility.set_location(' Leaving:'||l_proc, 10);
200 End post_delete;
201 --
202 -- ----------------------------------------------------------------------------
203 -- |---------------------------------< del >----------------------------------|
204 -- ----------------------------------------------------------------------------
205 Procedure del
206   (p_rec              in pay_txr_shd.g_rec_type
207   ) is
208 --
209   l_proc  varchar2(72) := g_package||'del';
210 --
211 Begin
212   hr_utility.set_location('Entering:'||l_proc, 5);
213   --
214   -- We must lock the row which we need to delete.
215   --
216   pay_txr_shd.lck
217     (p_rec.jurisdiction_code
218     ,p_rec.tax_type
219     ,p_rec.tax_category
220     ,p_rec.classification_id
221     ,p_rec.taxability_rules_date_id
222     ,p_rec.secondary_classification_id
223     );
224   --
225   -- Call the supporting delete validate operation
226   --
227   pay_txr_bus.delete_validate(p_rec);
228   --
229   -- Call to raise any errors on multi-message list
230   hr_multi_message.end_validation_set;
231   --
232   -- Call the supporting pre-delete operation
233   --
234   pay_txr_del.pre_delete(p_rec);
235   --
236   -- Delete the row.
237   --
238   pay_txr_del.delete_dml(p_rec);
239   --
240   -- Call the supporting post-delete operation
241   --
242   pay_txr_del.post_delete(p_rec);
243   --
244   -- Call to raise any errors on multi-message list
245   hr_multi_message.end_validation_set;
246   --
247 End del;
248 --
249 -- ----------------------------------------------------------------------------
250 -- |---------------------------------< del >----------------------------------|
251 -- ----------------------------------------------------------------------------
252 Procedure del
253   (p_jurisdiction_code                    in     varchar2
254   ,p_tax_type                             in     varchar2 default null
255   ,p_tax_category                         in     varchar2 default null
256   ,p_classification_id                    in     number   default null
257   ,p_taxability_rules_date_id             in     number
258   ,p_secondary_classification_id          in     number   default null
259   ) is
260 --
261   l_rec   pay_txr_shd.g_rec_type;
262   l_proc  varchar2(72) := g_package||'del';
263 --
264 Begin
265   hr_utility.set_location('Entering:'||l_proc, 5);
266   --
267   -- As the delete procedure accepts a plsql record structure we do need to
268   -- convert the  arguments into the record structure.
269   -- We don't need to call the supplied conversion argument routine as we
270   -- only need a few attributes.
271   --
272   l_rec.jurisdiction_code := p_jurisdiction_code;
273   l_rec.tax_type := p_tax_type;
274   l_rec.tax_category := p_tax_category;
275   l_rec.classification_id := p_classification_id;
276   l_rec.taxability_rules_date_id := p_taxability_rules_date_id;
277   l_rec.secondary_classification_id := p_secondary_classification_id;
278   --
279   --
280   -- Having converted the arguments into the pay_txr_rec
281   -- plsql record structure we must call the corresponding entity
282   -- business process
283   --
284   pay_txr_del.del(l_rec);
285   --
286   hr_utility.set_location(' Leaving:'||l_proc, 10);
287 End del;
288 --
289 end pay_txr_del;
290