DBA Data[Home] [Help]

PACKAGE BODY: APPS.SSP_ERN_DEL

Source


1 Package Body ssp_ern_del as
2 /* $Header: spernrhi.pkb 120.5.12010000.2 2008/08/13 13:25:38 ubhat ship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33)	:= '  ssp_ern_del.';  -- Global package name
9 --
10 -- ----------------------------------------------------------------------------
11 -- |------------------------------< delete_dml >------------------------------|
12 -- ----------------------------------------------------------------------------
13 --
14 -- Description:
15 --   This procedure controls the actual dml delete logic. The functions of
16 --   this procedure are as follows:
17 --   1) To set and unset the g_api_dml status as required (as we are about to
18 --      perform dml).
19 --   2) To delete the specified row from the schema using the primary key in
20 --      the predicates.
21 --   3) To trap any constraint violations that may have occurred.
22 --   4) To raise any other errors.
23 --
24 -- Pre Conditions:
25 --   This is an internal private procedure which must be called from the del
26 --   procedure.
27 --
28 -- In Parameters:
29 --   A Pl/Sql record structre.
30 --
31 -- Post Success:
32 --   The specified row will be delete from the schema.
33 --
34 -- Post Failure:
35 --   On the delete dml failure it is important to note that we always reset the
36 --   g_api_dml status to false.
37 --   If a child integrity constraint violation is raised the
38 --   constraint_error procedure will be called.
39 --   If any other error is reported, the error will be raised after the
40 --   g_api_dml status is reset.
41 --
42 -- Developer Implementation Notes:
43 --   None.
44 --
45 -- Access Status:
46 --   Internal Table Handler Use Only.
47 --
48 -- ----------------------------------------------------------------------------
49 Procedure delete_dml(p_rec in ssp_ern_shd.g_rec_type) is
50 --
51   l_proc  varchar2(72) := g_package||'delete_dml';
52 --
53 Begin
54   hr_utility.set_location('Entering:'||l_proc, 1);
55   --
56   ssp_ern_shd.g_api_dml := true;  -- Set the api dml status
57   --
58   -- Delete the ssp_earnings_calculations row.
59   --
60   delete from ssp_earnings_calculations
61    where earnings_calculations_id = p_rec.earnings_calculations_id;
62   --
63   ssp_ern_shd.g_api_dml := false;   -- Unset the api dml status
64   --
65   hr_utility.set_location('Leaving :'||l_proc, 100);
66 --
67 Exception
68   When hr_api.child_integrity_violated then
69     -- Child integrity has been violated
70     ssp_ern_shd.g_api_dml := false;   -- Unset the api dml status
71     ssp_ern_shd.constraint_error
72       (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
73   When Others Then
74     ssp_ern_shd.g_api_dml := false;   -- Unset the api dml status
75     Raise;
76 End delete_dml;
77 --
78 -- ----------------------------------------------------------------------------
79 -- |------------------------------< pre_delete >------------------------------|
80 -- ----------------------------------------------------------------------------
81 --
82 -- Description:
83 --   This private procedure contains any processing which is required before
84 --   the delete dml.
85 --
86 -- Pre Conditions:
87 --   This is an internal procedure which is called from the del procedure.
88 --
89 -- In Parameters:
90 --   A Pl/Sql record structre.
91 --
92 -- Post Success:
93 --   Processing continues.
94 --
95 -- Post Failure:
96 --   If an error has occurred, an error message and exception will be raised
97 --   but not handled.
98 --
99 -- Developer Implementation Notes:
100 --   Any pre-processing required before the delete dml is issued should be
101 --   coded within this procedure. It is important to note that any 3rd party
102 --   maintenance should be reviewed before placing in this procedure.
103 --
104 -- Access Status:
105 --   Internal Table Handler Use Only.
106 --
107 -- ----------------------------------------------------------------------------
108 Procedure pre_delete(p_rec in ssp_ern_shd.g_rec_type) is
109 --
110   l_proc  varchar2(72) := g_package||'pre_delete';
111 --
112 Begin
113   hr_utility.set_location('Entering:'||l_proc, 1);
114   --
115   hr_utility.set_location('Leaving :'||l_proc, 100);
116 End pre_delete;
117 --
118 -- ----------------------------------------------------------------------------
119 -- |-----------------------------< post_delete >------------------------------|
120 -- ----------------------------------------------------------------------------
121 --
122 -- Description:
123 --   This private procedure contains any processing which is required after the
124 --   delete dml.
125 --
126 -- Pre Conditions:
127 --   This is an internal procedure which is called from the del procedure.
128 --
129 -- In Parameters:
130 --   A Pl/Sql record structre.
131 --
132 -- Post Success:
133 --   Processing continues.
134 --
135 -- Post Failure:
136 --   If an error has occurred, an error message and exception will be raised
137 --   but not handled.
138 --
139 -- Developer Implementation Notes:
140 --   Any post-processing required after the delete dml is issued should be
141 --   coded within this procedure. It is important to note that any 3rd party
142 --   maintenance should be reviewed before placing in this procedure.
143 --
144 -- Access Status:
145 --   Internal table Handler Use Only.
146 --
147 -- ----------------------------------------------------------------------------
148 Procedure post_delete(p_rec in ssp_ern_shd.g_rec_type) is
149 --
150   l_proc  varchar2(72) := g_package||'post_delete';
151 --
152 Begin
153   hr_utility.set_location('Entering:'||l_proc, 1);
154   --
155   hr_utility.set_location('Leaving :'||l_proc, 100);
156 End post_delete;
157 --
158 -- ----------------------------------------------------------------------------
159 -- |---------------------------------< del >----------------------------------|
160 -- ----------------------------------------------------------------------------
161 Procedure del
162   (
163   p_rec	      in ssp_ern_shd.g_rec_type,
164   p_validate  in boolean default false
165   ) is
166 --
167   l_proc  varchar2(72) := g_package||'del';
168 --
169 Begin
170   hr_utility.set_location('Entering:'||l_proc, 1);
171   --
172   -- Determine if the business process is to be validated.
173   --
174   If p_validate then
175     --
176     -- Issue the savepoint.
177     --
178     SAVEPOINT del_ssp_ern;
179   End If;
180   --
181   -- We must lock the row which we need to delete.
182   --
183   ssp_ern_shd.lck (p_rec.earnings_calculations_id,p_rec.object_version_number);
184   --
185   -- Call the supporting delete validate operation
186   --
187   ssp_ern_bus.delete_validate(p_rec);
188   --
189   -- Call the supporting pre-delete operation
190   --
191   pre_delete(p_rec);
192   --
193   -- Delete the row.
194   --
195   delete_dml(p_rec);
196   --
197   -- Call the supporting post-delete operation
198   --
199   post_delete(p_rec);
200   --
201   -- If we are validating then raise the Validate_Enabled exception
202   --
203   If p_validate then
204     Raise HR_Api.Validate_Enabled;
205   End If;
206   --
207   hr_utility.set_location('Leaving :'||l_proc, 100);
208 Exception
209   When HR_Api.Validate_Enabled Then
210     --
211     -- As the Validate_Enabled exception has been raised rollback to savepoint
212     --
213     ROLLBACK TO del_ssp_ern;
214 End del;
215 --
216 -- ----------------------------------------------------------------------------
217 -- |---------------------------------< del >----------------------------------|
218 -- ----------------------------------------------------------------------------
219 Procedure del
220   (
221   p_earnings_calculations_id           in number,
222   p_object_version_number              in number,
223   p_validate                           in boolean default false
224   ) is
225 --
226   l_rec	  ssp_ern_shd.g_rec_type;
227   l_proc  varchar2(72) := g_package||'del';
228 --
229 Begin
230    hr_utility.set_location('Entering:'||l_proc, 1);
231    --
232    -- As the delete procedure accepts a plsql record structure we do need to
233    -- convert the arguments into the record structure. We don't need to call
234    -- the supplied conversion argument routine as we only need a few attributes.
235    --
236    l_rec.earnings_calculations_id:= p_earnings_calculations_id;
237    l_rec.object_version_number := p_object_version_number;
238    --
239    -- Having converted the arguments into the ssp_ern_rec plsql record structure
240    -- we must call the corresponding entity business process.
241    --
242    del(l_rec, p_validate);
243    --
244    hr_utility.set_location('Leaving :'||l_proc, 100);
245 End del;
246 --
247 end ssp_ern_del;