DBA Data[Home] [Help]

PACKAGE BODY: APPS.PAY_BLD_UPD

Source


1 Package Body pay_bld_upd 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_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 nocopy pay_bld_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   --
64   --
65   --
66   -- Update the pay_balance_dimensions Row
67   --
68   update pay_balance_dimensions
69     set
70      balance_dimension_id            = p_rec.balance_dimension_id
71     ,business_group_id               = p_rec.business_group_id
72     ,legislation_code                = p_rec.legislation_code
73     ,route_id                        = p_rec.route_id
74     ,database_item_suffix            = p_rec.database_item_suffix
75     ,dimension_name                  = p_rec.dimension_name
76     ,dimension_type                  = p_rec.dimension_type
77     ,description                     = p_rec.description
78     ,feed_checking_code              = p_rec.feed_checking_code
79     ,legislation_subgroup            = p_rec.legislation_subgroup
80     ,payments_flag                   = p_rec.payments_flag
81     ,expiry_checking_code            = p_rec.expiry_checking_code
82     ,expiry_checking_level           = p_rec.expiry_checking_level
83     ,feed_checking_type              = p_rec.feed_checking_type
84     ,dimension_level                 = p_rec.dimension_level
85     ,period_type                     = p_rec.period_type
86     ,asg_action_balance_dim_id       = p_rec.asg_action_balance_dim_id
87     ,database_item_function          = p_rec.database_item_function
88     ,save_run_balance_enabled        = p_rec.save_run_balance_enabled
89     ,start_date_code                 = p_rec.start_date_code
90     where balance_dimension_id = p_rec.balance_dimension_id;
91   --
92   --
93   --
94   hr_utility.set_location(' Leaving:'||l_proc, 10);
95 --
96 Exception
97   When hr_api.check_integrity_violated Then
98     -- A check constraint has been violated
99     --
100     pay_bld_shd.constraint_error
101       (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
102   When hr_api.parent_integrity_violated Then
103     -- Parent integrity has been violated
104     --
105     pay_bld_shd.constraint_error
106       (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
107   When hr_api.unique_integrity_violated Then
108     -- Unique integrity has been violated
109     --
110     pay_bld_shd.constraint_error
111       (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
112   When Others Then
113     --
114     Raise;
115 End update_dml;
116 --
117 -- ----------------------------------------------------------------------------
118 -- |------------------------------< pre_update >------------------------------|
119 -- ----------------------------------------------------------------------------
120 -- {Start Of Comments}
121 --
122 -- Description:
123 --   This private procedure contains any processing which is required before
124 --   the update dml.
125 --
126 -- Prerequisites:
127 --   This is an internal procedure which is called from the upd procedure.
128 --
129 -- In Parameters:
130 --   A Pl/Sql record structure.
131 --
132 -- Post Success:
133 --   Processing continues.
134 --
135 -- Post Failure:
136 --   If an error has occurred, an error message and exception wil be raised
137 --   but not handled.
138 --
139 -- Developer Implementation Notes:
140 --   Any pre-processing required before the update 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 Row Handler Use Only.
146 --
147 -- {End Of Comments}
148 -- ----------------------------------------------------------------------------
149 Procedure pre_update
150   (p_rec in pay_bld_shd.g_rec_type
151   ) is
152 --
153   l_proc  varchar2(72) := g_package||'pre_update';
154 --
155 Begin
156   hr_utility.set_location('Entering:'||l_proc, 5);
157   --
158   hr_utility.set_location(' Leaving:'||l_proc, 10);
159 End pre_update;
160 --
161 -- ----------------------------------------------------------------------------
162 -- |-----------------------------< post_update >------------------------------|
163 -- ----------------------------------------------------------------------------
164 -- {Start Of Comments}
165 --
166 -- Description:
167 --   This private procedure contains any processing which is required after
168 --   the update dml.
169 --
170 -- Prerequisites:
171 --   This is an internal procedure which is called from the upd procedure.
172 --
173 -- In Parameters:
174 --   A Pl/Sql record structure.
175 --
176 -- Post Success:
177 --   Processing continues.
178 --
179 -- Post Failure:
180 --   If an error has occurred, an error message and exception will be raised
181 --   but not handled.
182 --
183 -- Developer Implementation Notes:
184 --   Any post-processing required after the update dml is issued should be
185 --   coded within this procedure. It is important to note that any 3rd party
186 --   maintenance should be reviewed before placing in this procedure.
187 --
188 -- Access Status:
189 --   Internal Row Handler Use Only.
190 --
191 -- {End Of Comments}
192 -- ----------------------------------------------------------------------------
193 Procedure post_update
194   (p_rec                          in pay_bld_shd.g_rec_type
195   ) is
196 --
197   l_proc  varchar2(72) := g_package||'post_update';
198 --
199 Begin
200   hr_utility.set_location('Entering:'||l_proc, 5);
201   begin
202     --
203     pay_bld_rku.after_update
204       (p_balance_dimension_id
205       => p_rec.balance_dimension_id
206       ,p_business_group_id
207       => p_rec.business_group_id
208       ,p_legislation_code
209       => p_rec.legislation_code
210       ,p_route_id
211       => p_rec.route_id
212       ,p_database_item_suffix
213       => p_rec.database_item_suffix
214       ,p_dimension_name
215       => p_rec.dimension_name
216       ,p_dimension_type
217       => p_rec.dimension_type
218       ,p_description
219       => p_rec.description
220       ,p_feed_checking_code
221       => p_rec.feed_checking_code
222       ,p_legislation_subgroup
223       => p_rec.legislation_subgroup
224       ,p_payments_flag
225       => p_rec.payments_flag
226       ,p_expiry_checking_code
227       => p_rec.expiry_checking_code
228       ,p_expiry_checking_level
229       => p_rec.expiry_checking_level
230       ,p_feed_checking_type
231       => p_rec.feed_checking_type
232       ,p_dimension_level
233       => p_rec.dimension_level
234       ,p_period_type
235       => p_rec.period_type
236       ,p_asg_action_balance_dim_id
237       => p_rec.asg_action_balance_dim_id
238       ,p_database_item_function
239       => p_rec.database_item_function
240       ,p_save_run_balance_enabled
241       => p_rec.save_run_balance_enabled
242       ,p_start_date_code
243       => p_rec.start_date_code
244       ,p_business_group_id_o
245       => pay_bld_shd.g_old_rec.business_group_id
246       ,p_legislation_code_o
247       => pay_bld_shd.g_old_rec.legislation_code
248       ,p_route_id_o
249       => pay_bld_shd.g_old_rec.route_id
250       ,p_database_item_suffix_o
251       => pay_bld_shd.g_old_rec.database_item_suffix
252       ,p_dimension_name_o
253       => pay_bld_shd.g_old_rec.dimension_name
254       ,p_dimension_type_o
255       => pay_bld_shd.g_old_rec.dimension_type
256       ,p_description_o
257       => pay_bld_shd.g_old_rec.description
258       ,p_feed_checking_code_o
259       => pay_bld_shd.g_old_rec.feed_checking_code
260       ,p_legislation_subgroup_o
261       => pay_bld_shd.g_old_rec.legislation_subgroup
262       ,p_payments_flag_o
263       => pay_bld_shd.g_old_rec.payments_flag
264       ,p_expiry_checking_code_o
265       => pay_bld_shd.g_old_rec.expiry_checking_code
266       ,p_expiry_checking_level_o
267       => pay_bld_shd.g_old_rec.expiry_checking_level
268       ,p_feed_checking_type_o
269       => pay_bld_shd.g_old_rec.feed_checking_type
270       ,p_dimension_level_o
271       => pay_bld_shd.g_old_rec.dimension_level
272       ,p_period_type_o
273       => pay_bld_shd.g_old_rec.period_type
274       ,p_asg_action_balance_dim_id_o
275       => pay_bld_shd.g_old_rec.asg_action_balance_dim_id
276       ,p_database_item_function_o
277       => pay_bld_shd.g_old_rec.database_item_function
278       ,p_save_run_balance_enabled_o
279       => pay_bld_shd.g_old_rec.save_run_balance_enabled
280       ,p_start_date_code_o
281       => pay_bld_shd.g_old_rec.start_date_code
282       );
283     --
284   exception
285     --
286     when hr_api.cannot_find_prog_unit then
287       --
288       hr_api.cannot_find_prog_unit_error
289         (p_module_name => 'PAY_BALANCE_DIMENSIONS'
290         ,p_hook_type   => 'AU');
291       --
292   end;
293   --
294   hr_utility.set_location(' Leaving:'||l_proc, 10);
295 End post_update;
296 --
297 -- ----------------------------------------------------------------------------
298 -- |-----------------------------< convert_defs >-----------------------------|
299 -- ----------------------------------------------------------------------------
300 -- {Start Of Comments}
301 --
302 -- Description:
303 --   The Convert_Defs procedure has one very important function:
304 --   It must return the record structure for the row with all system defaulted
305 --   values converted into its corresponding parameter value for update. When
306 --   we attempt to update a row through the Upd process , certain
307 --   parameters can be defaulted which enables flexibility in the calling of
308 --   the upd process (e.g. only attributes which need to be updated need to be
309 --   specified). For the upd process to determine which attributes
310 --   have NOT been specified we need to check if the parameter has a reserved
311 --   system default value. Therefore, for all parameters which have a
312 --   corresponding reserved system default mechanism specified we need to
313 --   check if a system default is being used. If a system default is being
314 --   used then we convert the defaulted value into its corresponding attribute
315 --   value held in the g_old_rec data structure.
316 --
317 -- Prerequisites:
318 --   This private function can only be called from the upd process.
319 --
320 -- In Parameters:
321 --   A Pl/Sql record structure.
322 --
323 -- Post Success:
324 --   The record structure will be returned with all system defaulted parameter
325 --   values converted into its current row attribute value.
326 --
327 -- Post Failure:
328 --   No direct error handling is required within this function. Any possible
329 --   errors within this procedure will be a PL/SQL value error due to
330 --   conversion of datatypes or data lengths.
331 --
332 -- Developer Implementation Notes:
333 --   None.
334 --
335 -- Access Status:
336 --   Internal Row Handler Use Only.
337 --
338 -- {End Of Comments}
339 -- ----------------------------------------------------------------------------
340 Procedure convert_defs
341   (p_rec in out nocopy pay_bld_shd.g_rec_type
342   ) is
343 --
344 Begin
345   --
346   -- We must now examine each argument value in the
347   -- p_rec plsql record structure
348   -- to see if a system default is being used. If a system default
349   -- is being used then we must set to the 'current' argument value.
350   --
351   If (p_rec.business_group_id = hr_api.g_number) then
352     p_rec.business_group_id :=
353     pay_bld_shd.g_old_rec.business_group_id;
354   End If;
355   If (p_rec.legislation_code = hr_api.g_varchar2) then
356     p_rec.legislation_code :=
357     pay_bld_shd.g_old_rec.legislation_code;
358   End If;
359   If (p_rec.route_id = hr_api.g_number) then
360     p_rec.route_id :=
361     pay_bld_shd.g_old_rec.route_id;
362   End If;
363   If (p_rec.database_item_suffix = hr_api.g_varchar2) then
364     p_rec.database_item_suffix :=
365     pay_bld_shd.g_old_rec.database_item_suffix;
366   End If;
367   If (p_rec.dimension_name = hr_api.g_varchar2) then
368     p_rec.dimension_name :=
369     pay_bld_shd.g_old_rec.dimension_name;
370   End If;
371   If (p_rec.dimension_type = hr_api.g_varchar2) then
372     p_rec.dimension_type :=
373     pay_bld_shd.g_old_rec.dimension_type;
374   End If;
375   If (p_rec.description = hr_api.g_varchar2) then
376     p_rec.description :=
377     pay_bld_shd.g_old_rec.description;
378   End If;
379   If (p_rec.feed_checking_code = hr_api.g_varchar2) then
380     p_rec.feed_checking_code :=
381     pay_bld_shd.g_old_rec.feed_checking_code;
382   End If;
383   If (p_rec.legislation_subgroup = hr_api.g_varchar2) then
384     p_rec.legislation_subgroup :=
385     pay_bld_shd.g_old_rec.legislation_subgroup;
386   End If;
387   If (p_rec.payments_flag = hr_api.g_varchar2) then
388     p_rec.payments_flag :=
389     pay_bld_shd.g_old_rec.payments_flag;
390   End If;
391   If (p_rec.expiry_checking_code = hr_api.g_varchar2) then
392     p_rec.expiry_checking_code :=
393     pay_bld_shd.g_old_rec.expiry_checking_code;
394   End If;
395   If (p_rec.expiry_checking_level = hr_api.g_varchar2) then
396     p_rec.expiry_checking_level :=
397     pay_bld_shd.g_old_rec.expiry_checking_level;
398   End If;
399   If (p_rec.feed_checking_type = hr_api.g_varchar2) then
400     p_rec.feed_checking_type :=
401     pay_bld_shd.g_old_rec.feed_checking_type;
402   End If;
403   If (p_rec.dimension_level = hr_api.g_varchar2) then
404     p_rec.dimension_level :=
405     pay_bld_shd.g_old_rec.dimension_level;
406   End If;
407   If (p_rec.period_type = hr_api.g_varchar2) then
408     p_rec.period_type :=
409     pay_bld_shd.g_old_rec.period_type;
410   End If;
411   If (p_rec.asg_action_balance_dim_id = hr_api.g_number) then
412     p_rec.asg_action_balance_dim_id :=
413     pay_bld_shd.g_old_rec.asg_action_balance_dim_id;
414   End If;
415   If (p_rec.database_item_function = hr_api.g_varchar2) then
416     p_rec.database_item_function :=
417     pay_bld_shd.g_old_rec.database_item_function;
418   End If;
419   If (p_rec.save_run_balance_enabled = hr_api.g_varchar2) then
420     p_rec.save_run_balance_enabled :=
421     pay_bld_shd.g_old_rec.save_run_balance_enabled;
422   End If;
423   If (p_rec.start_date_code = hr_api.g_varchar2) then
424     p_rec.start_date_code :=
425     pay_bld_shd.g_old_rec.start_date_code;
426   End If;
427   --
428 End convert_defs;
429 --
430 -- ----------------------------------------------------------------------------
431 -- |---------------------------------< upd >----------------------------------|
432 -- ----------------------------------------------------------------------------
433 Procedure upd
434   (p_rec                          in out nocopy pay_bld_shd.g_rec_type
435   ) is
436 --
437   l_proc  varchar2(72) := g_package||'upd';
438 --
439 Begin
440   hr_utility.set_location('Entering:'||l_proc, 5);
441   --
442   -- We must lock the row which we need to update.
443   --
444   pay_bld_shd.lck
445     (p_rec.balance_dimension_id
446     );
447   --
448   -- 1. During an update system defaults are used to determine if
449   --    arguments have been defaulted or not. We must therefore
450   --    derive the full record structure values to be updated.
451   --
452   -- 2. Call the supporting update validate operations.
453   --
454   convert_defs(p_rec);
455   pay_bld_bus.update_validate
456      (p_rec
457      );
458   --
459   -- Call to raise any errors on multi-message list
460   hr_multi_message.end_validation_set;
461   --
462   -- Call the supporting pre-update operation
463   --
464   pay_bld_upd.pre_update(p_rec);
465   --
466   -- Update the row.
467   --
468   pay_bld_upd.update_dml(p_rec);
469   --
470   -- Call the supporting post-update operation
471   --
472   pay_bld_upd.post_update
473      (p_rec
474      );
475   --
476   -- Call to raise any errors on multi-message list
477   hr_multi_message.end_validation_set;
478 End upd;
479 --
480 -- ----------------------------------------------------------------------------
481 -- |---------------------------------< upd >----------------------------------|
482 -- ----------------------------------------------------------------------------
483 Procedure upd
484   (p_balance_dimension_id         in     number
485   ,p_route_id                     in     number    default hr_api.g_number
486   ,p_database_item_suffix         in     varchar2  default hr_api.g_varchar2
487   ,p_dimension_name               in     varchar2  default hr_api.g_varchar2
488   ,p_dimension_type               in     varchar2  default hr_api.g_varchar2
489   ,p_business_group_id            in     number    default hr_api.g_number
490   ,p_legislation_code             in     varchar2  default hr_api.g_varchar2
491   ,p_description                  in     varchar2  default hr_api.g_varchar2
492   ,p_feed_checking_code           in     varchar2  default hr_api.g_varchar2
493   ,p_legislation_subgroup         in     varchar2  default hr_api.g_varchar2
494   ,p_payments_flag                in     varchar2  default hr_api.g_varchar2
495   ,p_expiry_checking_code         in     varchar2  default hr_api.g_varchar2
496   ,p_expiry_checking_level        in     varchar2  default hr_api.g_varchar2
497   ,p_feed_checking_type           in     varchar2  default hr_api.g_varchar2
498   ,p_dimension_level              in     varchar2  default hr_api.g_varchar2
499   ,p_period_type                  in     varchar2  default hr_api.g_varchar2
500   ,p_asg_action_balance_dim_id    in     number    default hr_api.g_number
501   ,p_database_item_function       in     varchar2  default hr_api.g_varchar2
502   ,p_save_run_balance_enabled     in     varchar2  default hr_api.g_varchar2
503   ,p_start_date_code              in     varchar2  default hr_api.g_varchar2
504   ) is
505 --
506   l_rec   pay_bld_shd.g_rec_type;
507   l_proc  varchar2(72) := g_package||'upd';
508 --
509 Begin
510   hr_utility.set_location('Entering:'||l_proc, 5);
511   --
512   -- Call conversion function to turn arguments into the
513   -- l_rec structure.
514   --
515   l_rec :=
516   pay_bld_shd.convert_args
517   (p_balance_dimension_id
518   ,p_business_group_id
519   ,p_legislation_code
520   ,p_route_id
521   ,p_database_item_suffix
522   ,p_dimension_name
523   ,p_dimension_type
524   ,p_description
525   ,p_feed_checking_code
526   ,p_legislation_subgroup
527   ,p_payments_flag
528   ,p_expiry_checking_code
529   ,p_expiry_checking_level
530   ,p_feed_checking_type
531   ,p_dimension_level
532   ,p_period_type
533   ,p_asg_action_balance_dim_id
534   ,p_database_item_function
535   ,p_save_run_balance_enabled
536   ,p_start_date_code
537   );
538   --
539   -- Having converted the arguments into the
540   -- plsql record structure we call the corresponding record
541   -- business process.
542   --
543   pay_bld_upd.upd
544      (l_rec
545      );
546   --
547   --
548   hr_utility.set_location(' Leaving:'||l_proc, 10);
549 End upd;
550 --
551 end pay_bld_upd;