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