1 Package Body ben_pbm_upd as
2 /* $Header: bepbmrhi.pkb 115.6 2002/12/11 11:17:16 hnarayan ship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- | Private Global Definitions |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package varchar2(33) := ' ben_pbm_upd.'; -- Global package name
9 --
10 -- ----------------------------------------------------------------------------
11 -- |----------------------------< dt_update_dml >-----------------------------|
12 -- ----------------------------------------------------------------------------
13 -- {Start Of Comments}
14 --
15 -- Description:
16 -- This procedure controls the execution of dml from the datetrack mode
17 -- of CORRECTION only. It is important to note that the object version
18 -- number is only increment by 1 because the datetrack correction is
19 -- soley for one datetracked row.
20 -- This procedure controls the actual dml update logic. The functions of this
21 -- procedure are as follows:
22 -- 1) Get the next object_version_number.
23 -- 2) To set and unset the g_api_dml status as required (as we are about to
24 -- perform dml).
25 -- 3) To update the specified row in the schema using the primary key in
26 -- the predicates.
27 -- 4) To trap any constraint violations that may have occurred.
28 -- 5) To raise any other errors.
29 --
30 -- Prerequisites:
31 -- This is an internal private procedure which must be called from the
32 -- update_dml procedure.
33 --
34 -- In Parameters:
35 -- A Pl/Sql record structre.
36 --
37 -- Post Success:
38 -- The specified row will be updated in the schema.
39 --
40 -- Post Failure:
41 -- On the update dml failure it is important to note that we always reset the
42 -- g_api_dml status to false.
43 -- If a check or unique integrity constraint violation is raised the
44 -- constraint_error procedure will be called.
45 -- If any other error is reported, the error will be raised after the
46 -- g_api_dml status is reset.
47 --
48 -- Developer Implementation Notes:
49 -- The update 'set' arguments list should be modified if any of your
50 -- attributes are not updateable.
51 --
52 -- Access Status:
53 -- Internal Row Handler Use Only.
54 --
55 -- {End Of Comments}
56 -- ----------------------------------------------------------------------------
57 Procedure dt_update_dml
58 (p_rec in out nocopy ben_pbm_shd.g_rec_type,
59 p_effective_date in date,
60 p_datetrack_mode in varchar2,
61 p_validation_start_date in date,
62 p_validation_end_date in date) is
63 --
64 l_proc varchar2(72) := g_package||'dt_update_dml';
65 --
66 Begin
67 hr_utility.set_location('Entering:'||l_proc, 5);
68 --
69 If (p_datetrack_mode = 'CORRECTION') then
70 hr_utility.set_location(l_proc, 10);
71 --
72 -- Because we are updating a row we must get the next object
73 -- version number.
74 --
75 p_rec.object_version_number :=
76 dt_api.get_object_version_number
77 (p_base_table_name => 'ben_pl_r_oipl_prem_by_mo_f',
78 p_base_key_column => 'pl_r_oipl_prem_by_mo_id',
79 p_base_key_value => p_rec.pl_r_oipl_prem_by_mo_id);
80 --
81 ben_pbm_shd.g_api_dml := true; -- Set the api dml status
82 --
83 -- Update the ben_pl_r_oipl_prem_by_mo_f Row
84 --
85 update ben_pl_r_oipl_prem_by_mo_f
86 set
87 pl_r_oipl_prem_by_mo_id = p_rec.pl_r_oipl_prem_by_mo_id,
88 mnl_adj_flag = p_rec.mnl_adj_flag,
89 mo_num = p_rec.mo_num,
90 yr_num = p_rec.yr_num,
91 val = p_rec.val,
92 uom = p_rec.uom,
93 prtts_num = p_rec.prtts_num,
94 actl_prem_id = p_rec.actl_prem_id,
95 cost_allocation_keyflex_id = p_rec.cost_allocation_keyflex_id,
96 business_group_id = p_rec.business_group_id,
97 pbm_attribute_category = p_rec.pbm_attribute_category,
98 pbm_attribute1 = p_rec.pbm_attribute1,
99 pbm_attribute2 = p_rec.pbm_attribute2,
100 pbm_attribute3 = p_rec.pbm_attribute3,
101 pbm_attribute4 = p_rec.pbm_attribute4,
102 pbm_attribute5 = p_rec.pbm_attribute5,
103 pbm_attribute6 = p_rec.pbm_attribute6,
104 pbm_attribute7 = p_rec.pbm_attribute7,
105 pbm_attribute8 = p_rec.pbm_attribute8,
106 pbm_attribute9 = p_rec.pbm_attribute9,
107 pbm_attribute10 = p_rec.pbm_attribute10,
108 pbm_attribute11 = p_rec.pbm_attribute11,
109 pbm_attribute12 = p_rec.pbm_attribute12,
110 pbm_attribute13 = p_rec.pbm_attribute13,
111 pbm_attribute14 = p_rec.pbm_attribute14,
112 pbm_attribute15 = p_rec.pbm_attribute15,
113 pbm_attribute16 = p_rec.pbm_attribute16,
114 pbm_attribute17 = p_rec.pbm_attribute17,
115 pbm_attribute18 = p_rec.pbm_attribute18,
116 pbm_attribute19 = p_rec.pbm_attribute19,
117 pbm_attribute20 = p_rec.pbm_attribute20,
118 pbm_attribute21 = p_rec.pbm_attribute21,
119 pbm_attribute22 = p_rec.pbm_attribute22,
120 pbm_attribute23 = p_rec.pbm_attribute23,
121 pbm_attribute24 = p_rec.pbm_attribute24,
122 pbm_attribute25 = p_rec.pbm_attribute25,
123 pbm_attribute26 = p_rec.pbm_attribute26,
124 pbm_attribute27 = p_rec.pbm_attribute27,
125 pbm_attribute28 = p_rec.pbm_attribute28,
126 pbm_attribute29 = p_rec.pbm_attribute29,
127 pbm_attribute30 = p_rec.pbm_attribute30,
128 object_version_number = p_rec.object_version_number,
129 request_id = p_rec.request_id,
130 program_id = p_rec.program_id,
131 program_application_id = p_rec.program_application_id,
132 program_update_date = p_rec.program_update_date
133 where pl_r_oipl_prem_by_mo_id = p_rec.pl_r_oipl_prem_by_mo_id
134 and effective_start_date = p_validation_start_date
135 and effective_end_date = p_validation_end_date;
136 --
137 ben_pbm_shd.g_api_dml := false; -- Unset the api dml status
138 --
139 -- Set the effective start and end dates
140 --
141 p_rec.effective_start_date := p_validation_start_date;
142 p_rec.effective_end_date := p_validation_end_date;
143 End If;
144 --
145 hr_utility.set_location(' Leaving:'||l_proc, 15);
146 Exception
147 When hr_api.check_integrity_violated Then
148 -- A check constraint has been violated
149 ben_pbm_shd.g_api_dml := false; -- Unset the api dml status
150 ben_pbm_shd.constraint_error
151 (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
152 When hr_api.unique_integrity_violated Then
153 -- Unique integrity has been violated
154 ben_pbm_shd.g_api_dml := false; -- Unset the api dml status
155 ben_pbm_shd.constraint_error
156 (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
157 When Others Then
158 ben_pbm_shd.g_api_dml := false; -- Unset the api dml status
159 Raise;
160 End dt_update_dml;
161 --
162 -- ----------------------------------------------------------------------------
163 -- |------------------------------< update_dml >------------------------------|
164 -- ----------------------------------------------------------------------------
165 -- {Start Of Comments}
166 --
167 -- Description:
168 -- This procedure calls the dt_update_dml control logic which handles
169 -- the actual datetrack dml.
170 --
171 -- Prerequisites:
172 -- This is an internal private procedure which must be called from the upd
173 -- procedure.
174 --
175 -- In Parameters:
176 -- A Pl/Sql record structre.
177 --
178 -- Post Success:
179 -- Processing contines.
180 --
181 -- Post Failure:
182 -- No specific error handling is required within this procedure.
183 --
184 -- Developer Implementation Notes:
185 -- The update 'set' arguments list should be modified if any of your
186 -- attributes are not updateable.
187 --
188 -- Access Status:
189 -- Internal Row Handler Use Only.
190 --
191 -- {End Of Comments}
192 -- ----------------------------------------------------------------------------
193 Procedure update_dml
194 (p_rec in out nocopy ben_pbm_shd.g_rec_type,
195 p_effective_date in date,
196 p_datetrack_mode in varchar2,
197 p_validation_start_date in date,
198 p_validation_end_date in date) is
199 --
200 l_proc varchar2(72) := g_package||'update_dml';
201 --
202 Begin
203 hr_utility.set_location('Entering:'||l_proc, 5);
204 --
205 dt_update_dml(p_rec => p_rec,
206 p_effective_date => p_effective_date,
207 p_datetrack_mode => p_datetrack_mode,
208 p_validation_start_date => p_validation_start_date,
209 p_validation_end_date => p_validation_end_date);
210 --
211 hr_utility.set_location(' Leaving:'||l_proc, 10);
212 End update_dml;
213 --
214 -- ----------------------------------------------------------------------------
215 -- |----------------------------< dt_pre_update >-----------------------------|
216 -- ----------------------------------------------------------------------------
217 -- {Start Of Comments}
218 --
219 -- Description:
220 -- The dt_pre_update procedure controls the execution
221 -- of dml for the datetrack modes of: UPDATE, UPDATE_OVERRIDE
222 -- and UPDATE_CHANGE_INSERT only. The execution required is as
223 -- follows:
224 --
225 -- 1) Providing the datetrack update mode is not 'CORRECTION'
226 -- then set the effective end date of the current row (this
227 -- will be the validation_start_date - 1).
228 -- 2) If the datetrack mode is 'UPDATE_OVERRIDE' then call the
229 -- corresponding delete_dml process to delete any future rows
230 -- where the effective_start_date is greater than or equal to
231 -- the validation_start_date.
232 -- 3) Call the insert_dml process to insert the new updated row
233 -- details..
234 --
235 -- Prerequisites:
236 -- This is an internal procedure which is called from the
237 -- pre_update procedure.
238 --
239 -- In Parameters:
240 --
241 -- Post Success:
242 -- Processing continues.
243 --
244 -- Post Failure:
245 -- If an error has occurred, an error message and exception will be raised
246 -- but not handled.
247 --
248 -- Developer Implementation Notes:
249 -- This is an internal procedure which is required by Datetrack. Don't
250 -- remove or modify.
251 --
252 -- Access Status:
253 -- Internal Row Handler Use Only.
254 --
255 -- {End Of Comments}
256 -- ----------------------------------------------------------------------------
257 Procedure dt_pre_update
258 (p_rec in out nocopy ben_pbm_shd.g_rec_type,
259 p_effective_date in date,
260 p_datetrack_mode in varchar2,
261 p_validation_start_date in date,
262 p_validation_end_date in date) is
263 --
264 l_proc varchar2(72) := g_package||'dt_pre_update';
265 l_dummy_version_number number;
266 --
267 Begin
268 hr_utility.set_location('Entering:'||l_proc, 5);
269 If (p_datetrack_mode <> 'CORRECTION') then
270 hr_utility.set_location(l_proc, 10);
271 --
272 -- Update the current effective end date
273 --
274 ben_pbm_shd.upd_effective_end_date
275 (p_effective_date => p_effective_date,
276 p_base_key_value => p_rec.pl_r_oipl_prem_by_mo_id,
277 p_new_effective_end_date => (p_validation_start_date - 1),
278 p_validation_start_date => p_validation_start_date,
279 p_validation_end_date => p_validation_end_date,
280 p_object_version_number => l_dummy_version_number);
281 --
282 If (p_datetrack_mode = 'UPDATE_OVERRIDE') then
283 hr_utility.set_location(l_proc, 15);
284 --
285 -- As the datetrack mode is 'UPDATE_OVERRIDE' then we must
286 -- delete any future rows
287 --
288 ben_pbm_del.delete_dml
289 (p_rec => p_rec,
290 p_effective_date => p_effective_date,
291 p_datetrack_mode => p_datetrack_mode,
292 p_validation_start_date => p_validation_start_date,
293 p_validation_end_date => p_validation_end_date);
294 End If;
295 hr_utility.set_location(l_proc, 20);
296 --
297 -- We must now insert the updated row
298 --
299 ben_pbm_ins.insert_dml
300 (p_rec => p_rec,
301 p_effective_date => p_effective_date,
302 p_datetrack_mode => p_datetrack_mode,
303 p_validation_start_date => p_validation_start_date,
304 p_validation_end_date => p_validation_end_date);
305 End If;
306 hr_utility.set_location(' Leaving:'||l_proc, 20);
307 End dt_pre_update;
308 --
309 -- ----------------------------------------------------------------------------
310 -- |------------------------------< pre_update >------------------------------|
311 -- ----------------------------------------------------------------------------
312 -- {Start Of Comments}
313 --
314 -- Description:
315 -- This private procedure contains any processing which is required before
316 -- the update dml.
317 --
318 -- Prerequisites:
319 -- This is an internal procedure which is called from the upd procedure.
320 --
321 -- In Parameters:
322 -- A Pl/Sql record structre.
323 --
324 -- Post Success:
325 -- Processing continues.
326 --
327 -- Post Failure:
328 -- If an error has occurred, an error message and exception will be raised
329 -- but not handled.
330 --
331 -- Developer Implementation Notes:
332 -- Any pre-processing required before the update dml is issued should be
333 -- coded within this procedure. It is important to note that any 3rd party
334 -- maintenance should be reviewed before placing in this procedure. The call
335 -- to the dt_update_dml procedure should NOT be removed.
336 --
337 -- Access Status:
338 -- Internal Row Handler Use Only.
339 --
340 -- {End Of Comments}
341 -- ----------------------------------------------------------------------------
342 Procedure pre_update
343 (p_rec in out nocopy ben_pbm_shd.g_rec_type,
344 p_effective_date in date,
345 p_datetrack_mode in varchar2,
346 p_validation_start_date in date,
347 p_validation_end_date in date) is
348 --
349 l_proc varchar2(72) := g_package||'pre_update';
350 --
351 Begin
352 hr_utility.set_location('Entering:'||l_proc, 5);
353 --
354 --
355 --
356 dt_pre_update
357 (p_rec => p_rec,
358 p_effective_date => p_effective_date,
359 p_datetrack_mode => p_datetrack_mode,
360 p_validation_start_date => p_validation_start_date,
361 p_validation_end_date => p_validation_end_date);
362 --
363 hr_utility.set_location(' Leaving:'||l_proc, 10);
364 End pre_update;
365 --
366 -- ----------------------------------------------------------------------------
367 -- |-----------------------------< post_update >------------------------------|
368 -- ----------------------------------------------------------------------------
369 -- {Start Of Comments}
370 --
371 -- Description:
372 -- This private procedure contains any processing which is required after the
373 -- update dml.
374 --
375 -- Prerequisites:
376 -- This is an internal procedure which is called from the upd procedure.
377 --
378 -- In Parameters:
379 -- A Pl/Sql record structre.
380 --
381 -- Post Success:
382 -- Processing continues.
383 --
384 -- Post Failure:
385 -- If an error has occurred, an error message and exception will be raised
386 -- but not handled.
387 --
388 -- Developer Implementation Notes:
389 -- Any post-processing required after the update dml is issued should be
390 -- coded within this procedure. It is important to note that any 3rd party
391 -- maintenance should be reviewed before placing in this procedure.
392 --
393 -- Access Status:
394 -- Internal Row Handler Use Only.
395 --
396 -- {End Of Comments}
397 -- ----------------------------------------------------------------------------
398 Procedure post_update
399 (p_rec in ben_pbm_shd.g_rec_type,
400 p_effective_date in date,
401 p_datetrack_mode in varchar2,
402 p_validation_start_date in date,
403 p_validation_end_date in date) is
404 --
405 l_proc varchar2(72) := g_package||'post_update';
406 --
407 Begin
408 hr_utility.set_location('Entering:'||l_proc, 5);
409 --
410 --
411 -- Start of API User Hook for post_update.
412 --
413 begin
414 --
415 ben_pbm_rku.after_update
416 (
417 p_pl_r_oipl_prem_by_mo_id =>p_rec.pl_r_oipl_prem_by_mo_id
418 ,p_effective_start_date =>p_rec.effective_start_date
419 ,p_effective_end_date =>p_rec.effective_end_date
420 ,p_mnl_adj_flag =>p_rec.mnl_adj_flag
421 ,p_mo_num =>p_rec.mo_num
422 ,p_yr_num =>p_rec.yr_num
423 ,p_val =>p_rec.val
424 ,p_uom =>p_rec.uom
425 ,p_prtts_num =>p_rec.prtts_num
426 ,p_actl_prem_id =>p_rec.actl_prem_id
427 ,p_cost_allocation_keyflex_id => p_rec.cost_allocation_keyflex_id
428 ,p_business_group_id =>p_rec.business_group_id
429 ,p_pbm_attribute_category =>p_rec.pbm_attribute_category
430 ,p_pbm_attribute1 =>p_rec.pbm_attribute1
431 ,p_pbm_attribute2 =>p_rec.pbm_attribute2
432 ,p_pbm_attribute3 =>p_rec.pbm_attribute3
433 ,p_pbm_attribute4 =>p_rec.pbm_attribute4
434 ,p_pbm_attribute5 =>p_rec.pbm_attribute5
435 ,p_pbm_attribute6 =>p_rec.pbm_attribute6
436 ,p_pbm_attribute7 =>p_rec.pbm_attribute7
437 ,p_pbm_attribute8 =>p_rec.pbm_attribute8
438 ,p_pbm_attribute9 =>p_rec.pbm_attribute9
439 ,p_pbm_attribute10 =>p_rec.pbm_attribute10
440 ,p_pbm_attribute11 =>p_rec.pbm_attribute11
441 ,p_pbm_attribute12 =>p_rec.pbm_attribute12
442 ,p_pbm_attribute13 =>p_rec.pbm_attribute13
443 ,p_pbm_attribute14 =>p_rec.pbm_attribute14
444 ,p_pbm_attribute15 =>p_rec.pbm_attribute15
445 ,p_pbm_attribute16 =>p_rec.pbm_attribute16
446 ,p_pbm_attribute17 =>p_rec.pbm_attribute17
447 ,p_pbm_attribute18 =>p_rec.pbm_attribute18
448 ,p_pbm_attribute19 =>p_rec.pbm_attribute19
449 ,p_pbm_attribute20 =>p_rec.pbm_attribute20
450 ,p_pbm_attribute21 =>p_rec.pbm_attribute21
451 ,p_pbm_attribute22 =>p_rec.pbm_attribute22
452 ,p_pbm_attribute23 =>p_rec.pbm_attribute23
453 ,p_pbm_attribute24 =>p_rec.pbm_attribute24
454 ,p_pbm_attribute25 =>p_rec.pbm_attribute25
455 ,p_pbm_attribute26 =>p_rec.pbm_attribute26
456 ,p_pbm_attribute27 =>p_rec.pbm_attribute27
457 ,p_pbm_attribute28 =>p_rec.pbm_attribute28
458 ,p_pbm_attribute29 =>p_rec.pbm_attribute29
459 ,p_pbm_attribute30 =>p_rec.pbm_attribute30
460 ,p_object_version_number =>p_rec.object_version_number
461 ,p_request_id =>p_rec.request_id
462 ,p_program_id =>p_rec.program_id
463 ,p_program_application_id =>p_rec.program_application_id
464 ,p_program_update_date =>p_rec.program_update_date
465 ,p_effective_date =>p_effective_date
466 ,p_datetrack_mode =>p_datetrack_mode
467 ,p_validation_start_date =>p_validation_start_date
468 ,p_validation_end_date =>p_validation_end_date
469 ,p_effective_start_date_o =>ben_pbm_shd.g_old_rec.effective_start_date
470 ,p_effective_end_date_o =>ben_pbm_shd.g_old_rec.effective_end_date
471 ,p_mnl_adj_flag_o =>ben_pbm_shd.g_old_rec.mnl_adj_flag
472 ,p_mo_num_o =>ben_pbm_shd.g_old_rec.mo_num
473 ,p_yr_num_o =>ben_pbm_shd.g_old_rec.yr_num
474 ,p_val_o =>ben_pbm_shd.g_old_rec.val
475 ,p_uom_o =>ben_pbm_shd.g_old_rec.uom
476 ,p_prtts_num_o =>ben_pbm_shd.g_old_rec.prtts_num
477 ,p_actl_prem_id_o =>ben_pbm_shd.g_old_rec.actl_prem_id
478 ,p_cost_allocation_keyflex_id_o =>ben_pbm_shd.g_old_rec.cost_allocation_keyflex_id
479 ,p_business_group_id_o =>ben_pbm_shd.g_old_rec.business_group_id
480 ,p_pbm_attribute_category_o =>ben_pbm_shd.g_old_rec.pbm_attribute_category
481 ,p_pbm_attribute1_o =>ben_pbm_shd.g_old_rec.pbm_attribute1
482 ,p_pbm_attribute2_o =>ben_pbm_shd.g_old_rec.pbm_attribute2
483 ,p_pbm_attribute3_o =>ben_pbm_shd.g_old_rec.pbm_attribute3
484 ,p_pbm_attribute4_o =>ben_pbm_shd.g_old_rec.pbm_attribute4
485 ,p_pbm_attribute5_o =>ben_pbm_shd.g_old_rec.pbm_attribute5
486 ,p_pbm_attribute6_o =>ben_pbm_shd.g_old_rec.pbm_attribute6
487 ,p_pbm_attribute7_o =>ben_pbm_shd.g_old_rec.pbm_attribute7
488 ,p_pbm_attribute8_o =>ben_pbm_shd.g_old_rec.pbm_attribute8
489 ,p_pbm_attribute9_o =>ben_pbm_shd.g_old_rec.pbm_attribute9
490 ,p_pbm_attribute10_o =>ben_pbm_shd.g_old_rec.pbm_attribute10
491 ,p_pbm_attribute11_o =>ben_pbm_shd.g_old_rec.pbm_attribute11
492 ,p_pbm_attribute12_o =>ben_pbm_shd.g_old_rec.pbm_attribute12
493 ,p_pbm_attribute13_o =>ben_pbm_shd.g_old_rec.pbm_attribute13
494 ,p_pbm_attribute14_o =>ben_pbm_shd.g_old_rec.pbm_attribute14
495 ,p_pbm_attribute15_o =>ben_pbm_shd.g_old_rec.pbm_attribute15
496 ,p_pbm_attribute16_o =>ben_pbm_shd.g_old_rec.pbm_attribute16
497 ,p_pbm_attribute17_o =>ben_pbm_shd.g_old_rec.pbm_attribute17
498 ,p_pbm_attribute18_o =>ben_pbm_shd.g_old_rec.pbm_attribute18
499 ,p_pbm_attribute19_o =>ben_pbm_shd.g_old_rec.pbm_attribute19
500 ,p_pbm_attribute20_o =>ben_pbm_shd.g_old_rec.pbm_attribute20
501 ,p_pbm_attribute21_o =>ben_pbm_shd.g_old_rec.pbm_attribute21
502 ,p_pbm_attribute22_o =>ben_pbm_shd.g_old_rec.pbm_attribute22
503 ,p_pbm_attribute23_o =>ben_pbm_shd.g_old_rec.pbm_attribute23
504 ,p_pbm_attribute24_o =>ben_pbm_shd.g_old_rec.pbm_attribute24
505 ,p_pbm_attribute25_o =>ben_pbm_shd.g_old_rec.pbm_attribute25
506 ,p_pbm_attribute26_o =>ben_pbm_shd.g_old_rec.pbm_attribute26
507 ,p_pbm_attribute27_o =>ben_pbm_shd.g_old_rec.pbm_attribute27
508 ,p_pbm_attribute28_o =>ben_pbm_shd.g_old_rec.pbm_attribute28
509 ,p_pbm_attribute29_o =>ben_pbm_shd.g_old_rec.pbm_attribute29
510 ,p_pbm_attribute30_o =>ben_pbm_shd.g_old_rec.pbm_attribute30
511 ,p_object_version_number_o =>ben_pbm_shd.g_old_rec.object_version_number
512 ,p_request_id_o =>ben_pbm_shd.g_old_rec.request_id
513 ,p_program_id_o =>ben_pbm_shd.g_old_rec.program_id
514 ,p_program_application_id_o =>ben_pbm_shd.g_old_rec.program_application_id
515 ,p_program_update_date_o =>ben_pbm_shd.g_old_rec.program_update_date
516 );
517 --
518 exception
519 --
520 when hr_api.cannot_find_prog_unit then
521 --
522 hr_api.cannot_find_prog_unit_error
523 (p_module_name => 'ben_pl_r_oipl_prem_by_mo_f'
524 ,p_hook_type => 'AU');
525 --
526 end;
527 --
528 -- End of API User Hook for post_update.
529 --
530 --
531 hr_utility.set_location(' Leaving:'||l_proc, 10);
532 End post_update;
533 --
534 -- ----------------------------------------------------------------------------
535 -- |-----------------------------< convert_defs >-----------------------------|
536 -- ----------------------------------------------------------------------------
537 -- {Start Of Comments}
538 --
539 -- Description:
540 -- The Convert_Defs procedure has one very important function:
541 -- It must return the record structure for the row with all system defaulted
542 -- values converted into its corresponding parameter value for update. When
543 -- we attempt to update a row through the Upd process , certain
544 -- parameters can be defaulted which enables flexibility in the calling of
545 -- the upd process (e.g. only attributes which need to be updated need to be
546 -- specified). For the upd process to determine which attributes
547 -- have NOT been specified we need to check if the parameter has a reserved
548 -- system default value. Therefore, for all parameters which have a
549 -- corresponding reserved system default mechanism specified we need to
550 -- check if a system default is being used. If a system default is being
551 -- used then we convert the defaulted value into its corresponding attribute
552 -- value held in the g_old_rec data structure.
553 --
554 -- Prerequisites:
555 -- This private function can only be called from the upd process.
556 --
557 -- In Parameters:
558 -- A Pl/Sql record structre.
559 --
560 -- Post Success:
561 -- The record structure will be returned with all system defaulted parameter
562 -- values converted into its current row attribute value.
563 --
564 -- Post Failure:
565 -- No direct error handling is required within this function. Any possible
566 -- errors within this procedure will be a PL/SQL value error due to conversion
567 -- of datatypes or data lengths.
568 --
569 -- Developer Implementation Notes:
570 -- None.
571 --
572 -- Access Status:
573 -- Internal Row Handler Use Only.
574 --
575 -- {End Of Comments}
576 -- ----------------------------------------------------------------------------
577 Procedure convert_defs(p_rec in out nocopy ben_pbm_shd.g_rec_type) is
578 --
579 l_proc varchar2(72) := g_package||'convert_defs';
580 --
581 Begin
582 --
583 hr_utility.set_location('Entering:'||l_proc, 5);
584 --
585 -- We must now examine each argument value in the
586 -- p_rec plsql record structure
587 -- to see if a system default is being used. If a system default
588 -- is being used then we must set to the 'current' argument value.
589 --
590 If (p_rec.mnl_adj_flag = hr_api.g_varchar2) then
591 p_rec.mnl_adj_flag :=
592 ben_pbm_shd.g_old_rec.mnl_adj_flag;
593 End If;
594 If (p_rec.mo_num = hr_api.g_number) then
595 p_rec.mo_num :=
596 ben_pbm_shd.g_old_rec.mo_num;
597 End If;
598 If (p_rec.yr_num = hr_api.g_number) then
599 p_rec.yr_num :=
600 ben_pbm_shd.g_old_rec.yr_num;
601 End If;
602 If (p_rec.val = hr_api.g_number) then
603 p_rec.val :=
604 ben_pbm_shd.g_old_rec.val;
605 End If;
606 If (p_rec.uom = hr_api.g_varchar2) then
607 p_rec.uom :=
608 ben_pbm_shd.g_old_rec.uom;
609 End If;
610 If (p_rec.prtts_num = hr_api.g_number) then
611 p_rec.prtts_num :=
612 ben_pbm_shd.g_old_rec.prtts_num;
613 End If;
614 If (p_rec.actl_prem_id = hr_api.g_number) then
615 p_rec.actl_prem_id :=
616 ben_pbm_shd.g_old_rec.actl_prem_id;
617 End If;
618 If (p_rec.cost_allocation_keyflex_id = hr_api.g_number) then
619 p_rec.cost_allocation_keyflex_id :=
620 ben_pbm_shd.g_old_rec.cost_allocation_keyflex_id;
621 End If;
622 If (p_rec.business_group_id = hr_api.g_number) then
623 p_rec.business_group_id :=
624 ben_pbm_shd.g_old_rec.business_group_id;
625 End If;
626 If (p_rec.pbm_attribute_category = hr_api.g_varchar2) then
627 p_rec.pbm_attribute_category :=
628 ben_pbm_shd.g_old_rec.pbm_attribute_category;
629 End If;
630 If (p_rec.pbm_attribute1 = hr_api.g_varchar2) then
631 p_rec.pbm_attribute1 :=
632 ben_pbm_shd.g_old_rec.pbm_attribute1;
633 End If;
634 If (p_rec.pbm_attribute2 = hr_api.g_varchar2) then
635 p_rec.pbm_attribute2 :=
636 ben_pbm_shd.g_old_rec.pbm_attribute2;
637 End If;
638 If (p_rec.pbm_attribute3 = hr_api.g_varchar2) then
639 p_rec.pbm_attribute3 :=
640 ben_pbm_shd.g_old_rec.pbm_attribute3;
641 End If;
642 If (p_rec.pbm_attribute4 = hr_api.g_varchar2) then
643 p_rec.pbm_attribute4 :=
644 ben_pbm_shd.g_old_rec.pbm_attribute4;
645 End If;
646 If (p_rec.pbm_attribute5 = hr_api.g_varchar2) then
647 p_rec.pbm_attribute5 :=
648 ben_pbm_shd.g_old_rec.pbm_attribute5;
649 End If;
650 If (p_rec.pbm_attribute6 = hr_api.g_varchar2) then
651 p_rec.pbm_attribute6 :=
652 ben_pbm_shd.g_old_rec.pbm_attribute6;
653 End If;
654 If (p_rec.pbm_attribute7 = hr_api.g_varchar2) then
655 p_rec.pbm_attribute7 :=
656 ben_pbm_shd.g_old_rec.pbm_attribute7;
657 End If;
658 If (p_rec.pbm_attribute8 = hr_api.g_varchar2) then
659 p_rec.pbm_attribute8 :=
660 ben_pbm_shd.g_old_rec.pbm_attribute8;
661 End If;
662 If (p_rec.pbm_attribute9 = hr_api.g_varchar2) then
663 p_rec.pbm_attribute9 :=
664 ben_pbm_shd.g_old_rec.pbm_attribute9;
665 End If;
666 If (p_rec.pbm_attribute10 = hr_api.g_varchar2) then
667 p_rec.pbm_attribute10 :=
668 ben_pbm_shd.g_old_rec.pbm_attribute10;
669 End If;
670 If (p_rec.pbm_attribute11 = hr_api.g_varchar2) then
671 p_rec.pbm_attribute11 :=
672 ben_pbm_shd.g_old_rec.pbm_attribute11;
673 End If;
674 If (p_rec.pbm_attribute12 = hr_api.g_varchar2) then
675 p_rec.pbm_attribute12 :=
676 ben_pbm_shd.g_old_rec.pbm_attribute12;
677 End If;
678 If (p_rec.pbm_attribute13 = hr_api.g_varchar2) then
679 p_rec.pbm_attribute13 :=
680 ben_pbm_shd.g_old_rec.pbm_attribute13;
681 End If;
682 If (p_rec.pbm_attribute14 = hr_api.g_varchar2) then
683 p_rec.pbm_attribute14 :=
684 ben_pbm_shd.g_old_rec.pbm_attribute14;
685 End If;
686 If (p_rec.pbm_attribute15 = hr_api.g_varchar2) then
687 p_rec.pbm_attribute15 :=
688 ben_pbm_shd.g_old_rec.pbm_attribute15;
689 End If;
690 If (p_rec.pbm_attribute16 = hr_api.g_varchar2) then
691 p_rec.pbm_attribute16 :=
692 ben_pbm_shd.g_old_rec.pbm_attribute16;
693 End If;
694 If (p_rec.pbm_attribute17 = hr_api.g_varchar2) then
695 p_rec.pbm_attribute17 :=
696 ben_pbm_shd.g_old_rec.pbm_attribute17;
697 End If;
698 If (p_rec.pbm_attribute18 = hr_api.g_varchar2) then
699 p_rec.pbm_attribute18 :=
700 ben_pbm_shd.g_old_rec.pbm_attribute18;
701 End If;
702 If (p_rec.pbm_attribute19 = hr_api.g_varchar2) then
703 p_rec.pbm_attribute19 :=
704 ben_pbm_shd.g_old_rec.pbm_attribute19;
705 End If;
706 If (p_rec.pbm_attribute20 = hr_api.g_varchar2) then
707 p_rec.pbm_attribute20 :=
708 ben_pbm_shd.g_old_rec.pbm_attribute20;
709 End If;
710 If (p_rec.pbm_attribute21 = hr_api.g_varchar2) then
711 p_rec.pbm_attribute21 :=
712 ben_pbm_shd.g_old_rec.pbm_attribute21;
713 End If;
714 If (p_rec.pbm_attribute22 = hr_api.g_varchar2) then
715 p_rec.pbm_attribute22 :=
716 ben_pbm_shd.g_old_rec.pbm_attribute22;
717 End If;
718 If (p_rec.pbm_attribute23 = hr_api.g_varchar2) then
719 p_rec.pbm_attribute23 :=
720 ben_pbm_shd.g_old_rec.pbm_attribute23;
721 End If;
722 If (p_rec.pbm_attribute24 = hr_api.g_varchar2) then
723 p_rec.pbm_attribute24 :=
724 ben_pbm_shd.g_old_rec.pbm_attribute24;
725 End If;
726 If (p_rec.pbm_attribute25 = hr_api.g_varchar2) then
727 p_rec.pbm_attribute25 :=
728 ben_pbm_shd.g_old_rec.pbm_attribute25;
729 End If;
730 If (p_rec.pbm_attribute26 = hr_api.g_varchar2) then
731 p_rec.pbm_attribute26 :=
732 ben_pbm_shd.g_old_rec.pbm_attribute26;
733 End If;
734 If (p_rec.pbm_attribute27 = hr_api.g_varchar2) then
735 p_rec.pbm_attribute27 :=
736 ben_pbm_shd.g_old_rec.pbm_attribute27;
737 End If;
738 If (p_rec.pbm_attribute28 = hr_api.g_varchar2) then
739 p_rec.pbm_attribute28 :=
740 ben_pbm_shd.g_old_rec.pbm_attribute28;
741 End If;
742 If (p_rec.pbm_attribute29 = hr_api.g_varchar2) then
743 p_rec.pbm_attribute29 :=
744 ben_pbm_shd.g_old_rec.pbm_attribute29;
745 End If;
746 If (p_rec.pbm_attribute30 = hr_api.g_varchar2) then
747 p_rec.pbm_attribute30 :=
748 ben_pbm_shd.g_old_rec.pbm_attribute30;
749 End If;
750 If (p_rec.request_id = hr_api.g_number) then
751 p_rec.request_id :=
752 ben_pbm_shd.g_old_rec.request_id;
753 End If;
754 If (p_rec.program_id = hr_api.g_number) then
755 p_rec.program_id :=
756 ben_pbm_shd.g_old_rec.program_id;
757 End If;
758 If (p_rec.program_application_id = hr_api.g_number) then
759 p_rec.program_application_id :=
760 ben_pbm_shd.g_old_rec.program_application_id;
761 End If;
762 If (p_rec.program_update_date = hr_api.g_date) then
763 p_rec.program_update_date:=
764 ben_pbm_shd.g_old_rec.program_update_date;
765 End If;
766
767 --
768 hr_utility.set_location(' Leaving:'||l_proc, 10);
769 --
770 End convert_defs;
771 --
772 -- ----------------------------------------------------------------------------
773 -- |---------------------------------< upd >----------------------------------|
774 -- ----------------------------------------------------------------------------
775 Procedure upd
776 (
777 p_rec in out nocopy ben_pbm_shd.g_rec_type,
778 p_effective_date in date,
779 p_datetrack_mode in varchar2
780 ) is
781 --
782 l_proc varchar2(72) := g_package||'upd';
783 l_validation_start_date date;
784 l_validation_end_date date;
785 --
786 Begin
787 hr_utility.set_location('Entering:'||l_proc, 5);
788 --
789 -- Ensure that the DateTrack update mode is valid
790 --
791 dt_api.validate_dt_upd_mode(p_datetrack_mode => p_datetrack_mode);
792 --
793 -- We must lock the row which we need to update.
794 --
795 ben_pbm_shd.lck
796 (p_effective_date => p_effective_date,
797 p_datetrack_mode => p_datetrack_mode,
798 p_pl_r_oipl_prem_by_mo_id => p_rec.pl_r_oipl_prem_by_mo_id,
799 p_object_version_number => p_rec.object_version_number,
800 p_validation_start_date => l_validation_start_date,
801 p_validation_end_date => l_validation_end_date);
802 --
803 -- 1. During an update system defaults are used to determine if
804 -- arguments have been defaulted or not. We must therefore
805 -- derive the full record structure values to be updated.
806 --
807 -- 2. Call the supporting update validate operations.
808 --
809 convert_defs(p_rec);
810 ben_pbm_bus.update_validate
811 (p_rec => p_rec,
812 p_effective_date => p_effective_date,
813 p_datetrack_mode => p_datetrack_mode,
814 p_validation_start_date => l_validation_start_date,
815 p_validation_end_date => l_validation_end_date);
816 --
817 -- Call the supporting pre-update operation
818 --
819 pre_update
820 (p_rec => p_rec,
821 p_effective_date => p_effective_date,
822 p_datetrack_mode => p_datetrack_mode,
823 p_validation_start_date => l_validation_start_date,
824 p_validation_end_date => l_validation_end_date);
825 --
826 -- Update the row.
827 --
828 update_dml
829 (p_rec => p_rec,
830 p_effective_date => p_effective_date,
831 p_datetrack_mode => p_datetrack_mode,
832 p_validation_start_date => l_validation_start_date,
833 p_validation_end_date => l_validation_end_date);
834 --
835 -- Call the supporting post-update operation
836 --
837 post_update
838 (p_rec => p_rec,
839 p_effective_date => p_effective_date,
840 p_datetrack_mode => p_datetrack_mode,
841 p_validation_start_date => l_validation_start_date,
842 p_validation_end_date => l_validation_end_date);
843 End upd;
844 --
845 -- ----------------------------------------------------------------------------
846 -- |---------------------------------< upd >----------------------------------|
847 -- ----------------------------------------------------------------------------
848 Procedure upd
849 (
850 p_pl_r_oipl_prem_by_mo_id in number,
851 p_effective_start_date out nocopy date,
852 p_effective_end_date out nocopy date,
853 p_mnl_adj_flag in varchar2 default hr_api.g_varchar2,
854 p_mo_num in number default hr_api.g_number,
855 p_yr_num in number default hr_api.g_number,
856 p_val in number default hr_api.g_number,
857 p_uom in varchar2 default hr_api.g_varchar2,
858 p_prtts_num in number default hr_api.g_number,
859 p_actl_prem_id in number default hr_api.g_number,
860 p_cost_allocation_keyflex_id in number default hr_api.g_number,
861 p_business_group_id in number default hr_api.g_number,
862 p_pbm_attribute_category in varchar2 default hr_api.g_varchar2,
863 p_pbm_attribute1 in varchar2 default hr_api.g_varchar2,
864 p_pbm_attribute2 in varchar2 default hr_api.g_varchar2,
865 p_pbm_attribute3 in varchar2 default hr_api.g_varchar2,
866 p_pbm_attribute4 in varchar2 default hr_api.g_varchar2,
867 p_pbm_attribute5 in varchar2 default hr_api.g_varchar2,
868 p_pbm_attribute6 in varchar2 default hr_api.g_varchar2,
869 p_pbm_attribute7 in varchar2 default hr_api.g_varchar2,
870 p_pbm_attribute8 in varchar2 default hr_api.g_varchar2,
871 p_pbm_attribute9 in varchar2 default hr_api.g_varchar2,
872 p_pbm_attribute10 in varchar2 default hr_api.g_varchar2,
873 p_pbm_attribute11 in varchar2 default hr_api.g_varchar2,
874 p_pbm_attribute12 in varchar2 default hr_api.g_varchar2,
875 p_pbm_attribute13 in varchar2 default hr_api.g_varchar2,
876 p_pbm_attribute14 in varchar2 default hr_api.g_varchar2,
877 p_pbm_attribute15 in varchar2 default hr_api.g_varchar2,
878 p_pbm_attribute16 in varchar2 default hr_api.g_varchar2,
879 p_pbm_attribute17 in varchar2 default hr_api.g_varchar2,
880 p_pbm_attribute18 in varchar2 default hr_api.g_varchar2,
881 p_pbm_attribute19 in varchar2 default hr_api.g_varchar2,
882 p_pbm_attribute20 in varchar2 default hr_api.g_varchar2,
883 p_pbm_attribute21 in varchar2 default hr_api.g_varchar2,
884 p_pbm_attribute22 in varchar2 default hr_api.g_varchar2,
885 p_pbm_attribute23 in varchar2 default hr_api.g_varchar2,
886 p_pbm_attribute24 in varchar2 default hr_api.g_varchar2,
887 p_pbm_attribute25 in varchar2 default hr_api.g_varchar2,
888 p_pbm_attribute26 in varchar2 default hr_api.g_varchar2,
889 p_pbm_attribute27 in varchar2 default hr_api.g_varchar2,
890 p_pbm_attribute28 in varchar2 default hr_api.g_varchar2,
891 p_pbm_attribute29 in varchar2 default hr_api.g_varchar2,
892 p_pbm_attribute30 in varchar2 default hr_api.g_varchar2,
893 p_object_version_number in out nocopy number,
894 p_request_id in number default hr_api.g_number,
895 p_program_id in number default hr_api.g_number,
896 p_program_application_id in number default hr_api.g_number,
897 p_program_update_date in date default hr_api.g_date,
898 p_effective_date in date,
899 p_datetrack_mode in varchar2
900 ) is
901 --
902 l_rec ben_pbm_shd.g_rec_type;
903 l_proc varchar2(72) := g_package||'upd';
904 --
905 Begin
906 hr_utility.set_location('Entering:'||l_proc, 5);
907 --
908 -- Call conversion function to turn arguments into the
909 -- l_rec structure.
910 --
911 l_rec :=
912 ben_pbm_shd.convert_args
913 (
914 p_pl_r_oipl_prem_by_mo_id,
915 null,
916 null,
917 p_mnl_adj_flag,
918 p_mo_num,
919 p_yr_num,
920 p_val,
921 p_uom,
922 p_prtts_num,
923 p_actl_prem_id,
924 p_cost_allocation_keyflex_id,
925 p_business_group_id,
926 p_pbm_attribute_category,
927 p_pbm_attribute1,
928 p_pbm_attribute2,
929 p_pbm_attribute3,
930 p_pbm_attribute4,
931 p_pbm_attribute5,
932 p_pbm_attribute6,
933 p_pbm_attribute7,
934 p_pbm_attribute8,
935 p_pbm_attribute9,
936 p_pbm_attribute10,
937 p_pbm_attribute11,
938 p_pbm_attribute12,
939 p_pbm_attribute13,
940 p_pbm_attribute14,
941 p_pbm_attribute15,
942 p_pbm_attribute16,
943 p_pbm_attribute17,
944 p_pbm_attribute18,
945 p_pbm_attribute19,
946 p_pbm_attribute20,
947 p_pbm_attribute21,
948 p_pbm_attribute22,
949 p_pbm_attribute23,
950 p_pbm_attribute24,
951 p_pbm_attribute25,
952 p_pbm_attribute26,
953 p_pbm_attribute27,
954 p_pbm_attribute28,
955 p_pbm_attribute29,
956 p_pbm_attribute30,
957 p_object_version_number,
958 p_request_id,
959 p_program_id,
960 p_program_application_id,
961 p_program_update_date
962 );
963 --
964 -- Having converted the arguments into the
965 -- plsql record structure we call the corresponding record
966 -- business process.
967 --
968 upd(l_rec, p_effective_date, p_datetrack_mode);
969 p_object_version_number := l_rec.object_version_number;
970 p_effective_start_date := l_rec.effective_start_date;
971 p_effective_end_date := l_rec.effective_end_date;
972 --
973 --
974 hr_utility.set_location(' Leaving:'||l_proc, 10);
975 End upd;
976 --
977 end ben_pbm_upd;