1 Package Body ben_prm_upd as
2 /* $Header: beprmrhi.pkb 115.6 2002/12/30 10:49:28 rpgupta ship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- | Private Global Definitions |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package varchar2(33) := ' ben_prm_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_prm_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_prtt_prem_by_mo_f',
78 p_base_key_column => 'prtt_prem_by_mo_id',
79 p_base_key_value => p_rec.prtt_prem_by_mo_id);
80 --
81 ben_prm_shd.g_api_dml := true; -- Set the api dml status
82 --
83 -- Update the ben_prtt_prem_by_mo_f Row
84 --
85 update ben_prtt_prem_by_mo_f
86 set
87 prtt_prem_by_mo_id = p_rec.prtt_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 antcpd_prtt_cntr_uom = p_rec.antcpd_prtt_cntr_uom,
92 antcpd_prtt_cntr_val = p_rec.antcpd_prtt_cntr_val,
93 val = p_rec.val,
94 cr_val = p_rec.cr_val,
95 cr_mnl_adj_flag = p_rec.cr_mnl_adj_flag,
96 alctd_val_flag = p_rec.alctd_val_flag,
97 uom = p_rec.uom,
98 prtt_prem_id = p_rec.prtt_prem_id,
99 cost_allocation_keyflex_id = p_rec.cost_allocation_keyflex_id,
100 business_group_id = p_rec.business_group_id,
101 prm_attribute_category = p_rec.prm_attribute_category,
102 prm_attribute1 = p_rec.prm_attribute1,
103 prm_attribute2 = p_rec.prm_attribute2,
104 prm_attribute3 = p_rec.prm_attribute3,
105 prm_attribute4 = p_rec.prm_attribute4,
106 prm_attribute5 = p_rec.prm_attribute5,
107 prm_attribute6 = p_rec.prm_attribute6,
108 prm_attribute7 = p_rec.prm_attribute7,
109 prm_attribute8 = p_rec.prm_attribute8,
110 prm_attribute9 = p_rec.prm_attribute9,
111 prm_attribute10 = p_rec.prm_attribute10,
112 prm_attribute11 = p_rec.prm_attribute11,
113 prm_attribute12 = p_rec.prm_attribute12,
114 prm_attribute13 = p_rec.prm_attribute13,
115 prm_attribute14 = p_rec.prm_attribute14,
116 prm_attribute15 = p_rec.prm_attribute15,
117 prm_attribute16 = p_rec.prm_attribute16,
118 prm_attribute17 = p_rec.prm_attribute17,
119 prm_attribute18 = p_rec.prm_attribute18,
120 prm_attribute19 = p_rec.prm_attribute19,
121 prm_attribute20 = p_rec.prm_attribute20,
122 prm_attribute21 = p_rec.prm_attribute21,
123 prm_attribute22 = p_rec.prm_attribute22,
124 prm_attribute23 = p_rec.prm_attribute23,
125 prm_attribute24 = p_rec.prm_attribute24,
126 prm_attribute25 = p_rec.prm_attribute25,
127 prm_attribute26 = p_rec.prm_attribute26,
128 prm_attribute27 = p_rec.prm_attribute27,
129 prm_attribute28 = p_rec.prm_attribute28,
130 prm_attribute29 = p_rec.prm_attribute29,
131 prm_attribute30 = p_rec.prm_attribute30,
132 object_version_number = p_rec.object_version_number,
133 request_id = p_rec.request_id,
134 program_application_id = p_rec.program_application_id,
135 program_id = p_rec.program_id,
136 program_update_date = p_rec.program_update_date
137 where prtt_prem_by_mo_id = p_rec.prtt_prem_by_mo_id
138 and effective_start_date = p_validation_start_date
139 and effective_end_date = p_validation_end_date;
140 --
141 ben_prm_shd.g_api_dml := false; -- Unset the api dml status
142 --
143 -- Set the effective start and end dates
144 --
145 p_rec.effective_start_date := p_validation_start_date;
146 p_rec.effective_end_date := p_validation_end_date;
147 End If;
148 --
149 hr_utility.set_location(' Leaving:'||l_proc, 15);
150 Exception
151 When hr_api.check_integrity_violated Then
152 -- A check constraint has been violated
153 ben_prm_shd.g_api_dml := false; -- Unset the api dml status
154 ben_prm_shd.constraint_error
155 (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
156 When hr_api.unique_integrity_violated Then
157 -- Unique integrity has been violated
158 ben_prm_shd.g_api_dml := false; -- Unset the api dml status
159 ben_prm_shd.constraint_error
160 (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
161 When Others Then
162 ben_prm_shd.g_api_dml := false; -- Unset the api dml status
163 Raise;
164 End dt_update_dml;
165 --
166 -- ----------------------------------------------------------------------------
167 -- |------------------------------< update_dml >------------------------------|
168 -- ----------------------------------------------------------------------------
169 -- {Start Of Comments}
170 --
171 -- Description:
172 -- This procedure calls the dt_update_dml control logic which handles
173 -- the actual datetrack dml.
174 --
175 -- Prerequisites:
176 -- This is an internal private procedure which must be called from the upd
177 -- procedure.
178 --
179 -- In Parameters:
180 -- A Pl/Sql record structre.
181 --
182 -- Post Success:
183 -- Processing contines.
184 --
185 -- Post Failure:
186 -- No specific error handling is required within this procedure.
187 --
188 -- Developer Implementation Notes:
189 -- The update 'set' arguments list should be modified if any of your
190 -- attributes are not updateable.
191 --
192 -- Access Status:
193 -- Internal Row Handler Use Only.
194 --
195 -- {End Of Comments}
196 -- ----------------------------------------------------------------------------
197 Procedure update_dml
198 (p_rec in out nocopy ben_prm_shd.g_rec_type,
199 p_effective_date in date,
200 p_datetrack_mode in varchar2,
201 p_validation_start_date in date,
202 p_validation_end_date in date) is
203 --
204 l_proc varchar2(72) := g_package||'update_dml';
205 --
206 Begin
207 hr_utility.set_location('Entering:'||l_proc, 5);
208 --
209 dt_update_dml(p_rec => p_rec,
210 p_effective_date => p_effective_date,
211 p_datetrack_mode => p_datetrack_mode,
212 p_validation_start_date => p_validation_start_date,
213 p_validation_end_date => p_validation_end_date);
214 --
215 hr_utility.set_location(' Leaving:'||l_proc, 10);
216 End update_dml;
217 --
218 -- ----------------------------------------------------------------------------
219 -- |----------------------------< dt_pre_update >-----------------------------|
220 -- ----------------------------------------------------------------------------
221 -- {Start Of Comments}
222 --
223 -- Description:
224 -- The dt_pre_update procedure controls the execution
225 -- of dml for the datetrack modes of: UPDATE, UPDATE_OVERRIDE
226 -- and UPDATE_CHANGE_INSERT only. The execution required is as
227 -- follows:
228 --
229 -- 1) Providing the datetrack update mode is not 'CORRECTION'
230 -- then set the effective end date of the current row (this
231 -- will be the validation_start_date - 1).
232 -- 2) If the datetrack mode is 'UPDATE_OVERRIDE' then call the
233 -- corresponding delete_dml process to delete any future rows
234 -- where the effective_start_date is greater than or equal to
235 -- the validation_start_date.
236 -- 3) Call the insert_dml process to insert the new updated row
237 -- details..
238 --
239 -- Prerequisites:
240 -- This is an internal procedure which is called from the
241 -- pre_update procedure.
242 --
243 -- In Parameters:
244 --
245 -- Post Success:
246 -- Processing continues.
247 --
248 -- Post Failure:
249 -- If an error has occurred, an error message and exception will be raised
250 -- but not handled.
251 --
252 -- Developer Implementation Notes:
253 -- This is an internal procedure which is required by Datetrack. Don't
254 -- remove or modify.
255 --
256 -- Access Status:
257 -- Internal Row Handler Use Only.
258 --
259 -- {End Of Comments}
260 -- ----------------------------------------------------------------------------
261 Procedure dt_pre_update
262 (p_rec in out nocopy ben_prm_shd.g_rec_type,
263 p_effective_date in date,
264 p_datetrack_mode in varchar2,
265 p_validation_start_date in date,
266 p_validation_end_date in date) is
267 --
268 l_proc varchar2(72) := g_package||'dt_pre_update';
269 l_dummy_version_number number;
270 --
271 Begin
272 hr_utility.set_location('Entering:'||l_proc, 5);
273 If (p_datetrack_mode <> 'CORRECTION') then
274 hr_utility.set_location(l_proc, 10);
275 --
276 -- Update the current effective end date
277 --
278 ben_prm_shd.upd_effective_end_date
279 (p_effective_date => p_effective_date,
280 p_base_key_value => p_rec.prtt_prem_by_mo_id,
281 p_new_effective_end_date => (p_validation_start_date - 1),
282 p_validation_start_date => p_validation_start_date,
283 p_validation_end_date => p_validation_end_date,
284 p_object_version_number => l_dummy_version_number);
285 --
286 If (p_datetrack_mode = 'UPDATE_OVERRIDE') then
287 hr_utility.set_location(l_proc, 15);
288 --
289 -- As the datetrack mode is 'UPDATE_OVERRIDE' then we must
290 -- delete any future rows
291 --
292 ben_prm_del.delete_dml
293 (p_rec => p_rec,
294 p_effective_date => p_effective_date,
295 p_datetrack_mode => p_datetrack_mode,
296 p_validation_start_date => p_validation_start_date,
297 p_validation_end_date => p_validation_end_date);
298 End If;
299 hr_utility.set_location(l_proc, 20);
300 --
301 -- We must now insert the updated row
302 --
303 ben_prm_ins.insert_dml
304 (p_rec => p_rec,
305 p_effective_date => p_effective_date,
306 p_datetrack_mode => p_datetrack_mode,
307 p_validation_start_date => p_validation_start_date,
308 p_validation_end_date => p_validation_end_date);
309 End If;
310 hr_utility.set_location(' Leaving:'||l_proc, 20);
311 End dt_pre_update;
312 --
313 -- ----------------------------------------------------------------------------
314 -- |------------------------------< pre_update >------------------------------|
315 -- ----------------------------------------------------------------------------
316 -- {Start Of Comments}
317 --
318 -- Description:
319 -- This private procedure contains any processing which is required before
320 -- the update dml.
321 --
322 -- Prerequisites:
323 -- This is an internal procedure which is called from the upd procedure.
324 --
325 -- In Parameters:
326 -- A Pl/Sql record structre.
327 --
328 -- Post Success:
329 -- Processing continues.
330 --
331 -- Post Failure:
332 -- If an error has occurred, an error message and exception will be raised
333 -- but not handled.
334 --
335 -- Developer Implementation Notes:
336 -- Any pre-processing required before the update dml is issued should be
337 -- coded within this procedure. It is important to note that any 3rd party
338 -- maintenance should be reviewed before placing in this procedure. The call
339 -- to the dt_update_dml procedure should NOT be removed.
340 --
341 -- Access Status:
342 -- Internal Row Handler Use Only.
343 --
344 -- {End Of Comments}
345 -- ----------------------------------------------------------------------------
346 Procedure pre_update
347 (p_rec in out nocopy ben_prm_shd.g_rec_type,
348 p_effective_date in date,
349 p_datetrack_mode in varchar2,
350 p_validation_start_date in date,
351 p_validation_end_date in date) is
352 --
353 l_proc varchar2(72) := g_package||'pre_update';
354 --
355 Begin
356 hr_utility.set_location('Entering:'||l_proc, 5);
357 --
358 --
359 --
360 dt_pre_update
361 (p_rec => p_rec,
362 p_effective_date => p_effective_date,
363 p_datetrack_mode => p_datetrack_mode,
364 p_validation_start_date => p_validation_start_date,
365 p_validation_end_date => p_validation_end_date);
366 --
367 hr_utility.set_location(' Leaving:'||l_proc, 10);
368 End pre_update;
369 --
370 -- ----------------------------------------------------------------------------
371 -- |-----------------------------< post_update >------------------------------|
372 -- ----------------------------------------------------------------------------
373 -- {Start Of Comments}
374 --
375 -- Description:
376 -- This private procedure contains any processing which is required after the
377 -- update dml.
378 --
379 -- Prerequisites:
380 -- This is an internal procedure which is called from the upd procedure.
381 --
382 -- In Parameters:
383 -- A Pl/Sql record structre.
384 --
385 -- Post Success:
386 -- Processing continues.
387 --
388 -- Post Failure:
389 -- If an error has occurred, an error message and exception will be raised
390 -- but not handled.
391 --
392 -- Developer Implementation Notes:
393 -- Any post-processing required after the update dml is issued should be
394 -- coded within this procedure. It is important to note that any 3rd party
395 -- maintenance should be reviewed before placing in this procedure.
396 --
397 -- Access Status:
398 -- Internal Row Handler Use Only.
399 --
400 -- {End Of Comments}
401 -- ----------------------------------------------------------------------------
402 Procedure post_update
403 (p_rec in ben_prm_shd.g_rec_type,
404 p_effective_date in date,
405 p_datetrack_mode in varchar2,
406 p_validation_start_date in date,
407 p_validation_end_date in date) is
408 --
409 l_proc varchar2(72) := g_package||'post_update';
410 l_new_rec ben_ext_chlg.g_prem_mo_rec_type;
411 l_old_rec ben_ext_chlg.g_prem_mo_rec_type;
412
413 --
414 Begin
415 hr_utility.set_location('Entering:'||l_proc, 5);
416 --
417 --
418 -- Start of API User Hook for post_update.
419 --
420 begin
421 --
422 ben_prm_rku.after_update
423 (
424 p_prtt_prem_by_mo_id =>p_rec.prtt_prem_by_mo_id
425 ,p_effective_start_date =>p_rec.effective_start_date
426 ,p_effective_end_date =>p_rec.effective_end_date
427 ,p_mnl_adj_flag =>p_rec.mnl_adj_flag
428 ,p_mo_num =>p_rec.mo_num
429 ,p_yr_num =>p_rec.yr_num
430 ,p_antcpd_prtt_cntr_uom =>p_rec.antcpd_prtt_cntr_uom
431 ,p_antcpd_prtt_cntr_val =>p_rec.antcpd_prtt_cntr_val
432 ,p_val =>p_rec.val
433 ,p_cr_val =>p_rec.cr_val
434 ,p_cr_mnl_adj_flag =>p_rec.cr_mnl_adj_flag
435 ,p_alctd_val_flag =>p_rec.alctd_val_flag
436 ,p_uom =>p_rec.uom
437 ,p_prtt_prem_id =>p_rec.prtt_prem_id
438 ,p_cost_allocation_keyflex_id =>p_rec.cost_allocation_keyflex_id
439 ,p_business_group_id =>p_rec.business_group_id
440 ,p_prm_attribute_category =>p_rec.prm_attribute_category
441 ,p_prm_attribute1 =>p_rec.prm_attribute1
442 ,p_prm_attribute2 =>p_rec.prm_attribute2
443 ,p_prm_attribute3 =>p_rec.prm_attribute3
444 ,p_prm_attribute4 =>p_rec.prm_attribute4
445 ,p_prm_attribute5 =>p_rec.prm_attribute5
446 ,p_prm_attribute6 =>p_rec.prm_attribute6
447 ,p_prm_attribute7 =>p_rec.prm_attribute7
448 ,p_prm_attribute8 =>p_rec.prm_attribute8
449 ,p_prm_attribute9 =>p_rec.prm_attribute9
450 ,p_prm_attribute10 =>p_rec.prm_attribute10
451 ,p_prm_attribute11 =>p_rec.prm_attribute11
452 ,p_prm_attribute12 =>p_rec.prm_attribute12
453 ,p_prm_attribute13 =>p_rec.prm_attribute13
454 ,p_prm_attribute14 =>p_rec.prm_attribute14
455 ,p_prm_attribute15 =>p_rec.prm_attribute15
456 ,p_prm_attribute16 =>p_rec.prm_attribute16
457 ,p_prm_attribute17 =>p_rec.prm_attribute17
458 ,p_prm_attribute18 =>p_rec.prm_attribute18
459 ,p_prm_attribute19 =>p_rec.prm_attribute19
460 ,p_prm_attribute20 =>p_rec.prm_attribute20
461 ,p_prm_attribute21 =>p_rec.prm_attribute21
462 ,p_prm_attribute22 =>p_rec.prm_attribute22
463 ,p_prm_attribute23 =>p_rec.prm_attribute23
464 ,p_prm_attribute24 =>p_rec.prm_attribute24
465 ,p_prm_attribute25 =>p_rec.prm_attribute25
466 ,p_prm_attribute26 =>p_rec.prm_attribute26
467 ,p_prm_attribute27 =>p_rec.prm_attribute27
468 ,p_prm_attribute28 =>p_rec.prm_attribute28
469 ,p_prm_attribute29 =>p_rec.prm_attribute29
470 ,p_prm_attribute30 =>p_rec.prm_attribute30
471 ,p_object_version_number =>p_rec.object_version_number
472 ,p_request_id =>p_rec.request_id
473 ,p_program_application_id =>p_rec.program_application_id
474 ,p_program_id =>p_rec.program_id
475 ,p_program_update_date =>p_rec.program_update_date
476 ,p_effective_date =>p_effective_date
477 ,p_datetrack_mode =>p_datetrack_mode
478 ,p_validation_start_date =>p_validation_start_date
479 ,p_validation_end_date =>p_validation_end_date
480 ,p_effective_start_date_o =>ben_prm_shd.g_old_rec.effective_start_date
481 ,p_effective_end_date_o =>ben_prm_shd.g_old_rec.effective_end_date
482 ,p_mnl_adj_flag_o =>ben_prm_shd.g_old_rec.mnl_adj_flag
483 ,p_mo_num_o =>ben_prm_shd.g_old_rec.mo_num
484 ,p_yr_num_o =>ben_prm_shd.g_old_rec.yr_num
485 ,p_antcpd_prtt_cntr_uom_o =>ben_prm_shd.g_old_rec.antcpd_prtt_cntr_uom
486 ,p_antcpd_prtt_cntr_val_o =>ben_prm_shd.g_old_rec.antcpd_prtt_cntr_val
487 ,p_val_o =>ben_prm_shd.g_old_rec.val
488 ,p_cr_val_o =>ben_prm_shd.g_old_rec.cr_val
489 ,p_cr_mnl_adj_flag_o =>ben_prm_shd.g_old_rec.cr_mnl_adj_flag
490 ,p_alctd_val_flag_o =>ben_prm_shd.g_old_rec.alctd_val_flag
491 ,p_uom_o =>ben_prm_shd.g_old_rec.uom
492 ,p_prtt_prem_id_o =>ben_prm_shd.g_old_rec.prtt_prem_id
493 ,p_cost_allocation_keyflex_id_o =>ben_prm_shd.g_old_rec.cost_allocation_keyflex_id
494 ,p_business_group_id_o =>ben_prm_shd.g_old_rec.business_group_id
495 ,p_prm_attribute_category_o =>ben_prm_shd.g_old_rec.prm_attribute_category
496 ,p_prm_attribute1_o =>ben_prm_shd.g_old_rec.prm_attribute1
497 ,p_prm_attribute2_o =>ben_prm_shd.g_old_rec.prm_attribute2
498 ,p_prm_attribute3_o =>ben_prm_shd.g_old_rec.prm_attribute3
499 ,p_prm_attribute4_o =>ben_prm_shd.g_old_rec.prm_attribute4
500 ,p_prm_attribute5_o =>ben_prm_shd.g_old_rec.prm_attribute5
501 ,p_prm_attribute6_o =>ben_prm_shd.g_old_rec.prm_attribute6
502 ,p_prm_attribute7_o =>ben_prm_shd.g_old_rec.prm_attribute7
503 ,p_prm_attribute8_o =>ben_prm_shd.g_old_rec.prm_attribute8
504 ,p_prm_attribute9_o =>ben_prm_shd.g_old_rec.prm_attribute9
505 ,p_prm_attribute10_o =>ben_prm_shd.g_old_rec.prm_attribute10
506 ,p_prm_attribute11_o =>ben_prm_shd.g_old_rec.prm_attribute11
507 ,p_prm_attribute12_o =>ben_prm_shd.g_old_rec.prm_attribute12
508 ,p_prm_attribute13_o =>ben_prm_shd.g_old_rec.prm_attribute13
509 ,p_prm_attribute14_o =>ben_prm_shd.g_old_rec.prm_attribute14
510 ,p_prm_attribute15_o =>ben_prm_shd.g_old_rec.prm_attribute15
511 ,p_prm_attribute16_o =>ben_prm_shd.g_old_rec.prm_attribute16
512 ,p_prm_attribute17_o =>ben_prm_shd.g_old_rec.prm_attribute17
513 ,p_prm_attribute18_o =>ben_prm_shd.g_old_rec.prm_attribute18
514 ,p_prm_attribute19_o =>ben_prm_shd.g_old_rec.prm_attribute19
515 ,p_prm_attribute20_o =>ben_prm_shd.g_old_rec.prm_attribute20
516 ,p_prm_attribute21_o =>ben_prm_shd.g_old_rec.prm_attribute21
517 ,p_prm_attribute22_o =>ben_prm_shd.g_old_rec.prm_attribute22
518 ,p_prm_attribute23_o =>ben_prm_shd.g_old_rec.prm_attribute23
519 ,p_prm_attribute24_o =>ben_prm_shd.g_old_rec.prm_attribute24
520 ,p_prm_attribute25_o =>ben_prm_shd.g_old_rec.prm_attribute25
521 ,p_prm_attribute26_o =>ben_prm_shd.g_old_rec.prm_attribute26
522 ,p_prm_attribute27_o =>ben_prm_shd.g_old_rec.prm_attribute27
523 ,p_prm_attribute28_o =>ben_prm_shd.g_old_rec.prm_attribute28
524 ,p_prm_attribute29_o =>ben_prm_shd.g_old_rec.prm_attribute29
525 ,p_prm_attribute30_o =>ben_prm_shd.g_old_rec.prm_attribute30
526 ,p_object_version_number_o =>ben_prm_shd.g_old_rec.object_version_number
527 ,p_request_id_o =>ben_prm_shd.g_old_rec.request_id
528 ,p_program_application_id_o =>ben_prm_shd.g_old_rec.program_application_id
529 ,p_program_id_o =>ben_prm_shd.g_old_rec.program_id
530 ,p_program_update_date_o =>ben_prm_shd.g_old_rec.program_update_date
531 );
532
533
534
535 -- call the change log event
536 l_new_rec.prtt_prem_id := p_rec.prtt_prem_id ;
537 l_new_rec.val := p_rec.val ;
538 l_new_rec.effective_start_date := p_rec.effective_start_date;
539 l_new_rec.effective_end_date := p_rec.effective_end_date;
540 l_new_rec.business_group_id := p_rec.business_group_id ;
541 l_new_rec.mo_num := p_rec.mo_num ;
542 l_new_rec.yr_num := p_rec.yr_num ;
543 l_new_rec.cr_val := p_rec.cr_val ;
544 l_new_rec.uom := p_rec.uom ;
545 l_new_rec.update_mode := 'UPDATE' ;
546
547 -- call the change log event
548 l_old_rec.prtt_prem_id := ben_prm_shd.g_old_rec.prtt_prem_id ;
549 l_old_rec.val := ben_prm_shd.g_old_rec.val ;
550 l_old_rec.effective_start_date := ben_prm_shd.g_old_rec.effective_start_date;
551 l_old_rec.effective_end_date := ben_prm_shd.g_old_rec.effective_end_date;
552 l_old_rec.business_group_id := ben_prm_shd.g_old_rec.business_group_id ;
553 l_old_rec.mo_num := ben_prm_shd.g_old_rec.mo_num ;
554 l_old_rec.yr_num := ben_prm_shd.g_old_rec.yr_num ;
555 l_old_rec.cr_val := ben_prm_shd.g_old_rec.cr_val ;
556 l_old_rec.uom := ben_prm_shd.g_old_rec.uom ;
557
558 if nvl(l_new_rec.val,-1) <> nvl(l_old_rec.val,-1) then
559 ben_ext_chlg.log_prem_mo_chg
560 (p_event => 'UPDATE'
561 ,p_old_rec => l_old_rec
562 ,p_new_rec => l_new_rec
563 ) ;
564 End if ;
565 --
566 exception
567 --
568 when hr_api.cannot_find_prog_unit then
569 --
570 hr_api.cannot_find_prog_unit_error
571 (p_module_name => 'ben_prtt_prem_by_mo_f'
572 ,p_hook_type => 'AU');
573 --
574 end;
575 --
576 -- End of API User Hook for post_update.
577 --
578 --
579 hr_utility.set_location(' Leaving:'||l_proc, 10);
580 End post_update;
581 --
582 -- ----------------------------------------------------------------------------
583 -- |-----------------------------< convert_defs >-----------------------------|
584 -- ----------------------------------------------------------------------------
585 -- {Start Of Comments}
586 --
587 -- Description:
588 -- The Convert_Defs procedure has one very important function:
589 -- It must return the record structure for the row with all system defaulted
590 -- values converted into its corresponding parameter value for update. When
591 -- we attempt to update a row through the Upd process , certain
592 -- parameters can be defaulted which enables flexibility in the calling of
593 -- the upd process (e.g. only attributes which need to be updated need to be
594 -- specified). For the upd process to determine which attributes
595 -- have NOT been specified we need to check if the parameter has a reserved
596 -- system default value. Therefore, for all parameters which have a
597 -- corresponding reserved system default mechanism specified we need to
598 -- check if a system default is being used. If a system default is being
599 -- used then we convert the defaulted value into its corresponding attribute
600 -- value held in the g_old_rec data structure.
601 --
602 -- Prerequisites:
603 -- This private function can only be called from the upd process.
604 --
605 -- In Parameters:
606 -- A Pl/Sql record structre.
607 --
608 -- Post Success:
609 -- The record structure will be returned with all system defaulted parameter
610 -- values converted into its current row attribute value.
611 --
612 -- Post Failure:
613 -- No direct error handling is required within this function. Any possible
614 -- errors within this procedure will be a PL/SQL value error due to conversion
615 -- of datatypes or data lengths.
616 --
617 -- Developer Implementation Notes:
618 -- None.
619 --
620 -- Access Status:
621 -- Internal Row Handler Use Only.
622 --
623 -- {End Of Comments}
624 -- ----------------------------------------------------------------------------
625 Procedure convert_defs(p_rec in out nocopy ben_prm_shd.g_rec_type) is
626 --
627 l_proc varchar2(72) := g_package||'convert_defs';
628 --
629 Begin
630 --
631 hr_utility.set_location('Entering:'||l_proc, 5);
632 --
633 -- We must now examine each argument value in the
634 -- p_rec plsql record structure
635 -- to see if a system default is being used. If a system default
636 -- is being used then we must set to the 'current' argument value.
637 --
638 If (p_rec.mnl_adj_flag = hr_api.g_varchar2) then
639 p_rec.mnl_adj_flag :=
640 ben_prm_shd.g_old_rec.mnl_adj_flag;
641 End If;
642 If (p_rec.mo_num = hr_api.g_number) then
643 p_rec.mo_num :=
644 ben_prm_shd.g_old_rec.mo_num;
645 End If;
646 If (p_rec.yr_num = hr_api.g_number) then
647 p_rec.yr_num :=
648 ben_prm_shd.g_old_rec.yr_num;
649 End If;
650 If (p_rec.antcpd_prtt_cntr_uom = hr_api.g_varchar2) then
651 p_rec.antcpd_prtt_cntr_uom :=
652 ben_prm_shd.g_old_rec.antcpd_prtt_cntr_uom;
653 End If;
654 If (p_rec.antcpd_prtt_cntr_val = hr_api.g_number) then
655 p_rec.antcpd_prtt_cntr_val :=
656 ben_prm_shd.g_old_rec.antcpd_prtt_cntr_val;
657 End If;
658 If (p_rec.val = hr_api.g_number) then
659 p_rec.val :=
660 ben_prm_shd.g_old_rec.val;
661 End If;
662 If (p_rec.cr_val = hr_api.g_number) then
663 p_rec.cr_val :=
664 ben_prm_shd.g_old_rec.cr_val;
665 End If;
666 If (p_rec.cr_mnl_adj_flag = hr_api.g_varchar2) then
667 p_rec.cr_mnl_adj_flag :=
668 ben_prm_shd.g_old_rec.cr_mnl_adj_flag;
669 End If;
670 If (p_rec.alctd_val_flag = hr_api.g_varchar2) then
671 p_rec.alctd_val_flag :=
672 ben_prm_shd.g_old_rec.alctd_val_flag;
673 End If;
674 If (p_rec.uom = hr_api.g_varchar2) then
675 p_rec.uom :=
676 ben_prm_shd.g_old_rec.uom;
677 End If;
678 If (p_rec.prtt_prem_id = hr_api.g_number) then
679 p_rec.prtt_prem_id :=
680 ben_prm_shd.g_old_rec.prtt_prem_id;
681 End If;
682 If (p_rec.cost_allocation_keyflex_id = hr_api.g_number) then
683 p_rec.cost_allocation_keyflex_id :=
684 ben_prm_shd.g_old_rec.cost_allocation_keyflex_id;
685 End If;
686 If (p_rec.business_group_id = hr_api.g_number) then
687 p_rec.business_group_id :=
688 ben_prm_shd.g_old_rec.business_group_id;
689 End If;
690 If (p_rec.prm_attribute_category = hr_api.g_varchar2) then
691 p_rec.prm_attribute_category :=
692 ben_prm_shd.g_old_rec.prm_attribute_category;
693 End If;
694 If (p_rec.prm_attribute1 = hr_api.g_varchar2) then
695 p_rec.prm_attribute1 :=
696 ben_prm_shd.g_old_rec.prm_attribute1;
697 End If;
698 If (p_rec.prm_attribute2 = hr_api.g_varchar2) then
699 p_rec.prm_attribute2 :=
700 ben_prm_shd.g_old_rec.prm_attribute2;
701 End If;
702 If (p_rec.prm_attribute3 = hr_api.g_varchar2) then
703 p_rec.prm_attribute3 :=
704 ben_prm_shd.g_old_rec.prm_attribute3;
705 End If;
706 If (p_rec.prm_attribute4 = hr_api.g_varchar2) then
707 p_rec.prm_attribute4 :=
708 ben_prm_shd.g_old_rec.prm_attribute4;
709 End If;
710 If (p_rec.prm_attribute5 = hr_api.g_varchar2) then
711 p_rec.prm_attribute5 :=
712 ben_prm_shd.g_old_rec.prm_attribute5;
713 End If;
714 If (p_rec.prm_attribute6 = hr_api.g_varchar2) then
715 p_rec.prm_attribute6 :=
716 ben_prm_shd.g_old_rec.prm_attribute6;
717 End If;
718 If (p_rec.prm_attribute7 = hr_api.g_varchar2) then
719 p_rec.prm_attribute7 :=
720 ben_prm_shd.g_old_rec.prm_attribute7;
721 End If;
722 If (p_rec.prm_attribute8 = hr_api.g_varchar2) then
723 p_rec.prm_attribute8 :=
724 ben_prm_shd.g_old_rec.prm_attribute8;
725 End If;
726 If (p_rec.prm_attribute9 = hr_api.g_varchar2) then
727 p_rec.prm_attribute9 :=
728 ben_prm_shd.g_old_rec.prm_attribute9;
729 End If;
730 If (p_rec.prm_attribute10 = hr_api.g_varchar2) then
731 p_rec.prm_attribute10 :=
732 ben_prm_shd.g_old_rec.prm_attribute10;
733 End If;
734 If (p_rec.prm_attribute11 = hr_api.g_varchar2) then
735 p_rec.prm_attribute11 :=
736 ben_prm_shd.g_old_rec.prm_attribute11;
737 End If;
738 If (p_rec.prm_attribute12 = hr_api.g_varchar2) then
739 p_rec.prm_attribute12 :=
740 ben_prm_shd.g_old_rec.prm_attribute12;
741 End If;
742 If (p_rec.prm_attribute13 = hr_api.g_varchar2) then
743 p_rec.prm_attribute13 :=
744 ben_prm_shd.g_old_rec.prm_attribute13;
745 End If;
746 If (p_rec.prm_attribute14 = hr_api.g_varchar2) then
747 p_rec.prm_attribute14 :=
748 ben_prm_shd.g_old_rec.prm_attribute14;
749 End If;
750 If (p_rec.prm_attribute15 = hr_api.g_varchar2) then
751 p_rec.prm_attribute15 :=
752 ben_prm_shd.g_old_rec.prm_attribute15;
753 End If;
754 If (p_rec.prm_attribute16 = hr_api.g_varchar2) then
755 p_rec.prm_attribute16 :=
756 ben_prm_shd.g_old_rec.prm_attribute16;
757 End If;
758 If (p_rec.prm_attribute17 = hr_api.g_varchar2) then
759 p_rec.prm_attribute17 :=
760 ben_prm_shd.g_old_rec.prm_attribute17;
761 End If;
762 If (p_rec.prm_attribute18 = hr_api.g_varchar2) then
763 p_rec.prm_attribute18 :=
764 ben_prm_shd.g_old_rec.prm_attribute18;
765 End If;
766 If (p_rec.prm_attribute19 = hr_api.g_varchar2) then
767 p_rec.prm_attribute19 :=
768 ben_prm_shd.g_old_rec.prm_attribute19;
769 End If;
770 If (p_rec.prm_attribute20 = hr_api.g_varchar2) then
771 p_rec.prm_attribute20 :=
772 ben_prm_shd.g_old_rec.prm_attribute20;
773 End If;
774 If (p_rec.prm_attribute21 = hr_api.g_varchar2) then
775 p_rec.prm_attribute21 :=
776 ben_prm_shd.g_old_rec.prm_attribute21;
777 End If;
778 If (p_rec.prm_attribute22 = hr_api.g_varchar2) then
779 p_rec.prm_attribute22 :=
780 ben_prm_shd.g_old_rec.prm_attribute22;
781 End If;
782 If (p_rec.prm_attribute23 = hr_api.g_varchar2) then
783 p_rec.prm_attribute23 :=
784 ben_prm_shd.g_old_rec.prm_attribute23;
785 End If;
786 If (p_rec.prm_attribute24 = hr_api.g_varchar2) then
787 p_rec.prm_attribute24 :=
788 ben_prm_shd.g_old_rec.prm_attribute24;
789 End If;
790 If (p_rec.prm_attribute25 = hr_api.g_varchar2) then
791 p_rec.prm_attribute25 :=
792 ben_prm_shd.g_old_rec.prm_attribute25;
793 End If;
794 If (p_rec.prm_attribute26 = hr_api.g_varchar2) then
795 p_rec.prm_attribute26 :=
796 ben_prm_shd.g_old_rec.prm_attribute26;
797 End If;
798 If (p_rec.prm_attribute27 = hr_api.g_varchar2) then
799 p_rec.prm_attribute27 :=
800 ben_prm_shd.g_old_rec.prm_attribute27;
801 End If;
802 If (p_rec.prm_attribute28 = hr_api.g_varchar2) then
803 p_rec.prm_attribute28 :=
804 ben_prm_shd.g_old_rec.prm_attribute28;
805 End If;
806 If (p_rec.prm_attribute29 = hr_api.g_varchar2) then
807 p_rec.prm_attribute29 :=
808 ben_prm_shd.g_old_rec.prm_attribute29;
809 End If;
810 If (p_rec.prm_attribute30 = hr_api.g_varchar2) then
811 p_rec.prm_attribute30 :=
812 ben_prm_shd.g_old_rec.prm_attribute30;
813 End If;
814 If (p_rec.request_id = hr_api.g_number) then
815 p_rec.request_id :=
816 ben_prm_shd.g_old_rec.request_id;
817 End If;
818 If (p_rec.program_application_id = hr_api.g_number) then
819 p_rec.program_application_id :=
820 ben_prm_shd.g_old_rec.program_application_id;
821 End If;
822 If (p_rec.program_id = hr_api.g_number) then
823 p_rec.program_id :=
824 ben_prm_shd.g_old_rec.program_id;
825 End If;
826 If (p_rec.program_update_date = hr_api.g_date) then
827 p_rec.program_update_date :=
828 ben_prm_shd.g_old_rec.program_update_date;
829 End If;
830 --
831 hr_utility.set_location(' Leaving:'||l_proc, 10);
832 --
833 End convert_defs;
834 --
835 -- ----------------------------------------------------------------------------
836 -- |---------------------------------< upd >----------------------------------|
837 -- ----------------------------------------------------------------------------
838 Procedure upd
839 (
840 p_rec in out nocopy ben_prm_shd.g_rec_type,
841 p_effective_date in date,
842 p_datetrack_mode in varchar2
843 ) is
844 --
845 l_proc varchar2(72) := g_package||'upd';
846 l_validation_start_date date;
847 l_validation_end_date date;
848 --
849 Begin
850 hr_utility.set_location('Entering:'||l_proc, 5);
851 --
852 -- Ensure that the DateTrack update mode is valid
853 --
854 dt_api.validate_dt_upd_mode(p_datetrack_mode => p_datetrack_mode);
855 --
856 -- We must lock the row which we need to update.
857 --
858 ben_prm_shd.lck
859 (p_effective_date => p_effective_date,
860 p_datetrack_mode => p_datetrack_mode,
861 p_prtt_prem_by_mo_id => p_rec.prtt_prem_by_mo_id,
862 p_object_version_number => p_rec.object_version_number,
863 p_validation_start_date => l_validation_start_date,
864 p_validation_end_date => l_validation_end_date);
865 --
866 -- 1. During an update system defaults are used to determine if
867 -- arguments have been defaulted or not. We must therefore
868 -- derive the full record structure values to be updated.
869 --
870 -- 2. Call the supporting update validate operations.
871 --
872 convert_defs(p_rec);
873 ben_prm_bus.update_validate
874 (p_rec => p_rec,
875 p_effective_date => p_effective_date,
876 p_datetrack_mode => p_datetrack_mode,
877 p_validation_start_date => l_validation_start_date,
878 p_validation_end_date => l_validation_end_date);
879 --
880 -- Call the supporting pre-update operation
881 --
882 pre_update
883 (p_rec => p_rec,
884 p_effective_date => p_effective_date,
885 p_datetrack_mode => p_datetrack_mode,
886 p_validation_start_date => l_validation_start_date,
887 p_validation_end_date => l_validation_end_date);
888 --
889 -- Update the row.
890 --
891 update_dml
892 (p_rec => p_rec,
893 p_effective_date => p_effective_date,
894 p_datetrack_mode => p_datetrack_mode,
895 p_validation_start_date => l_validation_start_date,
896 p_validation_end_date => l_validation_end_date);
897 --
898 -- Call the supporting post-update operation
899 --
900 post_update
901 (p_rec => p_rec,
902 p_effective_date => p_effective_date,
903 p_datetrack_mode => p_datetrack_mode,
904 p_validation_start_date => l_validation_start_date,
905 p_validation_end_date => l_validation_end_date);
906 End upd;
907 --
908 -- ----------------------------------------------------------------------------
909 -- |---------------------------------< upd >----------------------------------|
910 -- ----------------------------------------------------------------------------
911 Procedure upd
912 (
913 p_prtt_prem_by_mo_id in number,
914 p_effective_start_date out nocopy date,
915 p_effective_end_date out nocopy date,
916 p_mnl_adj_flag in varchar2 default hr_api.g_varchar2,
917 p_mo_num in number default hr_api.g_number,
918 p_yr_num in number default hr_api.g_number,
919 p_antcpd_prtt_cntr_uom in varchar2 default hr_api.g_varchar2,
920 p_antcpd_prtt_cntr_val in number default hr_api.g_number,
921 p_val in number default hr_api.g_number,
922 p_cr_val in number default hr_api.g_number,
923 p_cr_mnl_adj_flag in varchar2 default hr_api.g_varchar2,
924 p_alctd_val_flag in varchar2 default hr_api.g_varchar2,
925 p_uom in varchar2 default hr_api.g_varchar2,
926 p_prtt_prem_id in number default hr_api.g_number,
927 p_cost_allocation_keyflex_id in number default hr_api.g_number,
928 p_business_group_id in number default hr_api.g_number,
929 p_prm_attribute_category in varchar2 default hr_api.g_varchar2,
930 p_prm_attribute1 in varchar2 default hr_api.g_varchar2,
931 p_prm_attribute2 in varchar2 default hr_api.g_varchar2,
932 p_prm_attribute3 in varchar2 default hr_api.g_varchar2,
933 p_prm_attribute4 in varchar2 default hr_api.g_varchar2,
934 p_prm_attribute5 in varchar2 default hr_api.g_varchar2,
935 p_prm_attribute6 in varchar2 default hr_api.g_varchar2,
936 p_prm_attribute7 in varchar2 default hr_api.g_varchar2,
937 p_prm_attribute8 in varchar2 default hr_api.g_varchar2,
938 p_prm_attribute9 in varchar2 default hr_api.g_varchar2,
939 p_prm_attribute10 in varchar2 default hr_api.g_varchar2,
940 p_prm_attribute11 in varchar2 default hr_api.g_varchar2,
941 p_prm_attribute12 in varchar2 default hr_api.g_varchar2,
942 p_prm_attribute13 in varchar2 default hr_api.g_varchar2,
943 p_prm_attribute14 in varchar2 default hr_api.g_varchar2,
944 p_prm_attribute15 in varchar2 default hr_api.g_varchar2,
945 p_prm_attribute16 in varchar2 default hr_api.g_varchar2,
946 p_prm_attribute17 in varchar2 default hr_api.g_varchar2,
947 p_prm_attribute18 in varchar2 default hr_api.g_varchar2,
948 p_prm_attribute19 in varchar2 default hr_api.g_varchar2,
949 p_prm_attribute20 in varchar2 default hr_api.g_varchar2,
950 p_prm_attribute21 in varchar2 default hr_api.g_varchar2,
951 p_prm_attribute22 in varchar2 default hr_api.g_varchar2,
952 p_prm_attribute23 in varchar2 default hr_api.g_varchar2,
953 p_prm_attribute24 in varchar2 default hr_api.g_varchar2,
954 p_prm_attribute25 in varchar2 default hr_api.g_varchar2,
955 p_prm_attribute26 in varchar2 default hr_api.g_varchar2,
956 p_prm_attribute27 in varchar2 default hr_api.g_varchar2,
957 p_prm_attribute28 in varchar2 default hr_api.g_varchar2,
958 p_prm_attribute29 in varchar2 default hr_api.g_varchar2,
959 p_prm_attribute30 in varchar2 default hr_api.g_varchar2,
960 p_object_version_number in out nocopy number,
961 p_request_id in number default hr_api.g_number,
962 p_program_application_id in number default hr_api.g_number,
963 p_program_id in number default hr_api.g_number,
964 p_program_update_date in date default hr_api.g_date,
965 p_effective_date in date,
966 p_datetrack_mode in varchar2
967 ) is
968 --
969 l_rec ben_prm_shd.g_rec_type;
970 l_proc varchar2(72) := g_package||'upd';
971 --
972 Begin
973 hr_utility.set_location('Entering:'||l_proc, 5);
974 --
975 -- Call conversion function to turn arguments into the
976 -- l_rec structure.
977 --
978 l_rec :=
979 ben_prm_shd.convert_args
980 (
981 p_prtt_prem_by_mo_id,
982 null,
983 null,
984 p_mnl_adj_flag,
985 p_mo_num,
986 p_yr_num,
987 p_antcpd_prtt_cntr_uom,
988 p_antcpd_prtt_cntr_val,
989 p_val,
990 p_cr_val,
991 p_cr_mnl_adj_flag,
992 p_alctd_val_flag,
993 p_uom,
994 p_prtt_prem_id,
995 p_cost_allocation_keyflex_id,
996 p_business_group_id,
997 p_prm_attribute_category,
998 p_prm_attribute1,
999 p_prm_attribute2,
1000 p_prm_attribute3,
1001 p_prm_attribute4,
1002 p_prm_attribute5,
1003 p_prm_attribute6,
1004 p_prm_attribute7,
1005 p_prm_attribute8,
1006 p_prm_attribute9,
1007 p_prm_attribute10,
1008 p_prm_attribute11,
1009 p_prm_attribute12,
1010 p_prm_attribute13,
1011 p_prm_attribute14,
1012 p_prm_attribute15,
1013 p_prm_attribute16,
1014 p_prm_attribute17,
1015 p_prm_attribute18,
1016 p_prm_attribute19,
1017 p_prm_attribute20,
1018 p_prm_attribute21,
1019 p_prm_attribute22,
1020 p_prm_attribute23,
1021 p_prm_attribute24,
1022 p_prm_attribute25,
1023 p_prm_attribute26,
1024 p_prm_attribute27,
1025 p_prm_attribute28,
1026 p_prm_attribute29,
1027 p_prm_attribute30,
1028 p_object_version_number,
1029 p_request_id,
1030 p_program_application_id,
1031 p_program_id,
1032 p_program_update_date
1033 );
1034 --
1035 -- Having converted the arguments into the
1036 -- plsql record structure we call the corresponding record
1037 -- business process.
1038 --
1039 upd(l_rec, p_effective_date, p_datetrack_mode);
1040 p_object_version_number := l_rec.object_version_number;
1041 p_effective_start_date := l_rec.effective_start_date;
1042 p_effective_end_date := l_rec.effective_end_date;
1043 --
1044 --
1045 hr_utility.set_location(' Leaving:'||l_proc, 10);
1046 End upd;
1047 --
1048 end ben_prm_upd;