DBA Data[Home] [Help]

PACKAGE BODY: APPS.PAY_PPE_UPD

Source


1 Package Body pay_ppe_upd as
2 /* $Header: pypperhi.pkb 115.2 2000/10/10 04:48:04 pkm ship        $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33) := '  pay_ppe_upd.';  -- Global package name
9 --
10 -- ----------------------------------------------------------------------------
11 -- |------------------------------< update_dml >------------------------------|
12 -- ----------------------------------------------------------------------------
13 -- {Start Of Comments}
14 --
15 -- Description:
16 --   This procedure controls the actual dml update logic. The processing of
17 --   this procedure is:
18 --   1) Increment the object_version_number by 1 if the object_version_number
19 --      is defined as an attribute for this entity.
20 --   2) To set and unset the g_api_dml status as required (as we are about to
21 --      perform dml).
22 --   3) To update the specified row in the schema using the primary key in
23 --      the predicates.
24 --   4) To trap any constraint violations that may have occurred.
25 --   5) To raise any other errors.
26 --
27 -- Prerequisites:
28 --   This is an internal private procedure which must be called from the upd
29 --   procedure.
30 --
31 -- In Parameters:
32 --   A Pl/Sql record structre.
33 --
34 -- Post Success:
35 --   The specified row will be updated in the schema.
36 --
37 -- Post Failure:
38 --   On the update dml failure it is important to note that we always reset the
39 --   g_api_dml status to false.
40 --   If a check, unique or parent integrity constraint violation is raised the
41 --   constraint_error procedure will be called.
42 --   If any other error is reported, the error will be raised after the
43 --   g_api_dml status is reset.
44 --
45 -- Developer Implementation Notes:
46 --   The update 'set' attribute list should be modified if any of your
47 --   attributes are not updateable.
48 --
49 -- Access Status:
50 --   Internal Row Handler Use Only.
51 --
52 -- {End Of Comments}
53 -- ----------------------------------------------------------------------------
54 Procedure update_dml
55   (p_rec in out pay_ppe_shd.g_rec_type
56   ) is
57 --
58   l_proc  varchar2(72) := g_package||'update_dml';
59 --
60 Begin
61   hr_utility.set_location('Entering:'||l_proc, 5);
62   --
63   -- Increment the object version
64   p_rec.object_version_number := p_rec.object_version_number + 1;
65   --
66   --
67   --
68   -- Update the pay_process_events Row
69   --
70   update pay_process_events
71     set
72      process_event_id                = p_rec.process_event_id
73     ,assignment_id                   = p_rec.assignment_id
74     ,effective_date                  = p_rec.effective_date
75     ,change_type                     = p_rec.change_type
76     ,status                          = p_rec.status
77     ,description                     = p_rec.description
78     ,object_version_number           = p_rec.object_version_number
79     where process_event_id = p_rec.process_event_id;
80   --
81   --
82   --
83   hr_utility.set_location(' Leaving:'||l_proc, 10);
84 --
85 Exception
86   When hr_api.check_integrity_violated Then
87     -- A check constraint has been violated
88     --
89     pay_ppe_shd.constraint_error
90       (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
91   When hr_api.parent_integrity_violated Then
92     -- Parent integrity has been violated
93     --
94     pay_ppe_shd.constraint_error
95       (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
96   When hr_api.unique_integrity_violated Then
97     -- Unique integrity has been violated
98     --
99     pay_ppe_shd.constraint_error
100       (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
101   When Others Then
102     --
103     Raise;
104 End update_dml;
105 --
106 -- ----------------------------------------------------------------------------
107 -- |------------------------------< pre_update >------------------------------|
108 -- ----------------------------------------------------------------------------
109 -- {Start Of Comments}
110 --
111 -- Description:
112 --   This private procedure contains any processing which is required before
113 --   the update dml.
114 --
115 -- Prerequisites:
116 --   This is an internal procedure which is called from the upd procedure.
117 --
118 -- In Parameters:
119 --   A Pl/Sql record structure.
120 --
121 -- Post Success:
122 --   Processing continues.
123 --
124 -- Post Failure:
125 --   If an error has occurred, an error message and exception wil be raised
126 --   but not handled.
127 --
128 -- Developer Implementation Notes:
129 --   Any pre-processing required before the update dml is issued should be
130 --   coded within this procedure. It is important to note that any 3rd party
131 --   maintenance should be reviewed before placing in this procedure.
132 --
133 -- Access Status:
134 --   Internal Row Handler Use Only.
135 --
136 -- {End Of Comments}
137 -- ----------------------------------------------------------------------------
138 Procedure pre_update
139   (p_rec in pay_ppe_shd.g_rec_type
140   ) is
141 --
142   l_proc  varchar2(72) := g_package||'pre_update';
143 --
144 Begin
145   hr_utility.set_location('Entering:'||l_proc, 5);
146   --
147   hr_utility.set_location(' Leaving:'||l_proc, 10);
148 End pre_update;
149 --
150 -- ----------------------------------------------------------------------------
151 -- |-----------------------------< post_update >------------------------------|
152 -- ----------------------------------------------------------------------------
153 -- {Start Of Comments}
154 --
155 -- Description:
156 --   This private procedure contains any processing which is required after the
157 --   update dml.
158 --
159 -- Prerequisites:
160 --   This is an internal procedure which is called from the upd 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 update 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_update
183   (p_rec                          in pay_ppe_shd.g_rec_type
184   ) is
185 --
186   l_proc  varchar2(72) := g_package||'post_update';
187 --
188 Begin
189   hr_utility.set_location('Entering:'||l_proc, 5);
190   hr_utility.set_location(' Leaving:'||l_proc, 10);
191 End post_update;
192 --
193 -- ----------------------------------------------------------------------------
194 -- |-----------------------------< convert_defs >-----------------------------|
195 -- ----------------------------------------------------------------------------
196 -- {Start Of Comments}
197 --
198 -- Description:
199 --   The Convert_Defs procedure has one very important function:
200 --   It must return the record structure for the row with all system defaulted
201 --   values converted into its corresponding parameter value for update. When
202 --   we attempt to update a row through the Upd process , certain
203 --   parameters can be defaulted which enables flexibility in the calling of
204 --   the upd process (e.g. only attributes which need to be updated need to be
205 --   specified). For the upd process to determine which attributes
206 --   have NOT been specified we need to check if the parameter has a reserved
207 --   system default value. Therefore, for all parameters which have a
208 --   corresponding reserved system default mechanism specified we need to
209 --   check if a system default is being used. If a system default is being
210 --   used then we convert the defaulted value into its corresponding attribute
211 --   value held in the g_old_rec data structure.
212 --
213 -- Prerequisites:
214 --   This private function can only be called from the upd process.
215 --
216 -- In Parameters:
217 --   A Pl/Sql record structure.
218 --
219 -- Post Success:
220 --   The record structure will be returned with all system defaulted parameter
221 --   values converted into its current row attribute value.
222 --
223 -- Post Failure:
224 --   No direct error handling is required within this function. Any possible
225 --   errors within this procedure will be a PL/SQL value error due to
226 --   conversion of datatypes or data lengths.
227 --
228 -- Developer Implementation Notes:
229 --   None.
230 --
231 -- Access Status:
232 --   Internal Row Handler Use Only.
233 --
234 -- {End Of Comments}
235 -- ----------------------------------------------------------------------------
236 Procedure convert_defs
237   (p_rec in out pay_ppe_shd.g_rec_type
238   ) is
239 --
240 Begin
241   --
242   -- We must now examine each argument value in the
243   -- p_rec plsql record structure
244   -- to see if a system default is being used. If a system default
245   -- is being used then we must set to the 'current' argument value.
246   --
247   If (p_rec.assignment_id = hr_api.g_number) then
248     p_rec.assignment_id :=
249     pay_ppe_shd.g_old_rec.assignment_id;
250   End If;
251   If (p_rec.effective_date = hr_api.g_date) then
252     p_rec.effective_date :=
253     pay_ppe_shd.g_old_rec.effective_date;
254   End If;
255   If (p_rec.change_type = hr_api.g_varchar2) then
256     p_rec.change_type :=
257     pay_ppe_shd.g_old_rec.change_type;
258   End If;
259   If (p_rec.status = hr_api.g_varchar2) then
260     p_rec.status :=
261     pay_ppe_shd.g_old_rec.status;
262   End If;
263   If (p_rec.description = hr_api.g_varchar2) then
264     p_rec.description :=
265     pay_ppe_shd.g_old_rec.description;
266   End If;
267   --
268 End convert_defs;
269 --
270 -- ----------------------------------------------------------------------------
271 -- |---------------------------------< upd >----------------------------------|
272 -- ----------------------------------------------------------------------------
273 Procedure upd
274   (p_rec                          in out pay_ppe_shd.g_rec_type
275   ) is
276 --
277   l_proc  varchar2(72) := g_package||'upd';
278 --
279 Begin
280   hr_utility.set_location('Entering:'||l_proc, 5);
281   --
282   -- We must lock the row which we need to update.
283   --
284   pay_ppe_shd.lck
285     (p_rec.process_event_id
286     ,p_rec.object_version_number
287     );
288   --
289   -- 1. During an update system defaults are used to determine if
290   --    arguments have been defaulted or not. We must therefore
291   --    derive the full record structure values to be updated.
292   --
293   -- 2. Call the supporting update validate operations.
294   --
295   convert_defs(p_rec);
296   pay_ppe_bus.update_validate
297      (p_rec
298      );
299   --
300   -- Call the supporting pre-update operation
301   --
302   pay_ppe_upd.pre_update(p_rec);
303   --
304   -- Update the row.
305   --
306   pay_ppe_upd.update_dml(p_rec);
307   --
308   -- Call the supporting post-update operation
309   --
310   pay_ppe_upd.post_update
311      (p_rec
312      );
313 End upd;
314 --
315 -- ----------------------------------------------------------------------------
316 -- |---------------------------------< upd >----------------------------------|
317 -- ----------------------------------------------------------------------------
318 Procedure upd
319   (p_process_event_id             in     number
320   ,p_object_version_number        in out number
321   ,p_assignment_id                in     number    default hr_api.g_number
322   ,p_effective_date               in     date      default hr_api.g_date
323   ,p_change_type                  in     varchar2  default hr_api.g_varchar2
324   ,p_status                       in     varchar2  default hr_api.g_varchar2
325   ,p_description                  in     varchar2  default hr_api.g_varchar2
326   ) is
327 --
328   l_rec   pay_ppe_shd.g_rec_type;
329   l_proc  varchar2(72) := g_package||'upd';
330 --
331 Begin
332   hr_utility.set_location('Entering:'||l_proc, 5);
333   --
334   -- Call conversion function to turn arguments into the
335   -- l_rec structure.
336   --
337   l_rec :=
338   pay_ppe_shd.convert_args
339   (p_process_event_id
340   ,p_assignment_id
341   ,p_effective_date
342   ,p_change_type
343   ,p_status
344   ,p_description
345   ,p_object_version_number
346   );
347   --
348   -- Having converted the arguments into the
349   -- plsql record structure we call the corresponding record
350   -- business process.
351   --
352   pay_ppe_upd.upd
353      (l_rec
354      );
355   p_object_version_number := l_rec.object_version_number;
356   --
357   hr_utility.set_location(' Leaving:'||l_proc, 10);
358 End upd;
359 --
360 end pay_ppe_upd;