1 Package Body ben_lbc_upd as
2 /* $Header: belbcrhi.pkb 120.0 2005/05/28 03:15:49 appldev noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- | Private Global Definitions |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package varchar2(33) := ' ben_lbc_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_lbc_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_ler_bnft_rstrn_ctfn_f',
78 p_base_key_column => 'ler_bnft_rstrn_ctfn_id',
79 p_base_key_value => p_rec.ler_bnft_rstrn_ctfn_id);
80 --
81 ben_lbc_shd.g_api_dml := true; -- Set the api dml status
82 --
83 -- Update the ben_ler_bnft_rstrn_ctfn_f Row
84 --
85 update ben_ler_bnft_rstrn_ctfn_f
86 set
87 ler_bnft_rstrn_ctfn_id = p_rec.ler_bnft_rstrn_ctfn_id,
88 rqd_flag = p_rec.rqd_flag,
89 enrt_ctfn_typ_cd = p_rec.enrt_ctfn_typ_cd,
90 ctfn_rqd_when_rl = p_rec.ctfn_rqd_when_rl,
91 ler_bnft_rstrn_id = p_rec.ler_bnft_rstrn_id,
92 business_group_id = p_rec.business_group_id,
93 lbc_attribute_category = p_rec.lbc_attribute_category,
94 lbc_attribute1 = p_rec.lbc_attribute1,
95 lbc_attribute2 = p_rec.lbc_attribute2,
96 lbc_attribute3 = p_rec.lbc_attribute3,
97 lbc_attribute4 = p_rec.lbc_attribute4,
98 lbc_attribute5 = p_rec.lbc_attribute5,
99 lbc_attribute6 = p_rec.lbc_attribute6,
100 lbc_attribute7 = p_rec.lbc_attribute7,
101 lbc_attribute8 = p_rec.lbc_attribute8,
102 lbc_attribute9 = p_rec.lbc_attribute9,
103 lbc_attribute10 = p_rec.lbc_attribute10,
104 lbc_attribute11 = p_rec.lbc_attribute11,
105 lbc_attribute12 = p_rec.lbc_attribute12,
106 lbc_attribute13 = p_rec.lbc_attribute13,
107 lbc_attribute14 = p_rec.lbc_attribute14,
108 lbc_attribute15 = p_rec.lbc_attribute15,
109 lbc_attribute16 = p_rec.lbc_attribute16,
110 lbc_attribute17 = p_rec.lbc_attribute17,
111 lbc_attribute18 = p_rec.lbc_attribute18,
112 lbc_attribute19 = p_rec.lbc_attribute19,
113 lbc_attribute20 = p_rec.lbc_attribute20,
114 lbc_attribute21 = p_rec.lbc_attribute21,
115 lbc_attribute22 = p_rec.lbc_attribute22,
116 lbc_attribute23 = p_rec.lbc_attribute23,
117 lbc_attribute24 = p_rec.lbc_attribute24,
118 lbc_attribute25 = p_rec.lbc_attribute25,
119 lbc_attribute26 = p_rec.lbc_attribute26,
120 lbc_attribute27 = p_rec.lbc_attribute27,
121 lbc_attribute28 = p_rec.lbc_attribute28,
122 lbc_attribute29 = p_rec.lbc_attribute29,
123 lbc_attribute30 = p_rec.lbc_attribute30,
124 object_version_number = p_rec.object_version_number
125 where ler_bnft_rstrn_ctfn_id = p_rec.ler_bnft_rstrn_ctfn_id
126 and effective_start_date = p_validation_start_date
127 and effective_end_date = p_validation_end_date;
128 --
129 ben_lbc_shd.g_api_dml := false; -- Unset the api dml status
130 --
131 -- Set the effective start and end dates
132 --
133 p_rec.effective_start_date := p_validation_start_date;
134 p_rec.effective_end_date := p_validation_end_date;
135 End If;
136 --
137 hr_utility.set_location(' Leaving:'||l_proc, 15);
138 Exception
139 When hr_api.check_integrity_violated Then
140 -- A check constraint has been violated
141 ben_lbc_shd.g_api_dml := false; -- Unset the api dml status
142 ben_lbc_shd.constraint_error
143 (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
144 When hr_api.unique_integrity_violated Then
145 -- Unique integrity has been violated
146 ben_lbc_shd.g_api_dml := false; -- Unset the api dml status
147 ben_lbc_shd.constraint_error
148 (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
149 When Others Then
150 ben_lbc_shd.g_api_dml := false; -- Unset the api dml status
151 Raise;
152 End dt_update_dml;
153 --
154 -- ----------------------------------------------------------------------------
155 -- |------------------------------< update_dml >------------------------------|
156 -- ----------------------------------------------------------------------------
157 -- {Start Of Comments}
158 --
159 -- Description:
160 -- This procedure calls the dt_update_dml control logic which handles
161 -- the actual datetrack dml.
162 --
163 -- Prerequisites:
164 -- This is an internal private procedure which must be called from the upd
165 -- procedure.
166 --
167 -- In Parameters:
168 -- A Pl/Sql record structre.
169 --
170 -- Post Success:
171 -- Processing contines.
172 --
173 -- Post Failure:
174 -- No specific error handling is required within this procedure.
175 --
176 -- Developer Implementation Notes:
177 -- The update 'set' arguments list should be modified if any of your
178 -- attributes are not updateable.
179 --
180 -- Access Status:
181 -- Internal Row Handler Use Only.
182 --
183 -- {End Of Comments}
184 -- ----------------------------------------------------------------------------
185 Procedure update_dml
186 (p_rec in out nocopy ben_lbc_shd.g_rec_type,
187 p_effective_date in date,
188 p_datetrack_mode in varchar2,
189 p_validation_start_date in date,
190 p_validation_end_date in date) is
191 --
192 l_proc varchar2(72) := g_package||'update_dml';
193 --
194 Begin
195 hr_utility.set_location('Entering:'||l_proc, 5);
196 --
197 dt_update_dml(p_rec => p_rec,
198 p_effective_date => p_effective_date,
199 p_datetrack_mode => p_datetrack_mode,
200 p_validation_start_date => p_validation_start_date,
201 p_validation_end_date => p_validation_end_date);
202 --
203 hr_utility.set_location(' Leaving:'||l_proc, 10);
204 End update_dml;
205 --
206 -- ----------------------------------------------------------------------------
207 -- |----------------------------< dt_pre_update >-----------------------------|
208 -- ----------------------------------------------------------------------------
209 -- {Start Of Comments}
210 --
211 -- Description:
212 -- The dt_pre_update procedure controls the execution
213 -- of dml for the datetrack modes of: UPDATE, UPDATE_OVERRIDE
214 -- and UPDATE_CHANGE_INSERT only. The execution required is as
215 -- follows:
216 --
217 -- 1) Providing the datetrack update mode is not 'CORRECTION'
218 -- then set the effective end date of the current row (this
219 -- will be the validation_start_date - 1).
220 -- 2) If the datetrack mode is 'UPDATE_OVERRIDE' then call the
221 -- corresponding delete_dml process to delete any future rows
222 -- where the effective_start_date is greater than or equal to
223 -- the validation_start_date.
224 -- 3) Call the insert_dml process to insert the new updated row
225 -- details..
226 --
227 -- Prerequisites:
228 -- This is an internal procedure which is called from the
229 -- pre_update procedure.
230 --
231 -- In Parameters:
232 --
233 -- Post Success:
234 -- Processing continues.
235 --
236 -- Post Failure:
237 -- If an error has occurred, an error message and exception will be raised
238 -- but not handled.
239 --
240 -- Developer Implementation Notes:
241 -- This is an internal procedure which is required by Datetrack. Don't
242 -- remove or modify.
243 --
244 -- Access Status:
245 -- Internal Row Handler Use Only.
246 --
247 -- {End Of Comments}
248 -- ----------------------------------------------------------------------------
249 Procedure dt_pre_update
250 (p_rec in out nocopy ben_lbc_shd.g_rec_type,
251 p_effective_date in date,
252 p_datetrack_mode in varchar2,
253 p_validation_start_date in date,
254 p_validation_end_date in date) is
255 --
256 l_proc varchar2(72) := g_package||'dt_pre_update';
257 l_dummy_version_number number;
258 --
259 Begin
260 hr_utility.set_location('Entering:'||l_proc, 5);
261 If (p_datetrack_mode <> 'CORRECTION') then
262 hr_utility.set_location(l_proc, 10);
263 --
264 -- Update the current effective end date
265 --
266 ben_lbc_shd.upd_effective_end_date
267 (p_effective_date => p_effective_date,
268 p_base_key_value => p_rec.ler_bnft_rstrn_ctfn_id,
269 p_new_effective_end_date => (p_validation_start_date - 1),
270 p_validation_start_date => p_validation_start_date,
271 p_validation_end_date => p_validation_end_date,
272 p_object_version_number => l_dummy_version_number);
273 --
274 If (p_datetrack_mode = 'UPDATE_OVERRIDE') then
275 hr_utility.set_location(l_proc, 15);
276 --
277 -- As the datetrack mode is 'UPDATE_OVERRIDE' then we must
278 -- delete any future rows
279 --
280 ben_lbc_del.delete_dml
281 (p_rec => p_rec,
282 p_effective_date => p_effective_date,
283 p_datetrack_mode => p_datetrack_mode,
284 p_validation_start_date => p_validation_start_date,
285 p_validation_end_date => p_validation_end_date);
286 End If;
287 hr_utility.set_location(l_proc, 20);
288 --
289 -- We must now insert the updated row
290 --
291 ben_lbc_ins.insert_dml
292 (p_rec => p_rec,
293 p_effective_date => p_effective_date,
294 p_datetrack_mode => p_datetrack_mode,
295 p_validation_start_date => p_validation_start_date,
296 p_validation_end_date => p_validation_end_date);
297 End If;
298 hr_utility.set_location(' Leaving:'||l_proc, 20);
299 End dt_pre_update;
300 --
301 -- ----------------------------------------------------------------------------
302 -- |------------------------------< pre_update >------------------------------|
303 -- ----------------------------------------------------------------------------
304 -- {Start Of Comments}
305 --
306 -- Description:
307 -- This private procedure contains any processing which is required before
308 -- the update dml.
309 --
310 -- Prerequisites:
311 -- This is an internal procedure which is called from the upd procedure.
312 --
313 -- In Parameters:
314 -- A Pl/Sql record structre.
315 --
316 -- Post Success:
317 -- Processing continues.
318 --
319 -- Post Failure:
320 -- If an error has occurred, an error message and exception will be raised
321 -- but not handled.
322 --
323 -- Developer Implementation Notes:
324 -- Any pre-processing required before the update dml is issued should be
325 -- coded within this procedure. It is important to note that any 3rd party
326 -- maintenance should be reviewed before placing in this procedure. The call
327 -- to the dt_update_dml procedure should NOT be removed.
328 --
329 -- Access Status:
330 -- Internal Row Handler Use Only.
331 --
332 -- {End Of Comments}
333 -- ----------------------------------------------------------------------------
334 Procedure pre_update
335 (p_rec in out nocopy ben_lbc_shd.g_rec_type,
336 p_effective_date in date,
337 p_datetrack_mode in varchar2,
338 p_validation_start_date in date,
339 p_validation_end_date in date) is
340 --
341 l_proc varchar2(72) := g_package||'pre_update';
342 --
343 Begin
344 hr_utility.set_location('Entering:'||l_proc, 5);
345 --
346 --
347 --
348 dt_pre_update
349 (p_rec => p_rec,
350 p_effective_date => p_effective_date,
351 p_datetrack_mode => p_datetrack_mode,
352 p_validation_start_date => p_validation_start_date,
353 p_validation_end_date => p_validation_end_date);
354 --
355 hr_utility.set_location(' Leaving:'||l_proc, 10);
356 End pre_update;
357 --
358 -- ----------------------------------------------------------------------------
359 -- |-----------------------------< post_update >------------------------------|
360 -- ----------------------------------------------------------------------------
361 -- {Start Of Comments}
362 --
363 -- Description:
364 -- This private procedure contains any processing which is required after the
365 -- update dml.
366 --
367 -- Prerequisites:
368 -- This is an internal procedure which is called from the upd procedure.
369 --
370 -- In Parameters:
371 -- A Pl/Sql record structre.
372 --
373 -- Post Success:
374 -- Processing continues.
375 --
376 -- Post Failure:
377 -- If an error has occurred, an error message and exception will be raised
378 -- but not handled.
379 --
380 -- Developer Implementation Notes:
381 -- Any post-processing required after the update dml is issued should be
382 -- coded within this procedure. It is important to note that any 3rd party
383 -- maintenance should be reviewed before placing in this procedure.
384 --
385 -- Access Status:
386 -- Internal Row Handler Use Only.
387 --
388 -- {End Of Comments}
389 -- ----------------------------------------------------------------------------
390 Procedure post_update
391 (p_rec in ben_lbc_shd.g_rec_type,
392 p_effective_date in date,
393 p_datetrack_mode in varchar2,
394 p_validation_start_date in date,
395 p_validation_end_date in date) is
396 --
397 l_proc varchar2(72) := g_package||'post_update';
398 --
399 Begin
400 hr_utility.set_location('Entering:'||l_proc, 5);
401 --
402 --
403 -- Start of API User Hook for post_update.
404 --
405 begin
406 --
407 ben_lbc_rku.after_update
408 (
409 p_ler_bnft_rstrn_ctfn_id =>p_rec.ler_bnft_rstrn_ctfn_id
410 ,p_effective_start_date =>p_rec.effective_start_date
411 ,p_effective_end_date =>p_rec.effective_end_date
412 ,p_rqd_flag =>p_rec.rqd_flag
413 ,p_enrt_ctfn_typ_cd =>p_rec.enrt_ctfn_typ_cd
414 ,p_ctfn_rqd_when_rl =>p_rec.ctfn_rqd_when_rl
415 ,p_ler_bnft_rstrn_id =>p_rec.ler_bnft_rstrn_id
416 ,p_business_group_id =>p_rec.business_group_id
417 ,p_lbc_attribute_category =>p_rec.lbc_attribute_category
418 ,p_lbc_attribute1 =>p_rec.lbc_attribute1
419 ,p_lbc_attribute2 =>p_rec.lbc_attribute2
420 ,p_lbc_attribute3 =>p_rec.lbc_attribute3
421 ,p_lbc_attribute4 =>p_rec.lbc_attribute4
422 ,p_lbc_attribute5 =>p_rec.lbc_attribute5
423 ,p_lbc_attribute6 =>p_rec.lbc_attribute6
424 ,p_lbc_attribute7 =>p_rec.lbc_attribute7
425 ,p_lbc_attribute8 =>p_rec.lbc_attribute8
426 ,p_lbc_attribute9 =>p_rec.lbc_attribute9
427 ,p_lbc_attribute10 =>p_rec.lbc_attribute10
428 ,p_lbc_attribute11 =>p_rec.lbc_attribute11
429 ,p_lbc_attribute12 =>p_rec.lbc_attribute12
430 ,p_lbc_attribute13 =>p_rec.lbc_attribute13
431 ,p_lbc_attribute14 =>p_rec.lbc_attribute14
432 ,p_lbc_attribute15 =>p_rec.lbc_attribute15
433 ,p_lbc_attribute16 =>p_rec.lbc_attribute16
434 ,p_lbc_attribute17 =>p_rec.lbc_attribute17
435 ,p_lbc_attribute18 =>p_rec.lbc_attribute18
436 ,p_lbc_attribute19 =>p_rec.lbc_attribute19
437 ,p_lbc_attribute20 =>p_rec.lbc_attribute20
438 ,p_lbc_attribute21 =>p_rec.lbc_attribute21
439 ,p_lbc_attribute22 =>p_rec.lbc_attribute22
440 ,p_lbc_attribute23 =>p_rec.lbc_attribute23
441 ,p_lbc_attribute24 =>p_rec.lbc_attribute24
442 ,p_lbc_attribute25 =>p_rec.lbc_attribute25
443 ,p_lbc_attribute26 =>p_rec.lbc_attribute26
444 ,p_lbc_attribute27 =>p_rec.lbc_attribute27
445 ,p_lbc_attribute28 =>p_rec.lbc_attribute28
446 ,p_lbc_attribute29 =>p_rec.lbc_attribute29
447 ,p_lbc_attribute30 =>p_rec.lbc_attribute30
448 ,p_object_version_number =>p_rec.object_version_number
449 ,p_effective_date =>p_effective_date
450 ,p_datetrack_mode =>p_datetrack_mode
451 ,p_validation_start_date =>p_validation_start_date
452 ,p_validation_end_date =>p_validation_end_date
453 ,p_effective_start_date_o =>ben_lbc_shd.g_old_rec.effective_start_date
454 ,p_effective_end_date_o =>ben_lbc_shd.g_old_rec.effective_end_date
455 ,p_rqd_flag_o =>ben_lbc_shd.g_old_rec.rqd_flag
456 ,p_enrt_ctfn_typ_cd_o =>ben_lbc_shd.g_old_rec.enrt_ctfn_typ_cd
457 ,p_ctfn_rqd_when_rl_o =>ben_lbc_shd.g_old_rec.ctfn_rqd_when_rl
458 ,p_ler_bnft_rstrn_id_o =>ben_lbc_shd.g_old_rec.ler_bnft_rstrn_id
459 ,p_business_group_id_o =>ben_lbc_shd.g_old_rec.business_group_id
460 ,p_lbc_attribute_category_o =>ben_lbc_shd.g_old_rec.lbc_attribute_category
461 ,p_lbc_attribute1_o =>ben_lbc_shd.g_old_rec.lbc_attribute1
462 ,p_lbc_attribute2_o =>ben_lbc_shd.g_old_rec.lbc_attribute2
463 ,p_lbc_attribute3_o =>ben_lbc_shd.g_old_rec.lbc_attribute3
464 ,p_lbc_attribute4_o =>ben_lbc_shd.g_old_rec.lbc_attribute4
465 ,p_lbc_attribute5_o =>ben_lbc_shd.g_old_rec.lbc_attribute5
466 ,p_lbc_attribute6_o =>ben_lbc_shd.g_old_rec.lbc_attribute6
467 ,p_lbc_attribute7_o =>ben_lbc_shd.g_old_rec.lbc_attribute7
468 ,p_lbc_attribute8_o =>ben_lbc_shd.g_old_rec.lbc_attribute8
469 ,p_lbc_attribute9_o =>ben_lbc_shd.g_old_rec.lbc_attribute9
470 ,p_lbc_attribute10_o =>ben_lbc_shd.g_old_rec.lbc_attribute10
471 ,p_lbc_attribute11_o =>ben_lbc_shd.g_old_rec.lbc_attribute11
472 ,p_lbc_attribute12_o =>ben_lbc_shd.g_old_rec.lbc_attribute12
473 ,p_lbc_attribute13_o =>ben_lbc_shd.g_old_rec.lbc_attribute13
474 ,p_lbc_attribute14_o =>ben_lbc_shd.g_old_rec.lbc_attribute14
475 ,p_lbc_attribute15_o =>ben_lbc_shd.g_old_rec.lbc_attribute15
476 ,p_lbc_attribute16_o =>ben_lbc_shd.g_old_rec.lbc_attribute16
477 ,p_lbc_attribute17_o =>ben_lbc_shd.g_old_rec.lbc_attribute17
478 ,p_lbc_attribute18_o =>ben_lbc_shd.g_old_rec.lbc_attribute18
479 ,p_lbc_attribute19_o =>ben_lbc_shd.g_old_rec.lbc_attribute19
480 ,p_lbc_attribute20_o =>ben_lbc_shd.g_old_rec.lbc_attribute20
481 ,p_lbc_attribute21_o =>ben_lbc_shd.g_old_rec.lbc_attribute21
482 ,p_lbc_attribute22_o =>ben_lbc_shd.g_old_rec.lbc_attribute22
483 ,p_lbc_attribute23_o =>ben_lbc_shd.g_old_rec.lbc_attribute23
484 ,p_lbc_attribute24_o =>ben_lbc_shd.g_old_rec.lbc_attribute24
485 ,p_lbc_attribute25_o =>ben_lbc_shd.g_old_rec.lbc_attribute25
486 ,p_lbc_attribute26_o =>ben_lbc_shd.g_old_rec.lbc_attribute26
487 ,p_lbc_attribute27_o =>ben_lbc_shd.g_old_rec.lbc_attribute27
488 ,p_lbc_attribute28_o =>ben_lbc_shd.g_old_rec.lbc_attribute28
489 ,p_lbc_attribute29_o =>ben_lbc_shd.g_old_rec.lbc_attribute29
490 ,p_lbc_attribute30_o =>ben_lbc_shd.g_old_rec.lbc_attribute30
491 ,p_object_version_number_o =>ben_lbc_shd.g_old_rec.object_version_number
492 );
493 --
494 exception
495 --
496 when hr_api.cannot_find_prog_unit then
497 --
498 hr_api.cannot_find_prog_unit_error
499 (p_module_name => 'ben_ler_bnft_rstrn_ctfn_f'
500 ,p_hook_type => 'AU');
501 --
502 end;
503 --
504 -- End of API User Hook for post_update.
505 --
506 --
507 hr_utility.set_location(' Leaving:'||l_proc, 10);
508 End post_update;
509 --
510 -- ----------------------------------------------------------------------------
511 -- |-----------------------------< convert_defs >-----------------------------|
512 -- ----------------------------------------------------------------------------
513 -- {Start Of Comments}
514 --
515 -- Description:
516 -- The Convert_Defs procedure has one very important function:
517 -- It must return the record structure for the row with all system defaulted
518 -- values converted into its corresponding parameter value for update. When
519 -- we attempt to update a row through the Upd process , certain
520 -- parameters can be defaulted which enables flexibility in the calling of
521 -- the upd process (e.g. only attributes which need to be updated need to be
522 -- specified). For the upd process to determine which attributes
523 -- have NOT been specified we need to check if the parameter has a reserved
524 -- system default value. Therefore, for all parameters which have a
525 -- corresponding reserved system default mechanism specified we need to
526 -- check if a system default is being used. If a system default is being
527 -- used then we convert the defaulted value into its corresponding attribute
528 -- value held in the g_old_rec data structure.
529 --
530 -- Prerequisites:
531 -- This private function can only be called from the upd process.
532 --
533 -- In Parameters:
534 -- A Pl/Sql record structre.
535 --
536 -- Post Success:
537 -- The record structure will be returned with all system defaulted parameter
538 -- values converted into its current row attribute value.
539 --
540 -- Post Failure:
541 -- No direct error handling is required within this function. Any possible
542 -- errors within this procedure will be a PL/SQL value error due to conversion
543 -- of datatypes or data lengths.
544 --
545 -- Developer Implementation Notes:
546 -- None.
547 --
548 -- Access Status:
549 -- Internal Row Handler Use Only.
550 --
551 -- {End Of Comments}
552 -- ----------------------------------------------------------------------------
553 Procedure convert_defs(p_rec in out nocopy ben_lbc_shd.g_rec_type) is
554 --
555 l_proc varchar2(72) := g_package||'convert_defs';
556 --
557 Begin
558 --
559 hr_utility.set_location('Entering:'||l_proc, 5);
560 --
561 -- We must now examine each argument value in the
562 -- p_rec plsql record structure
563 -- to see if a system default is being used. If a system default
564 -- is being used then we must set to the 'current' argument value.
565 --
566 If (p_rec.rqd_flag = hr_api.g_varchar2) then
567 p_rec.rqd_flag :=
568 ben_lbc_shd.g_old_rec.rqd_flag;
569 End If;
570 If (p_rec.enrt_ctfn_typ_cd = hr_api.g_varchar2) then
571 p_rec.enrt_ctfn_typ_cd :=
572 ben_lbc_shd.g_old_rec.enrt_ctfn_typ_cd;
573 End If;
574 If (p_rec.ctfn_rqd_when_rl = hr_api.g_number) then
575 p_rec.ctfn_rqd_when_rl :=
576 ben_lbc_shd.g_old_rec.ctfn_rqd_when_rl;
577 End If;
578 If (p_rec.ler_bnft_rstrn_id = hr_api.g_number) then
579 p_rec.ler_bnft_rstrn_id :=
580 ben_lbc_shd.g_old_rec.ler_bnft_rstrn_id;
581 End If;
582 If (p_rec.business_group_id = hr_api.g_number) then
583 p_rec.business_group_id :=
584 ben_lbc_shd.g_old_rec.business_group_id;
585 End If;
586 If (p_rec.lbc_attribute_category = hr_api.g_varchar2) then
587 p_rec.lbc_attribute_category :=
588 ben_lbc_shd.g_old_rec.lbc_attribute_category;
589 End If;
590 If (p_rec.lbc_attribute1 = hr_api.g_varchar2) then
591 p_rec.lbc_attribute1 :=
592 ben_lbc_shd.g_old_rec.lbc_attribute1;
593 End If;
594 If (p_rec.lbc_attribute2 = hr_api.g_varchar2) then
595 p_rec.lbc_attribute2 :=
596 ben_lbc_shd.g_old_rec.lbc_attribute2;
597 End If;
598 If (p_rec.lbc_attribute3 = hr_api.g_varchar2) then
599 p_rec.lbc_attribute3 :=
600 ben_lbc_shd.g_old_rec.lbc_attribute3;
601 End If;
602 If (p_rec.lbc_attribute4 = hr_api.g_varchar2) then
603 p_rec.lbc_attribute4 :=
604 ben_lbc_shd.g_old_rec.lbc_attribute4;
605 End If;
606 If (p_rec.lbc_attribute5 = hr_api.g_varchar2) then
607 p_rec.lbc_attribute5 :=
608 ben_lbc_shd.g_old_rec.lbc_attribute5;
609 End If;
610 If (p_rec.lbc_attribute6 = hr_api.g_varchar2) then
611 p_rec.lbc_attribute6 :=
612 ben_lbc_shd.g_old_rec.lbc_attribute6;
613 End If;
614 If (p_rec.lbc_attribute7 = hr_api.g_varchar2) then
615 p_rec.lbc_attribute7 :=
616 ben_lbc_shd.g_old_rec.lbc_attribute7;
617 End If;
618 If (p_rec.lbc_attribute8 = hr_api.g_varchar2) then
619 p_rec.lbc_attribute8 :=
620 ben_lbc_shd.g_old_rec.lbc_attribute8;
621 End If;
622 If (p_rec.lbc_attribute9 = hr_api.g_varchar2) then
623 p_rec.lbc_attribute9 :=
624 ben_lbc_shd.g_old_rec.lbc_attribute9;
625 End If;
626 If (p_rec.lbc_attribute10 = hr_api.g_varchar2) then
627 p_rec.lbc_attribute10 :=
628 ben_lbc_shd.g_old_rec.lbc_attribute10;
629 End If;
630 If (p_rec.lbc_attribute11 = hr_api.g_varchar2) then
631 p_rec.lbc_attribute11 :=
632 ben_lbc_shd.g_old_rec.lbc_attribute11;
633 End If;
634 If (p_rec.lbc_attribute12 = hr_api.g_varchar2) then
635 p_rec.lbc_attribute12 :=
636 ben_lbc_shd.g_old_rec.lbc_attribute12;
637 End If;
638 If (p_rec.lbc_attribute13 = hr_api.g_varchar2) then
639 p_rec.lbc_attribute13 :=
640 ben_lbc_shd.g_old_rec.lbc_attribute13;
641 End If;
642 If (p_rec.lbc_attribute14 = hr_api.g_varchar2) then
643 p_rec.lbc_attribute14 :=
644 ben_lbc_shd.g_old_rec.lbc_attribute14;
645 End If;
646 If (p_rec.lbc_attribute15 = hr_api.g_varchar2) then
647 p_rec.lbc_attribute15 :=
648 ben_lbc_shd.g_old_rec.lbc_attribute15;
649 End If;
650 If (p_rec.lbc_attribute16 = hr_api.g_varchar2) then
651 p_rec.lbc_attribute16 :=
652 ben_lbc_shd.g_old_rec.lbc_attribute16;
653 End If;
654 If (p_rec.lbc_attribute17 = hr_api.g_varchar2) then
655 p_rec.lbc_attribute17 :=
656 ben_lbc_shd.g_old_rec.lbc_attribute17;
657 End If;
658 If (p_rec.lbc_attribute18 = hr_api.g_varchar2) then
659 p_rec.lbc_attribute18 :=
660 ben_lbc_shd.g_old_rec.lbc_attribute18;
661 End If;
662 If (p_rec.lbc_attribute19 = hr_api.g_varchar2) then
663 p_rec.lbc_attribute19 :=
664 ben_lbc_shd.g_old_rec.lbc_attribute19;
665 End If;
666 If (p_rec.lbc_attribute20 = hr_api.g_varchar2) then
667 p_rec.lbc_attribute20 :=
668 ben_lbc_shd.g_old_rec.lbc_attribute20;
669 End If;
670 If (p_rec.lbc_attribute21 = hr_api.g_varchar2) then
671 p_rec.lbc_attribute21 :=
672 ben_lbc_shd.g_old_rec.lbc_attribute21;
673 End If;
674 If (p_rec.lbc_attribute22 = hr_api.g_varchar2) then
675 p_rec.lbc_attribute22 :=
676 ben_lbc_shd.g_old_rec.lbc_attribute22;
677 End If;
678 If (p_rec.lbc_attribute23 = hr_api.g_varchar2) then
679 p_rec.lbc_attribute23 :=
680 ben_lbc_shd.g_old_rec.lbc_attribute23;
681 End If;
682 If (p_rec.lbc_attribute24 = hr_api.g_varchar2) then
683 p_rec.lbc_attribute24 :=
684 ben_lbc_shd.g_old_rec.lbc_attribute24;
685 End If;
686 If (p_rec.lbc_attribute25 = hr_api.g_varchar2) then
687 p_rec.lbc_attribute25 :=
688 ben_lbc_shd.g_old_rec.lbc_attribute25;
689 End If;
690 If (p_rec.lbc_attribute26 = hr_api.g_varchar2) then
691 p_rec.lbc_attribute26 :=
692 ben_lbc_shd.g_old_rec.lbc_attribute26;
693 End If;
694 If (p_rec.lbc_attribute27 = hr_api.g_varchar2) then
695 p_rec.lbc_attribute27 :=
696 ben_lbc_shd.g_old_rec.lbc_attribute27;
697 End If;
698 If (p_rec.lbc_attribute28 = hr_api.g_varchar2) then
699 p_rec.lbc_attribute28 :=
700 ben_lbc_shd.g_old_rec.lbc_attribute28;
701 End If;
702 If (p_rec.lbc_attribute29 = hr_api.g_varchar2) then
703 p_rec.lbc_attribute29 :=
704 ben_lbc_shd.g_old_rec.lbc_attribute29;
705 End If;
706 If (p_rec.lbc_attribute30 = hr_api.g_varchar2) then
707 p_rec.lbc_attribute30 :=
708 ben_lbc_shd.g_old_rec.lbc_attribute30;
709 End If;
710
711 --
712 hr_utility.set_location(' Leaving:'||l_proc, 10);
713 --
714 End convert_defs;
715 --
716 -- ----------------------------------------------------------------------------
717 -- |---------------------------------< upd >----------------------------------|
718 -- ----------------------------------------------------------------------------
719 Procedure upd
720 (
721 p_rec in out nocopy ben_lbc_shd.g_rec_type,
722 p_effective_date in date,
723 p_datetrack_mode in varchar2
724 ) is
725 --
726 l_proc varchar2(72) := g_package||'upd';
727 l_validation_start_date date;
728 l_validation_end_date date;
729 --
730 Begin
731 hr_utility.set_location('Entering:'||l_proc, 5);
732 --
733 -- Ensure that the DateTrack update mode is valid
734 --
735 dt_api.validate_dt_upd_mode(p_datetrack_mode => p_datetrack_mode);
736 --
737 -- We must lock the row which we need to update.
738 --
739 ben_lbc_shd.lck
740 (p_effective_date => p_effective_date,
741 p_datetrack_mode => p_datetrack_mode,
742 p_ler_bnft_rstrn_ctfn_id => p_rec.ler_bnft_rstrn_ctfn_id,
743 p_object_version_number => p_rec.object_version_number,
744 p_validation_start_date => l_validation_start_date,
745 p_validation_end_date => l_validation_end_date);
746 --
747 -- 1. During an update system defaults are used to determine if
748 -- arguments have been defaulted or not. We must therefore
749 -- derive the full record structure values to be updated.
750 --
751 -- 2. Call the supporting update validate operations.
752 --
753 convert_defs(p_rec);
754 ben_lbc_bus.update_validate
755 (p_rec => p_rec,
756 p_effective_date => p_effective_date,
757 p_datetrack_mode => p_datetrack_mode,
758 p_validation_start_date => l_validation_start_date,
759 p_validation_end_date => l_validation_end_date);
760 --
761 -- Call the supporting pre-update operation
762 --
763 pre_update
764 (p_rec => p_rec,
765 p_effective_date => p_effective_date,
766 p_datetrack_mode => p_datetrack_mode,
767 p_validation_start_date => l_validation_start_date,
768 p_validation_end_date => l_validation_end_date);
769 --
770 -- Update the row.
771 --
772 update_dml
773 (p_rec => p_rec,
774 p_effective_date => p_effective_date,
775 p_datetrack_mode => p_datetrack_mode,
776 p_validation_start_date => l_validation_start_date,
777 p_validation_end_date => l_validation_end_date);
778 --
779 -- Call the supporting post-update operation
780 --
781 post_update
782 (p_rec => p_rec,
783 p_effective_date => p_effective_date,
784 p_datetrack_mode => p_datetrack_mode,
785 p_validation_start_date => l_validation_start_date,
786 p_validation_end_date => l_validation_end_date);
787 End upd;
788 --
789 -- ----------------------------------------------------------------------------
790 -- |---------------------------------< upd >----------------------------------|
791 -- ----------------------------------------------------------------------------
792 Procedure upd
793 (
794 p_ler_bnft_rstrn_ctfn_id in number,
795 p_effective_start_date out nocopy date,
796 p_effective_end_date out nocopy date,
797 p_rqd_flag in varchar2 default hr_api.g_varchar2,
798 p_enrt_ctfn_typ_cd in varchar2 default hr_api.g_varchar2,
799 p_ctfn_rqd_when_rl in number default hr_api.g_number,
800 p_ler_bnft_rstrn_id in number default hr_api.g_number,
801 p_business_group_id in number default hr_api.g_number,
802 p_lbc_attribute_category in varchar2 default hr_api.g_varchar2,
803 p_lbc_attribute1 in varchar2 default hr_api.g_varchar2,
804 p_lbc_attribute2 in varchar2 default hr_api.g_varchar2,
805 p_lbc_attribute3 in varchar2 default hr_api.g_varchar2,
806 p_lbc_attribute4 in varchar2 default hr_api.g_varchar2,
807 p_lbc_attribute5 in varchar2 default hr_api.g_varchar2,
808 p_lbc_attribute6 in varchar2 default hr_api.g_varchar2,
809 p_lbc_attribute7 in varchar2 default hr_api.g_varchar2,
810 p_lbc_attribute8 in varchar2 default hr_api.g_varchar2,
811 p_lbc_attribute9 in varchar2 default hr_api.g_varchar2,
812 p_lbc_attribute10 in varchar2 default hr_api.g_varchar2,
813 p_lbc_attribute11 in varchar2 default hr_api.g_varchar2,
814 p_lbc_attribute12 in varchar2 default hr_api.g_varchar2,
815 p_lbc_attribute13 in varchar2 default hr_api.g_varchar2,
816 p_lbc_attribute14 in varchar2 default hr_api.g_varchar2,
817 p_lbc_attribute15 in varchar2 default hr_api.g_varchar2,
818 p_lbc_attribute16 in varchar2 default hr_api.g_varchar2,
819 p_lbc_attribute17 in varchar2 default hr_api.g_varchar2,
820 p_lbc_attribute18 in varchar2 default hr_api.g_varchar2,
821 p_lbc_attribute19 in varchar2 default hr_api.g_varchar2,
822 p_lbc_attribute20 in varchar2 default hr_api.g_varchar2,
823 p_lbc_attribute21 in varchar2 default hr_api.g_varchar2,
824 p_lbc_attribute22 in varchar2 default hr_api.g_varchar2,
825 p_lbc_attribute23 in varchar2 default hr_api.g_varchar2,
826 p_lbc_attribute24 in varchar2 default hr_api.g_varchar2,
827 p_lbc_attribute25 in varchar2 default hr_api.g_varchar2,
828 p_lbc_attribute26 in varchar2 default hr_api.g_varchar2,
829 p_lbc_attribute27 in varchar2 default hr_api.g_varchar2,
830 p_lbc_attribute28 in varchar2 default hr_api.g_varchar2,
831 p_lbc_attribute29 in varchar2 default hr_api.g_varchar2,
832 p_lbc_attribute30 in varchar2 default hr_api.g_varchar2,
833 p_object_version_number in out nocopy number,
834 p_effective_date in date,
835 p_datetrack_mode in varchar2
836 ) is
837 --
838 l_rec ben_lbc_shd.g_rec_type;
839 l_proc varchar2(72) := g_package||'upd';
840 --
841 Begin
842 hr_utility.set_location('Entering:'||l_proc, 5);
843 --
844 -- Call conversion function to turn arguments into the
845 -- l_rec structure.
846 --
847 l_rec :=
848 ben_lbc_shd.convert_args
849 (
850 p_ler_bnft_rstrn_ctfn_id,
851 null,
852 null,
853 p_rqd_flag,
854 p_enrt_ctfn_typ_cd,
855 p_ctfn_rqd_when_rl,
856 p_ler_bnft_rstrn_id,
857 p_business_group_id,
858 p_lbc_attribute_category,
859 p_lbc_attribute1,
860 p_lbc_attribute2,
861 p_lbc_attribute3,
862 p_lbc_attribute4,
863 p_lbc_attribute5,
864 p_lbc_attribute6,
865 p_lbc_attribute7,
866 p_lbc_attribute8,
867 p_lbc_attribute9,
868 p_lbc_attribute10,
869 p_lbc_attribute11,
870 p_lbc_attribute12,
871 p_lbc_attribute13,
872 p_lbc_attribute14,
873 p_lbc_attribute15,
874 p_lbc_attribute16,
875 p_lbc_attribute17,
876 p_lbc_attribute18,
877 p_lbc_attribute19,
878 p_lbc_attribute20,
879 p_lbc_attribute21,
880 p_lbc_attribute22,
881 p_lbc_attribute23,
882 p_lbc_attribute24,
883 p_lbc_attribute25,
884 p_lbc_attribute26,
885 p_lbc_attribute27,
886 p_lbc_attribute28,
887 p_lbc_attribute29,
888 p_lbc_attribute30,
889 p_object_version_number
890 );
891 --
892 -- Having converted the arguments into the
893 -- plsql record structure we call the corresponding record
894 -- business process.
895 --
896 upd(l_rec, p_effective_date, p_datetrack_mode);
897 p_object_version_number := l_rec.object_version_number;
898 p_effective_start_date := l_rec.effective_start_date;
899 p_effective_end_date := l_rec.effective_end_date;
900 --
901 --
902 hr_utility.set_location(' Leaving:'||l_proc, 10);
903 End upd;
904 --
905 end ben_lbc_upd;