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