DBA Data[Home] [Help]

PACKAGE BODY: APPS.PAY_MGR_DEL

Source


1 Package Body pay_mgr_del as
2 /* $Header: pymgrrhi.pkb 120.2 2005/07/10 23:13:53 pgongada noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33)	:= '  pay_mgr_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 this
17 --   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 -- Pre Conditions:
26 --   This is an internal private procedure which must be called from the del
27 --   procedure.
28 --
29 -- In Arguments:
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
44 --   None.
41 --   g_api_dml status is reset.
42 --
43 -- Developer Implementation Notes:
45 --
46 -- Access Status:
47 --   Internal Development Use Only.
48 --
49 -- {End Of Comments}
50 -- ----------------------------------------------------------------------------
51 Procedure delete_dml(p_rec in pay_mgr_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   pay_mgr_shd.g_api_dml := true;  -- Set the api dml status
59   --
60   -- Delete the pay_magnetic_records row.
61   --
62   delete from pay_magnetic_records
63   where magnetic_block_id = p_rec.magnetic_block_id
64   and   sequence = p_rec.sequence;
65   --
66   pay_mgr_shd.g_api_dml := false;   -- Unset the api dml status
67   --
68   hr_utility.set_location(' Leaving:'||l_proc, 10);
69 --
70 Exception
71   When hr_api.child_integrity_violated then
72     -- Child integrity has been violated
73     pay_mgr_shd.g_api_dml := false;   -- Unset the api dml status
74     pay_mgr_shd.constraint_error
75       (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
76   When Others Then
77     pay_mgr_shd.g_api_dml := false;   -- Unset the api dml status
78     Raise;
79 End delete_dml;
80 --
81 -- ----------------------------------------------------------------------------
82 -- |------------------------------< pre_delete >------------------------------|
83 -- ----------------------------------------------------------------------------
84 -- {Start Of Comments}
85 --
86 -- Description:
87 --   This private procedure contains any processing which is required before
88 --   the delete dml.
89 --
90 -- Pre Conditions:
91 --   This is an internal procedure which is called from the del procedure.
92 --
93 -- In Arguments:
94 --   A Pl/Sql record structre.
95 --
96 -- Post Success:
97 --   Processing continues.
98 --
99 -- Post Failure:
100 --   If an error has occurred, an error message and exception will be raised
101 --   but not handled.
102 --
103 -- Developer Implementation Notes:
104 --   Any pre-processing required before the delete dml is issued should be
105 --   coded within this procedure. It is important to note that any 3rd party
106 --   maintenance should be reviewed before placing in this procedure.
107 --
108 -- Access Status:
109 --   Internal Development Use Only.
110 --
111 -- {End Of Comments}
112 -- ----------------------------------------------------------------------------
113 Procedure pre_delete(p_rec in pay_mgr_shd.g_rec_type) is
114 --
115   l_proc  varchar2(72) := g_package||'pre_delete';
116 --
117 Begin
118   hr_utility.set_location('Entering:'||l_proc, 5);
119   --
120   hr_utility.set_location(' Leaving:'||l_proc, 10);
121 End pre_delete;
122 --
123 -- ----------------------------------------------------------------------------
124 -- |-----------------------------< post_delete >------------------------------|
125 -- ----------------------------------------------------------------------------
126 -- {Start Of Comments}
127 --
128 -- Description:
129 --   This private procedure contains any processing which is required after the
130 --   delete dml.
131 --
132 -- Pre Conditions:
133 --   This is an internal procedure which is called from the del procedure.
134 --
135 -- In Arguments:
136 --   A Pl/Sql record structre.
137 --
138 -- Post Success:
139 --   Processing continues.
140 --
141 -- Post Failure:
142 --   If an error has occurred, an error message and exception will be raised
143 --   but not handled.
144 --
145 -- Developer Implementation Notes:
146 --   Any post-processing required after the delete dml is issued should be
147 --   coded within this procedure. It is important to note that any 3rd party
148 --   maintenance should be reviewed before placing in this procedure.
149 --
150 -- Access Status:
151 --   Internal Development Use Only.
152 --
153 -- {End Of Comments}
154 -- ----------------------------------------------------------------------------
155 Procedure post_delete(p_rec in pay_mgr_shd.g_rec_type) is
156 --
157   l_proc  varchar2(72) := g_package||'post_delete';
158 --
159 Begin
160   hr_utility.set_location('Entering:'||l_proc, 5);
161   --
162   hr_utility.set_location(' Leaving:'||l_proc, 10);
163 End post_delete;
164 --
165 -- ----------------------------------------------------------------------------
166 -- |---------------------------------< del >----------------------------------|
167 -- ----------------------------------------------------------------------------
168 Procedure del
169   (
170   p_rec	      in pay_mgr_shd.g_rec_type,
171   p_validate  in boolean default false
172   ) is
173 --
174   l_proc  varchar2(72) := g_package||'del';
175 --
176 Begin
177   hr_utility.set_location('Entering:'||l_proc, 5);
178   --
179   -- Determine if the business process is to be validated.
180   --
181   If p_validate then
182     --
183     -- Issue the savepoint.
184     --
185     SAVEPOINT del_pay_mgr;
186   End If;
187   --
188   -- We must lock the row which we need to delete.
189   --
190   pay_mgr_shd.lck
191 	(
192 	p_rec.magnetic_block_id,
193 	p_rec.sequence
194 	);
195   --
196   -- Call the supporting delete validate operation
197   --
198   pay_mgr_bus.delete_validate(p_rec);
199   --
200   -- Call the supporting pre-delete operation
204   -- Delete the row.
201   --
202   pre_delete(p_rec);
203   --
205   --
206   delete_dml(p_rec);
207   --
208   -- Call the supporting post-delete operation
209   --
210   post_delete(p_rec);
211   --
212   -- If we are validating then raise the Validate_Enabled exception
213   --
214   If p_validate then
215     Raise HR_Api.Validate_Enabled;
216   End If;
217   --
218   hr_utility.set_location(' Leaving:'||l_proc, 10);
219 Exception
220   When HR_Api.Validate_Enabled Then
221     --
222     -- As the Validate_Enabled exception has been raised
223     -- we must rollback to the savepoint
224     --
225     ROLLBACK TO del_pay_mgr;
226 End del;
227 --
228 -- ----------------------------------------------------------------------------
229 -- |---------------------------------< del >----------------------------------|
230 -- ----------------------------------------------------------------------------
231 Procedure del
232   (
233   p_magnetic_block_id                  in number,
234   p_sequence                           in number,
235   p_validate                           in boolean default false
236   ) is
237 --
238   l_rec	  pay_mgr_shd.g_rec_type;
239   l_proc  varchar2(72) := g_package||'del';
240 --
241 Begin
242   hr_utility.set_location('Entering:'||l_proc, 5);
243   --
244   -- As the delete procedure accepts a plsql record structure we do need to
245   -- convert the  arguments into the record structure.
246   -- We don't need to call the supplied conversion argument routine as we
247   -- only need a few attributes.
248   --
249   l_rec.magnetic_block_id:= p_magnetic_block_id;
250   l_rec.sequence:= p_sequence;
251   --
252   --
253   -- Having converted the arguments into the pay_mgr_rec
254   -- plsql record structure we must call the corresponding entity
255   -- business process
256   --
257   del(l_rec, p_validate);
258   --
259   hr_utility.set_location(' Leaving:'||l_proc, 10);
260 End del;
261 --
262 end pay_mgr_del;