1 Package Body ben_pcm_upd as
2 /* $Header: bepcmrhi.pkb 115.13 2002/12/16 11:58:35 vsethi ship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- | Private Global Definitions |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package varchar2(33) := ' ben_pcm_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_pcm_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_per_cm_f',
78 p_base_key_column => 'per_cm_id',
79 p_base_key_value => p_rec.per_cm_id);
80 --
81 ben_pcm_shd.g_api_dml := true; -- Set the api dml status
82 --
83 -- Update the ben_per_cm_f Row
84 --
85 update ben_per_cm_f
86 set
87 per_cm_id = p_rec.per_cm_id,
88 lf_evt_ocrd_dt = p_rec.lf_evt_ocrd_dt,
89 rqstbl_untl_dt = p_rec.rqstbl_untl_dt,
90 ler_id = p_rec.ler_id,
91 per_in_ler_id = p_rec.per_in_ler_id,
92 prtt_enrt_actn_id = p_rec.prtt_enrt_actn_id,
93 person_id = p_rec.person_id,
94 bnf_person_id = p_rec.bnf_person_id,
95 dpnt_person_id = p_rec.dpnt_person_id,
96 cm_typ_id = p_rec.cm_typ_id,
97 business_group_id = p_rec.business_group_id,
98 pcm_attribute_category = p_rec.pcm_attribute_category,
99 pcm_attribute1 = p_rec.pcm_attribute1,
100 pcm_attribute2 = p_rec.pcm_attribute2,
101 pcm_attribute3 = p_rec.pcm_attribute3,
102 pcm_attribute4 = p_rec.pcm_attribute4,
103 pcm_attribute5 = p_rec.pcm_attribute5,
104 pcm_attribute6 = p_rec.pcm_attribute6,
105 pcm_attribute7 = p_rec.pcm_attribute7,
106 pcm_attribute8 = p_rec.pcm_attribute8,
107 pcm_attribute9 = p_rec.pcm_attribute9,
108 pcm_attribute10 = p_rec.pcm_attribute10,
109 pcm_attribute11 = p_rec.pcm_attribute11,
110 pcm_attribute12 = p_rec.pcm_attribute12,
111 pcm_attribute13 = p_rec.pcm_attribute13,
112 pcm_attribute14 = p_rec.pcm_attribute14,
113 pcm_attribute15 = p_rec.pcm_attribute15,
114 pcm_attribute16 = p_rec.pcm_attribute16,
115 pcm_attribute17 = p_rec.pcm_attribute17,
116 pcm_attribute18 = p_rec.pcm_attribute18,
117 pcm_attribute19 = p_rec.pcm_attribute19,
118 pcm_attribute20 = p_rec.pcm_attribute20,
119 pcm_attribute21 = p_rec.pcm_attribute21,
120 pcm_attribute22 = p_rec.pcm_attribute22,
121 pcm_attribute23 = p_rec.pcm_attribute23,
122 pcm_attribute24 = p_rec.pcm_attribute24,
123 pcm_attribute25 = p_rec.pcm_attribute25,
124 pcm_attribute26 = p_rec.pcm_attribute26,
125 pcm_attribute27 = p_rec.pcm_attribute27,
126 pcm_attribute28 = p_rec.pcm_attribute28,
127 pcm_attribute29 = p_rec.pcm_attribute29,
128 pcm_attribute30 = p_rec.pcm_attribute30,
129 request_id = p_rec.request_id,
130 program_application_id = p_rec.program_application_id,
131 program_id = p_rec.program_id,
132 program_update_date = p_rec.program_update_date,
133 object_version_number = p_rec.object_version_number
134 where per_cm_id = p_rec.per_cm_id
135 and effective_start_date = p_validation_start_date
136 and effective_end_date = p_validation_end_date;
137 --
138 ben_pcm_shd.g_api_dml := false; -- Unset the api dml status
139 --
140 -- Set the effective start and end dates
141 --
142 p_rec.effective_start_date := p_validation_start_date;
143 p_rec.effective_end_date := p_validation_end_date;
144 End If;
145 --
146 hr_utility.set_location(' Leaving:'||l_proc, 15);
147 Exception
148 When hr_api.check_integrity_violated Then
149 -- A check constraint has been violated
150 ben_pcm_shd.g_api_dml := false; -- Unset the api dml status
151 ben_pcm_shd.constraint_error
152 (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
153 When hr_api.unique_integrity_violated Then
154 -- Unique integrity has been violated
155 ben_pcm_shd.g_api_dml := false; -- Unset the api dml status
156 ben_pcm_shd.constraint_error
157 (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
158 When Others Then
159 ben_pcm_shd.g_api_dml := false; -- Unset the api dml status
160 Raise;
161 End dt_update_dml;
162 --
163 -- ----------------------------------------------------------------------------
164 -- |------------------------------< update_dml >------------------------------|
165 -- ----------------------------------------------------------------------------
166 -- {Start Of Comments}
167 --
168 -- Description:
169 -- This procedure calls the dt_update_dml control logic which handles
170 -- the actual datetrack dml.
171 --
172 -- Prerequisites:
173 -- This is an internal private procedure which must be called from the upd
174 -- procedure.
175 --
176 -- In Parameters:
177 -- A Pl/Sql record structre.
178 --
179 -- Post Success:
180 -- Processing contines.
181 --
182 -- Post Failure:
183 -- No specific error handling is required within this procedure.
184 --
185 -- Developer Implementation Notes:
186 -- The update 'set' arguments list should be modified if any of your
187 -- attributes are not updateable.
188 --
189 -- Access Status:
190 -- Internal Row Handler Use Only.
191 --
192 -- {End Of Comments}
193 -- ----------------------------------------------------------------------------
194 Procedure update_dml
195 (p_rec in out nocopy ben_pcm_shd.g_rec_type,
196 p_effective_date in date,
197 p_datetrack_mode in varchar2,
198 p_validation_start_date in date,
199 p_validation_end_date in date) is
200 --
201 l_proc varchar2(72) := g_package||'update_dml';
202 --
203 Begin
204 hr_utility.set_location('Entering:'||l_proc, 5);
205 --
206 dt_update_dml(p_rec => p_rec,
207 p_effective_date => p_effective_date,
208 p_datetrack_mode => p_datetrack_mode,
209 p_validation_start_date => p_validation_start_date,
210 p_validation_end_date => p_validation_end_date);
211 --
212 hr_utility.set_location(' Leaving:'||l_proc, 10);
213 End update_dml;
214 --
215 -- ----------------------------------------------------------------------------
216 -- |----------------------------< dt_pre_update >-----------------------------|
217 -- ----------------------------------------------------------------------------
218 -- {Start Of Comments}
219 --
220 -- Description:
221 -- The dt_pre_update procedure controls the execution
222 -- of dml for the datetrack modes of: UPDATE, UPDATE_OVERRIDE
223 -- and UPDATE_CHANGE_INSERT only. The execution required is as
224 -- follows:
225 --
226 -- 1) Providing the datetrack update mode is not 'CORRECTION'
227 -- then set the effective end date of the current row (this
228 -- will be the validation_start_date - 1).
229 -- 2) If the datetrack mode is 'UPDATE_OVERRIDE' then call the
230 -- corresponding delete_dml process to delete any future rows
231 -- where the effective_start_date is greater than or equal to
232 -- the validation_start_date.
233 -- 3) Call the insert_dml process to insert the new updated row
234 -- details..
235 --
236 -- Prerequisites:
237 -- This is an internal procedure which is called from the
238 -- pre_update procedure.
239 --
240 -- In Parameters:
241 --
242 -- Post Success:
243 -- Processing continues.
244 --
245 -- Post Failure:
246 -- If an error has occurred, an error message and exception will be raised
247 -- but not handled.
248 --
249 -- Developer Implementation Notes:
250 -- This is an internal procedure which is required by Datetrack. Don't
251 -- remove or modify.
252 --
253 -- Access Status:
254 -- Internal Row Handler Use Only.
255 --
256 -- {End Of Comments}
257 -- ----------------------------------------------------------------------------
258 Procedure dt_pre_update
259 (p_rec in out nocopy ben_pcm_shd.g_rec_type,
260 p_effective_date in date,
261 p_datetrack_mode in varchar2,
262 p_validation_start_date in date,
263 p_validation_end_date in date) is
264 --
265 l_proc varchar2(72) := g_package||'dt_pre_update';
266 l_dummy_version_number number;
267 --
268 Begin
269 hr_utility.set_location('Entering:'||l_proc, 5);
270 If (p_datetrack_mode <> 'CORRECTION') then
271 hr_utility.set_location(l_proc, 10);
272 --
273 -- Update the current effective end date
274 --
275 ben_pcm_shd.upd_effective_end_date
276 (p_effective_date => p_effective_date,
277 p_base_key_value => p_rec.per_cm_id,
278 p_new_effective_end_date => (p_validation_start_date - 1),
279 p_validation_start_date => p_validation_start_date,
280 p_validation_end_date => p_validation_end_date,
281 p_object_version_number => l_dummy_version_number);
282 --
283 If (p_datetrack_mode = 'UPDATE_OVERRIDE') then
284 hr_utility.set_location(l_proc, 15);
285 --
286 -- As the datetrack mode is 'UPDATE_OVERRIDE' then we must
287 -- delete any future rows
288 --
289 ben_pcm_del.delete_dml
290 (p_rec => p_rec,
291 p_effective_date => p_effective_date,
292 p_datetrack_mode => p_datetrack_mode,
293 p_validation_start_date => p_validation_start_date,
294 p_validation_end_date => p_validation_end_date);
295 End If;
296 hr_utility.set_location(l_proc, 20);
297 --
298 -- We must now insert the updated row
299 --
300 ben_pcm_ins.insert_dml
301 (p_rec => p_rec,
302 p_effective_date => p_effective_date,
303 p_datetrack_mode => p_datetrack_mode,
304 p_validation_start_date => p_validation_start_date,
305 p_validation_end_date => p_validation_end_date);
306 End If;
307 hr_utility.set_location(' Leaving:'||l_proc, 20);
308 End dt_pre_update;
309 --
310 -- ----------------------------------------------------------------------------
311 -- |------------------------------< pre_update >------------------------------|
312 -- ----------------------------------------------------------------------------
313 -- {Start Of Comments}
314 --
315 -- Description:
316 -- This private procedure contains any processing which is required before
317 -- the update dml.
318 --
319 -- Prerequisites:
320 -- This is an internal procedure which is called from the upd procedure.
321 --
322 -- In Parameters:
323 -- A Pl/Sql record structre.
324 --
325 -- Post Success:
326 -- Processing continues.
327 --
328 -- Post Failure:
329 -- If an error has occurred, an error message and exception will be raised
330 -- but not handled.
331 --
332 -- Developer Implementation Notes:
333 -- Any pre-processing required before the update dml is issued should be
334 -- coded within this procedure. It is important to note that any 3rd party
335 -- maintenance should be reviewed before placing in this procedure. The call
336 -- to the dt_update_dml procedure should NOT be removed.
337 --
338 -- Access Status:
339 -- Internal Row Handler Use Only.
340 --
341 -- {End Of Comments}
342 -- ----------------------------------------------------------------------------
343 Procedure pre_update
344 (p_rec in out nocopy ben_pcm_shd.g_rec_type,
345 p_effective_date in date,
346 p_datetrack_mode in varchar2,
347 p_validation_start_date in date,
348 p_validation_end_date in date) is
349 --
350 l_proc varchar2(72) := g_package||'pre_update';
351 --
352 Begin
353 hr_utility.set_location('Entering:'||l_proc, 5);
354 --
355 --
356 --
357 dt_pre_update
358 (p_rec => p_rec,
359 p_effective_date => p_effective_date,
360 p_datetrack_mode => p_datetrack_mode,
361 p_validation_start_date => p_validation_start_date,
362 p_validation_end_date => p_validation_end_date);
363 --
364 hr_utility.set_location(' Leaving:'||l_proc, 10);
365 End pre_update;
366 --
367 -- ----------------------------------------------------------------------------
368 -- |-----------------------------< post_update >------------------------------|
369 -- ----------------------------------------------------------------------------
370 -- {Start Of Comments}
371 --
372 -- Description:
373 -- This private procedure contains any processing which is required after the
374 -- update dml.
375 --
376 -- Prerequisites:
377 -- This is an internal procedure which is called from the upd procedure.
378 --
379 -- In Parameters:
380 -- A Pl/Sql record structre.
381 --
382 -- Post Success:
383 -- Processing continues.
384 --
385 -- Post Failure:
386 -- If an error has occurred, an error message and exception will be raised
387 -- but not handled.
388 --
389 -- Developer Implementation Notes:
390 -- Any post-processing required after the update dml is issued should be
391 -- coded within this procedure. It is important to note that any 3rd party
392 -- maintenance should be reviewed before placing in this procedure.
393 --
394 -- Access Status:
395 -- Internal Row Handler Use Only.
396 --
397 -- {End Of Comments}
398 -- ----------------------------------------------------------------------------
399 Procedure post_update
400 (p_rec in ben_pcm_shd.g_rec_type,
401 p_effective_date in date,
402 p_datetrack_mode in varchar2,
403 p_validation_start_date in date,
404 p_validation_end_date in date) is
405 --
406 l_proc varchar2(72) := g_package||'post_update';
407 --
408 Begin
409 hr_utility.set_location('Entering:'||l_proc, 5);
410 --
411 --
412 -- Start of API User Hook for post_update.
413 --
414 begin
415 --
416 ben_pcm_rku.after_update
417 (
418 p_per_cm_id =>p_rec.per_cm_id
419 ,p_effective_start_date =>p_rec.effective_start_date
420 ,p_effective_end_date =>p_rec.effective_end_date
421 ,p_lf_evt_ocrd_dt =>p_rec.lf_evt_ocrd_dt
422 ,p_rqstbl_untl_dt =>p_rec.rqstbl_untl_dt
423 ,p_ler_id =>p_rec.ler_id
424 ,p_per_in_ler_id =>p_rec.per_in_ler_id
425 ,p_prtt_enrt_actn_id =>p_rec.prtt_enrt_actn_id
426 ,p_person_id =>p_rec.person_id
427 ,p_bnf_person_id =>p_rec.bnf_person_id
428 ,p_dpnt_person_id =>p_rec.dpnt_person_id
429 ,p_cm_typ_id =>p_rec.cm_typ_id
430 ,p_business_group_id =>p_rec.business_group_id
431 ,p_pcm_attribute_category =>p_rec.pcm_attribute_category
432 ,p_pcm_attribute1 =>p_rec.pcm_attribute1
433 ,p_pcm_attribute2 =>p_rec.pcm_attribute2
434 ,p_pcm_attribute3 =>p_rec.pcm_attribute3
435 ,p_pcm_attribute4 =>p_rec.pcm_attribute4
436 ,p_pcm_attribute5 =>p_rec.pcm_attribute5
437 ,p_pcm_attribute6 =>p_rec.pcm_attribute6
438 ,p_pcm_attribute7 =>p_rec.pcm_attribute7
439 ,p_pcm_attribute8 =>p_rec.pcm_attribute8
440 ,p_pcm_attribute9 =>p_rec.pcm_attribute9
441 ,p_pcm_attribute10 =>p_rec.pcm_attribute10
442 ,p_pcm_attribute11 =>p_rec.pcm_attribute11
443 ,p_pcm_attribute12 =>p_rec.pcm_attribute12
444 ,p_pcm_attribute13 =>p_rec.pcm_attribute13
445 ,p_pcm_attribute14 =>p_rec.pcm_attribute14
446 ,p_pcm_attribute15 =>p_rec.pcm_attribute15
447 ,p_pcm_attribute16 =>p_rec.pcm_attribute16
448 ,p_pcm_attribute17 =>p_rec.pcm_attribute17
449 ,p_pcm_attribute18 =>p_rec.pcm_attribute18
450 ,p_pcm_attribute19 =>p_rec.pcm_attribute19
451 ,p_pcm_attribute20 =>p_rec.pcm_attribute20
452 ,p_pcm_attribute21 =>p_rec.pcm_attribute21
453 ,p_pcm_attribute22 =>p_rec.pcm_attribute22
454 ,p_pcm_attribute23 =>p_rec.pcm_attribute23
455 ,p_pcm_attribute24 =>p_rec.pcm_attribute24
456 ,p_pcm_attribute25 =>p_rec.pcm_attribute25
457 ,p_pcm_attribute26 =>p_rec.pcm_attribute26
458 ,p_pcm_attribute27 =>p_rec.pcm_attribute27
459 ,p_pcm_attribute28 =>p_rec.pcm_attribute28
460 ,p_pcm_attribute29 =>p_rec.pcm_attribute29
461 ,p_pcm_attribute30 =>p_rec.pcm_attribute30
462 ,p_request_id =>p_rec.request_id
463 ,p_program_application_id =>p_rec.program_application_id
464 ,p_program_id =>p_rec.program_id
465 ,p_program_update_date =>p_rec.program_update_date
466 ,p_object_version_number =>p_rec.object_version_number
467 ,p_effective_date =>p_effective_date
468 ,p_datetrack_mode =>p_datetrack_mode
469 ,p_validation_start_date =>p_validation_start_date
470 ,p_validation_end_date =>p_validation_end_date
471 ,p_effective_start_date_o =>ben_pcm_shd.g_old_rec.effective_start_date
472 ,p_effective_end_date_o =>ben_pcm_shd.g_old_rec.effective_end_date
473 ,p_lf_evt_ocrd_dt_o =>ben_pcm_shd.g_old_rec.lf_evt_ocrd_dt
474 ,p_rqstbl_untl_dt_o =>ben_pcm_shd.g_old_rec.rqstbl_untl_dt
475 ,p_ler_id_o =>ben_pcm_shd.g_old_rec.ler_id
476 ,p_per_in_ler_id_o =>ben_pcm_shd.g_old_rec.per_in_ler_id
477 ,p_prtt_enrt_actn_id_o =>ben_pcm_shd.g_old_rec.prtt_enrt_actn_id
478 ,p_person_id_o =>ben_pcm_shd.g_old_rec.person_id
479 ,p_bnf_person_id_o =>ben_pcm_shd.g_old_rec.bnf_person_id
480 ,p_dpnt_person_id_o =>ben_pcm_shd.g_old_rec.dpnt_person_id
481 ,p_cm_typ_id_o =>ben_pcm_shd.g_old_rec.cm_typ_id
482 ,p_business_group_id_o =>ben_pcm_shd.g_old_rec.business_group_id
483 ,p_pcm_attribute_category_o =>ben_pcm_shd.g_old_rec.pcm_attribute_category
484 ,p_pcm_attribute1_o =>ben_pcm_shd.g_old_rec.pcm_attribute1
485 ,p_pcm_attribute2_o =>ben_pcm_shd.g_old_rec.pcm_attribute2
486 ,p_pcm_attribute3_o =>ben_pcm_shd.g_old_rec.pcm_attribute3
487 ,p_pcm_attribute4_o =>ben_pcm_shd.g_old_rec.pcm_attribute4
488 ,p_pcm_attribute5_o =>ben_pcm_shd.g_old_rec.pcm_attribute5
489 ,p_pcm_attribute6_o =>ben_pcm_shd.g_old_rec.pcm_attribute6
490 ,p_pcm_attribute7_o =>ben_pcm_shd.g_old_rec.pcm_attribute7
491 ,p_pcm_attribute8_o =>ben_pcm_shd.g_old_rec.pcm_attribute8
492 ,p_pcm_attribute9_o =>ben_pcm_shd.g_old_rec.pcm_attribute9
493 ,p_pcm_attribute10_o =>ben_pcm_shd.g_old_rec.pcm_attribute10
494 ,p_pcm_attribute11_o =>ben_pcm_shd.g_old_rec.pcm_attribute11
495 ,p_pcm_attribute12_o =>ben_pcm_shd.g_old_rec.pcm_attribute12
496 ,p_pcm_attribute13_o =>ben_pcm_shd.g_old_rec.pcm_attribute13
497 ,p_pcm_attribute14_o =>ben_pcm_shd.g_old_rec.pcm_attribute14
498 ,p_pcm_attribute15_o =>ben_pcm_shd.g_old_rec.pcm_attribute15
499 ,p_pcm_attribute16_o =>ben_pcm_shd.g_old_rec.pcm_attribute16
500 ,p_pcm_attribute17_o =>ben_pcm_shd.g_old_rec.pcm_attribute17
501 ,p_pcm_attribute18_o =>ben_pcm_shd.g_old_rec.pcm_attribute18
502 ,p_pcm_attribute19_o =>ben_pcm_shd.g_old_rec.pcm_attribute19
503 ,p_pcm_attribute20_o =>ben_pcm_shd.g_old_rec.pcm_attribute20
504 ,p_pcm_attribute21_o =>ben_pcm_shd.g_old_rec.pcm_attribute21
505 ,p_pcm_attribute22_o =>ben_pcm_shd.g_old_rec.pcm_attribute22
506 ,p_pcm_attribute23_o =>ben_pcm_shd.g_old_rec.pcm_attribute23
507 ,p_pcm_attribute24_o =>ben_pcm_shd.g_old_rec.pcm_attribute24
508 ,p_pcm_attribute25_o =>ben_pcm_shd.g_old_rec.pcm_attribute25
509 ,p_pcm_attribute26_o =>ben_pcm_shd.g_old_rec.pcm_attribute26
510 ,p_pcm_attribute27_o =>ben_pcm_shd.g_old_rec.pcm_attribute27
511 ,p_pcm_attribute28_o =>ben_pcm_shd.g_old_rec.pcm_attribute28
512 ,p_pcm_attribute29_o =>ben_pcm_shd.g_old_rec.pcm_attribute29
513 ,p_pcm_attribute30_o =>ben_pcm_shd.g_old_rec.pcm_attribute30
514 ,p_request_id_o =>ben_pcm_shd.g_old_rec.request_id
515 ,p_program_application_id_o =>ben_pcm_shd.g_old_rec.program_application_id
516 ,p_program_id_o =>ben_pcm_shd.g_old_rec.program_id
517 ,p_program_update_date_o =>ben_pcm_shd.g_old_rec.program_update_date
518 ,p_object_version_number_o =>ben_pcm_shd.g_old_rec.object_version_number
519 );
520 --
521 exception
522 --
523 when hr_api.cannot_find_prog_unit then
524 --
525 hr_api.cannot_find_prog_unit_error
526 (p_module_name => 'ben_per_cm_f'
527 ,p_hook_type => 'AU');
528 --
529 end;
530 --
531 -- End of API User Hook for post_update.
532 --
533 --
534 hr_utility.set_location(' Leaving:'||l_proc, 10);
535 End post_update;
536 --
537 -- ----------------------------------------------------------------------------
538 -- |-----------------------------< convert_defs >-----------------------------|
539 -- ----------------------------------------------------------------------------
540 -- {Start Of Comments}
541 --
542 -- Description:
543 -- The Convert_Defs procedure has one very important function:
544 -- It must return the record structure for the row with all system defaulted
545 -- values converted into its corresponding parameter value for update. When
546 -- we attempt to update a row through the Upd process , certain
547 -- parameters can be defaulted which enables flexibility in the calling of
548 -- the upd process (e.g. only attributes which need to be updated need to be
549 -- specified). For the upd process to determine which attributes
550 -- have NOT been specified we need to check if the parameter has a reserved
551 -- system default value. Therefore, for all parameters which have a
552 -- corresponding reserved system default mechanism specified we need to
553 -- check if a system default is being used. If a system default is being
554 -- used then we convert the defaulted value into its corresponding attribute
555 -- value held in the g_old_rec data structure.
556 --
557 -- Prerequisites:
558 -- This private function can only be called from the upd process.
559 --
560 -- In Parameters:
561 -- A Pl/Sql record structre.
562 --
563 -- Post Success:
564 -- The record structure will be returned with all system defaulted parameter
565 -- values converted into its current row attribute value.
566 --
567 -- Post Failure:
568 -- No direct error handling is required within this function. Any possible
569 -- errors within this procedure will be a PL/SQL value error due to conversion
570 -- of datatypes or data lengths.
571 --
572 -- Developer Implementation Notes:
573 -- None.
574 --
575 -- Access Status:
576 -- Internal Row Handler Use Only.
577 --
578 -- {End Of Comments}
579 -- ----------------------------------------------------------------------------
580 Procedure convert_defs(p_rec in out nocopy ben_pcm_shd.g_rec_type) is
581 --
582 l_proc varchar2(72) := g_package||'convert_defs';
583 --
584 Begin
585 --
586 hr_utility.set_location('Entering:'||l_proc, 5);
587 --
588 -- We must now examine each argument value in the
589 -- p_rec plsql record structure
590 -- to see if a system default is being used. If a system default
591 -- is being used then we must set to the 'current' argument value.
592 --
593 If (p_rec.lf_evt_ocrd_dt = hr_api.g_date) then
594 p_rec.lf_evt_ocrd_dt :=
595 ben_pcm_shd.g_old_rec.lf_evt_ocrd_dt;
596 End If;
597 If (p_rec.rqstbl_untl_dt = hr_api.g_date) then
598 p_rec.rqstbl_untl_dt :=
599 ben_pcm_shd.g_old_rec.rqstbl_untl_dt;
600 End If;
601 If (p_rec.ler_id = hr_api.g_number) then
602 p_rec.ler_id :=
603 ben_pcm_shd.g_old_rec.ler_id;
604 End If;
605 If (p_rec.per_in_ler_id = hr_api.g_number) then
606 p_rec.per_in_ler_id :=
607 ben_pcm_shd.g_old_rec.per_in_ler_id;
608 End If;
609 If (p_rec.prtt_enrt_actn_id = hr_api.g_number) then
610 p_rec.prtt_enrt_actn_id :=
611 ben_pcm_shd.g_old_rec.prtt_enrt_actn_id;
612 End If;
613 If (p_rec.person_id = hr_api.g_number) then
614 p_rec.person_id :=
615 ben_pcm_shd.g_old_rec.person_id;
616 End If;
617 If (p_rec.bnf_person_id = hr_api.g_number) then
618 p_rec.bnf_person_id :=
619 ben_pcm_shd.g_old_rec.bnf_person_id;
620 End If;
621 If (p_rec.dpnt_person_id = hr_api.g_number) then
622 p_rec.dpnt_person_id :=
623 ben_pcm_shd.g_old_rec.dpnt_person_id;
624 End If;
625 If (p_rec.cm_typ_id = hr_api.g_number) then
626 p_rec.cm_typ_id :=
627 ben_pcm_shd.g_old_rec.cm_typ_id;
628 End If;
629 If (p_rec.business_group_id = hr_api.g_number) then
630 p_rec.business_group_id :=
631 ben_pcm_shd.g_old_rec.business_group_id;
632 End If;
633 If (p_rec.pcm_attribute_category = hr_api.g_varchar2) then
634 p_rec.pcm_attribute_category :=
635 ben_pcm_shd.g_old_rec.pcm_attribute_category;
636 End If;
637 If (p_rec.pcm_attribute1 = hr_api.g_varchar2) then
638 p_rec.pcm_attribute1 :=
639 ben_pcm_shd.g_old_rec.pcm_attribute1;
640 End If;
641 If (p_rec.pcm_attribute2 = hr_api.g_varchar2) then
642 p_rec.pcm_attribute2 :=
643 ben_pcm_shd.g_old_rec.pcm_attribute2;
644 End If;
645 If (p_rec.pcm_attribute3 = hr_api.g_varchar2) then
646 p_rec.pcm_attribute3 :=
647 ben_pcm_shd.g_old_rec.pcm_attribute3;
648 End If;
649 If (p_rec.pcm_attribute4 = hr_api.g_varchar2) then
650 p_rec.pcm_attribute4 :=
651 ben_pcm_shd.g_old_rec.pcm_attribute4;
652 End If;
653 If (p_rec.pcm_attribute5 = hr_api.g_varchar2) then
654 p_rec.pcm_attribute5 :=
655 ben_pcm_shd.g_old_rec.pcm_attribute5;
656 End If;
657 If (p_rec.pcm_attribute6 = hr_api.g_varchar2) then
658 p_rec.pcm_attribute6 :=
659 ben_pcm_shd.g_old_rec.pcm_attribute6;
660 End If;
661 If (p_rec.pcm_attribute7 = hr_api.g_varchar2) then
662 p_rec.pcm_attribute7 :=
663 ben_pcm_shd.g_old_rec.pcm_attribute7;
664 End If;
665 If (p_rec.pcm_attribute8 = hr_api.g_varchar2) then
666 p_rec.pcm_attribute8 :=
667 ben_pcm_shd.g_old_rec.pcm_attribute8;
668 End If;
669 If (p_rec.pcm_attribute9 = hr_api.g_varchar2) then
670 p_rec.pcm_attribute9 :=
671 ben_pcm_shd.g_old_rec.pcm_attribute9;
672 End If;
673 If (p_rec.pcm_attribute10 = hr_api.g_varchar2) then
674 p_rec.pcm_attribute10 :=
675 ben_pcm_shd.g_old_rec.pcm_attribute10;
676 End If;
677 If (p_rec.pcm_attribute11 = hr_api.g_varchar2) then
678 p_rec.pcm_attribute11 :=
679 ben_pcm_shd.g_old_rec.pcm_attribute11;
680 End If;
681 If (p_rec.pcm_attribute12 = hr_api.g_varchar2) then
682 p_rec.pcm_attribute12 :=
683 ben_pcm_shd.g_old_rec.pcm_attribute12;
684 End If;
685 If (p_rec.pcm_attribute13 = hr_api.g_varchar2) then
686 p_rec.pcm_attribute13 :=
687 ben_pcm_shd.g_old_rec.pcm_attribute13;
688 End If;
689 If (p_rec.pcm_attribute14 = hr_api.g_varchar2) then
690 p_rec.pcm_attribute14 :=
691 ben_pcm_shd.g_old_rec.pcm_attribute14;
692 End If;
693 If (p_rec.pcm_attribute15 = hr_api.g_varchar2) then
694 p_rec.pcm_attribute15 :=
695 ben_pcm_shd.g_old_rec.pcm_attribute15;
696 End If;
697 If (p_rec.pcm_attribute16 = hr_api.g_varchar2) then
698 p_rec.pcm_attribute16 :=
699 ben_pcm_shd.g_old_rec.pcm_attribute16;
700 End If;
701 If (p_rec.pcm_attribute17 = hr_api.g_varchar2) then
702 p_rec.pcm_attribute17 :=
703 ben_pcm_shd.g_old_rec.pcm_attribute17;
704 End If;
705 If (p_rec.pcm_attribute18 = hr_api.g_varchar2) then
706 p_rec.pcm_attribute18 :=
707 ben_pcm_shd.g_old_rec.pcm_attribute18;
708 End If;
709 If (p_rec.pcm_attribute19 = hr_api.g_varchar2) then
710 p_rec.pcm_attribute19 :=
711 ben_pcm_shd.g_old_rec.pcm_attribute19;
712 End If;
713 If (p_rec.pcm_attribute20 = hr_api.g_varchar2) then
714 p_rec.pcm_attribute20 :=
715 ben_pcm_shd.g_old_rec.pcm_attribute20;
716 End If;
717 If (p_rec.pcm_attribute21 = hr_api.g_varchar2) then
718 p_rec.pcm_attribute21 :=
719 ben_pcm_shd.g_old_rec.pcm_attribute21;
720 End If;
721 If (p_rec.pcm_attribute22 = hr_api.g_varchar2) then
722 p_rec.pcm_attribute22 :=
723 ben_pcm_shd.g_old_rec.pcm_attribute22;
724 End If;
725 If (p_rec.pcm_attribute23 = hr_api.g_varchar2) then
726 p_rec.pcm_attribute23 :=
727 ben_pcm_shd.g_old_rec.pcm_attribute23;
728 End If;
729 If (p_rec.pcm_attribute24 = hr_api.g_varchar2) then
730 p_rec.pcm_attribute24 :=
731 ben_pcm_shd.g_old_rec.pcm_attribute24;
732 End If;
733 If (p_rec.pcm_attribute25 = hr_api.g_varchar2) then
734 p_rec.pcm_attribute25 :=
735 ben_pcm_shd.g_old_rec.pcm_attribute25;
736 End If;
737 If (p_rec.pcm_attribute26 = hr_api.g_varchar2) then
738 p_rec.pcm_attribute26 :=
739 ben_pcm_shd.g_old_rec.pcm_attribute26;
740 End If;
741 If (p_rec.pcm_attribute27 = hr_api.g_varchar2) then
742 p_rec.pcm_attribute27 :=
743 ben_pcm_shd.g_old_rec.pcm_attribute27;
744 End If;
745 If (p_rec.pcm_attribute28 = hr_api.g_varchar2) then
746 p_rec.pcm_attribute28 :=
747 ben_pcm_shd.g_old_rec.pcm_attribute28;
748 End If;
749 If (p_rec.pcm_attribute29 = hr_api.g_varchar2) then
750 p_rec.pcm_attribute29 :=
751 ben_pcm_shd.g_old_rec.pcm_attribute29;
752 End If;
753 If (p_rec.pcm_attribute30 = hr_api.g_varchar2) then
754 p_rec.pcm_attribute30 :=
755 ben_pcm_shd.g_old_rec.pcm_attribute30;
756 End If;
757 If (p_rec.request_id = hr_api.g_number) then
758 p_rec.request_id :=
759 ben_pcm_shd.g_old_rec.request_id;
760 End If;
761 If (p_rec.program_application_id = hr_api.g_number) then
762 p_rec.program_application_id :=
763 ben_pcm_shd.g_old_rec.program_application_id;
764 End If;
765 If (p_rec.program_id = hr_api.g_number) then
766 p_rec.program_id :=
767 ben_pcm_shd.g_old_rec.program_id;
768 End If;
769 If (p_rec.program_update_date = hr_api.g_date) then
770 p_rec.program_update_date :=
771 ben_pcm_shd.g_old_rec.program_update_date;
772 End If;
773
774 --
775 hr_utility.set_location(' Leaving:'||l_proc, 10);
776 --
777 End convert_defs;
778 --
779 -- ----------------------------------------------------------------------------
780 -- |---------------------------------< upd >----------------------------------|
781 -- ----------------------------------------------------------------------------
782 Procedure upd
783 (
784 p_rec in out nocopy ben_pcm_shd.g_rec_type,
785 p_effective_date in date,
786 p_datetrack_mode in varchar2
787 ) is
788 --
789 l_proc varchar2(72) := g_package||'upd';
790 l_validation_start_date date;
791 l_validation_end_date date;
792 --
793 Begin
794 hr_utility.set_location('Entering:'||l_proc, 5);
795 --
796 -- Ensure that the DateTrack update mode is valid
797 --
798 dt_api.validate_dt_upd_mode(p_datetrack_mode => p_datetrack_mode);
799 --
800 -- We must lock the row which we need to update.
801 --
802 ben_pcm_shd.lck
803 (p_effective_date => p_effective_date,
804 p_datetrack_mode => p_datetrack_mode,
805 p_per_cm_id => p_rec.per_cm_id,
806 p_object_version_number => p_rec.object_version_number,
807 p_validation_start_date => l_validation_start_date,
808 p_validation_end_date => l_validation_end_date);
809 --
810 -- 1. During an update system defaults are used to determine if
811 -- arguments have been defaulted or not. We must therefore
812 -- derive the full record structure values to be updated.
813 --
814 -- 2. Call the supporting update validate operations.
815 --
816 convert_defs(p_rec);
817 ben_pcm_bus.update_validate
818 (p_rec => p_rec,
819 p_effective_date => p_effective_date,
820 p_datetrack_mode => p_datetrack_mode,
821 p_validation_start_date => l_validation_start_date,
822 p_validation_end_date => l_validation_end_date);
823 --
824 -- Call the supporting pre-update operation
825 --
826 pre_update
827 (p_rec => p_rec,
828 p_effective_date => p_effective_date,
829 p_datetrack_mode => p_datetrack_mode,
830 p_validation_start_date => l_validation_start_date,
831 p_validation_end_date => l_validation_end_date);
832 --
833 -- Update the row.
834 --
835 update_dml
836 (p_rec => p_rec,
837 p_effective_date => p_effective_date,
838 p_datetrack_mode => p_datetrack_mode,
839 p_validation_start_date => l_validation_start_date,
840 p_validation_end_date => l_validation_end_date);
841 --
842 -- Call the supporting post-update operation
843 --
844 post_update
845 (p_rec => p_rec,
846 p_effective_date => p_effective_date,
847 p_datetrack_mode => p_datetrack_mode,
848 p_validation_start_date => l_validation_start_date,
849 p_validation_end_date => l_validation_end_date);
850 End upd;
851 --
852 -- ----------------------------------------------------------------------------
853 -- |---------------------------------< upd >----------------------------------|
854 -- ----------------------------------------------------------------------------
855 Procedure upd
856 (
857 p_per_cm_id in number,
858 p_effective_start_date out nocopy date,
859 p_effective_end_date out nocopy date,
860 p_lf_evt_ocrd_dt in date default hr_api.g_date,
861 p_rqstbl_untl_dt in date default hr_api.g_date,
862 p_ler_id in number default hr_api.g_number,
863 p_per_in_ler_id in number default hr_api.g_number,
864 p_prtt_enrt_actn_id in number default hr_api.g_number,
865 p_person_id in number default hr_api.g_number,
866 p_bnf_person_id in number default hr_api.g_number,
867 p_dpnt_person_id in number default hr_api.g_number,
868 p_cm_typ_id in number default hr_api.g_number,
869 p_business_group_id in number default hr_api.g_number,
870 p_pcm_attribute_category in varchar2 default hr_api.g_varchar2,
871 p_pcm_attribute1 in varchar2 default hr_api.g_varchar2,
872 p_pcm_attribute2 in varchar2 default hr_api.g_varchar2,
873 p_pcm_attribute3 in varchar2 default hr_api.g_varchar2,
874 p_pcm_attribute4 in varchar2 default hr_api.g_varchar2,
875 p_pcm_attribute5 in varchar2 default hr_api.g_varchar2,
876 p_pcm_attribute6 in varchar2 default hr_api.g_varchar2,
877 p_pcm_attribute7 in varchar2 default hr_api.g_varchar2,
878 p_pcm_attribute8 in varchar2 default hr_api.g_varchar2,
879 p_pcm_attribute9 in varchar2 default hr_api.g_varchar2,
880 p_pcm_attribute10 in varchar2 default hr_api.g_varchar2,
881 p_pcm_attribute11 in varchar2 default hr_api.g_varchar2,
882 p_pcm_attribute12 in varchar2 default hr_api.g_varchar2,
883 p_pcm_attribute13 in varchar2 default hr_api.g_varchar2,
884 p_pcm_attribute14 in varchar2 default hr_api.g_varchar2,
885 p_pcm_attribute15 in varchar2 default hr_api.g_varchar2,
886 p_pcm_attribute16 in varchar2 default hr_api.g_varchar2,
887 p_pcm_attribute17 in varchar2 default hr_api.g_varchar2,
888 p_pcm_attribute18 in varchar2 default hr_api.g_varchar2,
889 p_pcm_attribute19 in varchar2 default hr_api.g_varchar2,
890 p_pcm_attribute20 in varchar2 default hr_api.g_varchar2,
891 p_pcm_attribute21 in varchar2 default hr_api.g_varchar2,
892 p_pcm_attribute22 in varchar2 default hr_api.g_varchar2,
893 p_pcm_attribute23 in varchar2 default hr_api.g_varchar2,
894 p_pcm_attribute24 in varchar2 default hr_api.g_varchar2,
895 p_pcm_attribute25 in varchar2 default hr_api.g_varchar2,
896 p_pcm_attribute26 in varchar2 default hr_api.g_varchar2,
897 p_pcm_attribute27 in varchar2 default hr_api.g_varchar2,
898 p_pcm_attribute28 in varchar2 default hr_api.g_varchar2,
899 p_pcm_attribute29 in varchar2 default hr_api.g_varchar2,
900 p_pcm_attribute30 in varchar2 default hr_api.g_varchar2,
901 p_request_id in number default hr_api.g_number,
902 p_program_application_id in number default hr_api.g_number,
903 p_program_id in number default hr_api.g_number,
904 p_program_update_date in date default hr_api.g_date,
905 p_object_version_number in out nocopy number,
906 p_effective_date in date,
907 p_datetrack_mode in varchar2
908 ) is
909 --
910 l_rec ben_pcm_shd.g_rec_type;
911 l_proc varchar2(72) := g_package||'upd';
912 --
913 Begin
914 hr_utility.set_location('Entering:'||l_proc, 5);
915 --
916 -- Call conversion function to turn arguments into the
917 -- l_rec structure.
918 --
919 l_rec :=
920 ben_pcm_shd.convert_args
921 (
922 p_per_cm_id,
923 null,
924 null,
925 p_lf_evt_ocrd_dt,
926 p_rqstbl_untl_dt,
927 p_ler_id,
928 p_per_in_ler_id,
929 p_prtt_enrt_actn_id,
930 p_person_id,
931 p_bnf_person_id,
932 p_dpnt_person_id,
933 p_cm_typ_id,
934 p_business_group_id,
935 p_pcm_attribute_category,
936 p_pcm_attribute1,
937 p_pcm_attribute2,
938 p_pcm_attribute3,
939 p_pcm_attribute4,
940 p_pcm_attribute5,
941 p_pcm_attribute6,
942 p_pcm_attribute7,
943 p_pcm_attribute8,
944 p_pcm_attribute9,
945 p_pcm_attribute10,
946 p_pcm_attribute11,
947 p_pcm_attribute12,
948 p_pcm_attribute13,
949 p_pcm_attribute14,
950 p_pcm_attribute15,
951 p_pcm_attribute16,
952 p_pcm_attribute17,
953 p_pcm_attribute18,
954 p_pcm_attribute19,
955 p_pcm_attribute20,
956 p_pcm_attribute21,
957 p_pcm_attribute22,
958 p_pcm_attribute23,
959 p_pcm_attribute24,
960 p_pcm_attribute25,
961 p_pcm_attribute26,
962 p_pcm_attribute27,
963 p_pcm_attribute28,
964 p_pcm_attribute29,
965 p_pcm_attribute30,
966 p_request_id,
967 p_program_application_id,
968 p_program_id,
969 p_program_update_date,
970 p_object_version_number
971 );
972 --
973 -- Having converted the arguments into the
974 -- plsql record structure we call the corresponding record
975 -- business process.
976 --
977 upd(l_rec, p_effective_date, p_datetrack_mode);
978 p_object_version_number := l_rec.object_version_number;
979 p_effective_start_date := l_rec.effective_start_date;
980 p_effective_end_date := l_rec.effective_end_date;
981 --
982 --
983 hr_utility.set_location(' Leaving:'||l_proc, 10);
984 End upd;
985 --
986 end ben_pcm_upd;