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