1 Package Body ben_erp_upd as
2 /* $Header: beerprhi.pkb 115.7 2002/12/16 13:25:29 vsethi ship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- | Private Global Definitions |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package varchar2(33) := ' ben_erp_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_erp_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_enrt_perd_for_pl_f',
78 p_base_key_column => 'enrt_perd_for_pl_id',
79 p_base_key_value => p_rec.enrt_perd_for_pl_id);
80 --
81 ben_erp_shd.g_api_dml := true; -- Set the api dml status
82 --
83 -- Update the ben_enrt_perd_for_pl_f Row
84 --
85 update ben_enrt_perd_for_pl_f
86 set
87 enrt_perd_for_pl_id = p_rec.enrt_perd_for_pl_id,
88 enrt_cvg_strt_dt_cd = p_rec.enrt_cvg_strt_dt_cd,
89 enrt_cvg_strt_dt_rl = p_rec.enrt_cvg_strt_dt_rl,
90 enrt_cvg_end_dt_cd = p_rec.enrt_cvg_end_dt_cd,
91 enrt_cvg_end_dt_rl = p_rec.enrt_cvg_end_dt_rl,
92 rt_strt_dt_cd = p_rec.rt_strt_dt_cd,
93 rt_strt_dt_rl = p_rec.rt_strt_dt_rl,
94 rt_end_dt_cd = p_rec.rt_end_dt_cd,
95 rt_end_dt_rl = p_rec.rt_end_dt_rl,
96 enrt_perd_id = p_rec.enrt_perd_id,
97 pl_id = p_rec.pl_id,
98 lee_rsn_id = p_rec.lee_rsn_id,
99 business_group_id = p_rec.business_group_id,
100 erp_attribute_category = p_rec.erp_attribute_category,
101 erp_attribute1 = p_rec.erp_attribute1,
102 erp_attribute2 = p_rec.erp_attribute2,
103 erp_attribute3 = p_rec.erp_attribute3,
104 erp_attribute4 = p_rec.erp_attribute4,
105 erp_attribute5 = p_rec.erp_attribute5,
106 erp_attribute6 = p_rec.erp_attribute6,
107 erp_attribute7 = p_rec.erp_attribute7,
108 erp_attribute8 = p_rec.erp_attribute8,
109 erp_attribute9 = p_rec.erp_attribute9,
110 erp_attribute10 = p_rec.erp_attribute10,
111 erp_attribute11 = p_rec.erp_attribute11,
112 erp_attribute12 = p_rec.erp_attribute12,
113 erp_attribute13 = p_rec.erp_attribute13,
114 erp_attribute14 = p_rec.erp_attribute14,
115 erp_attribute15 = p_rec.erp_attribute15,
116 erp_attribute16 = p_rec.erp_attribute16,
117 erp_attribute17 = p_rec.erp_attribute17,
118 erp_attribute18 = p_rec.erp_attribute18,
119 erp_attribute19 = p_rec.erp_attribute19,
120 erp_attribute20 = p_rec.erp_attribute20,
121 erp_attribute21 = p_rec.erp_attribute21,
122 erp_attribute22 = p_rec.erp_attribute22,
123 erp_attribute23 = p_rec.erp_attribute23,
124 erp_attribute24 = p_rec.erp_attribute24,
125 erp_attribute25 = p_rec.erp_attribute25,
126 erp_attribute26 = p_rec.erp_attribute26,
127 erp_attribute27 = p_rec.erp_attribute27,
128 erp_attribute28 = p_rec.erp_attribute28,
129 erp_attribute29 = p_rec.erp_attribute29,
130 erp_attribute30 = p_rec.erp_attribute30,
131 object_version_number = p_rec.object_version_number
132 where enrt_perd_for_pl_id = p_rec.enrt_perd_for_pl_id
133 and effective_start_date = p_validation_start_date
134 and effective_end_date = p_validation_end_date;
135 --
136 ben_erp_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_erp_shd.g_api_dml := false; -- Unset the api dml status
149 ben_erp_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_erp_shd.g_api_dml := false; -- Unset the api dml status
154 ben_erp_shd.constraint_error
155 (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
156 When Others Then
157 ben_erp_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_erp_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_erp_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_erp_shd.upd_effective_end_date
274 (p_effective_date => p_effective_date,
275 p_base_key_value => p_rec.enrt_perd_for_pl_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_erp_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_erp_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_erp_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}
396 -- ----------------------------------------------------------------------------
397 Procedure post_update
398 (p_rec in ben_erp_shd.g_rec_type,
399 p_effective_date in date,
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_erp_rku.after_update
415 (
416 p_enrt_perd_for_pl_id =>p_rec.enrt_perd_for_pl_id
417 ,p_effective_start_date =>p_rec.effective_start_date
418 ,p_effective_end_date =>p_rec.effective_end_date
419 ,p_enrt_cvg_strt_dt_cd =>p_rec.enrt_cvg_strt_dt_cd
420 ,p_enrt_cvg_strt_dt_rl =>p_rec.enrt_cvg_strt_dt_rl
421 ,p_enrt_cvg_end_dt_cd =>p_rec.enrt_cvg_end_dt_cd
422 ,p_enrt_cvg_end_dt_rl =>p_rec.enrt_cvg_end_dt_rl
423 ,p_rt_strt_dt_cd =>p_rec.rt_strt_dt_cd
424 ,p_rt_strt_dt_rl =>p_rec.rt_strt_dt_rl
425 ,p_rt_end_dt_cd =>p_rec.rt_end_dt_cd
426 ,p_rt_end_dt_rl =>p_rec.rt_end_dt_rl
427 ,p_enrt_perd_id =>p_rec.enrt_perd_id
428 ,p_pl_id =>p_rec.pl_id
429 ,p_lee_rsn_id =>p_rec.lee_rsn_id
430 ,p_business_group_id =>p_rec.business_group_id
431 ,p_erp_attribute_category =>p_rec.erp_attribute_category
432 ,p_erp_attribute1 =>p_rec.erp_attribute1
433 ,p_erp_attribute2 =>p_rec.erp_attribute2
434 ,p_erp_attribute3 =>p_rec.erp_attribute3
435 ,p_erp_attribute4 =>p_rec.erp_attribute4
436 ,p_erp_attribute5 =>p_rec.erp_attribute5
437 ,p_erp_attribute6 =>p_rec.erp_attribute6
438 ,p_erp_attribute7 =>p_rec.erp_attribute7
439 ,p_erp_attribute8 =>p_rec.erp_attribute8
440 ,p_erp_attribute9 =>p_rec.erp_attribute9
441 ,p_erp_attribute10 =>p_rec.erp_attribute10
442 ,p_erp_attribute11 =>p_rec.erp_attribute11
443 ,p_erp_attribute12 =>p_rec.erp_attribute12
444 ,p_erp_attribute13 =>p_rec.erp_attribute13
445 ,p_erp_attribute14 =>p_rec.erp_attribute14
446 ,p_erp_attribute15 =>p_rec.erp_attribute15
447 ,p_erp_attribute16 =>p_rec.erp_attribute16
448 ,p_erp_attribute17 =>p_rec.erp_attribute17
449 ,p_erp_attribute18 =>p_rec.erp_attribute18
450 ,p_erp_attribute19 =>p_rec.erp_attribute19
451 ,p_erp_attribute20 =>p_rec.erp_attribute20
452 ,p_erp_attribute21 =>p_rec.erp_attribute21
453 ,p_erp_attribute22 =>p_rec.erp_attribute22
454 ,p_erp_attribute23 =>p_rec.erp_attribute23
455 ,p_erp_attribute24 =>p_rec.erp_attribute24
456 ,p_erp_attribute25 =>p_rec.erp_attribute25
457 ,p_erp_attribute26 =>p_rec.erp_attribute26
458 ,p_erp_attribute27 =>p_rec.erp_attribute27
459 ,p_erp_attribute28 =>p_rec.erp_attribute28
460 ,p_erp_attribute29 =>p_rec.erp_attribute29
461 ,p_erp_attribute30 =>p_rec.erp_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_erp_shd.g_old_rec.effective_start_date
468 ,p_effective_end_date_o =>ben_erp_shd.g_old_rec.effective_end_date
469 ,p_enrt_cvg_strt_dt_cd_o =>ben_erp_shd.g_old_rec.enrt_cvg_strt_dt_cd
470 ,p_enrt_cvg_strt_dt_rl_o =>ben_erp_shd.g_old_rec.enrt_cvg_strt_dt_rl
471 ,p_enrt_cvg_end_dt_cd_o =>ben_erp_shd.g_old_rec.enrt_cvg_end_dt_cd
472 ,p_enrt_cvg_end_dt_rl_o =>ben_erp_shd.g_old_rec.enrt_cvg_end_dt_rl
473 ,p_rt_strt_dt_cd_o =>ben_erp_shd.g_old_rec.rt_strt_dt_cd
474 ,p_rt_strt_dt_rl_o =>ben_erp_shd.g_old_rec.rt_strt_dt_rl
475 ,p_rt_end_dt_cd_o =>ben_erp_shd.g_old_rec.rt_end_dt_cd
476 ,p_rt_end_dt_rl_o =>ben_erp_shd.g_old_rec.rt_end_dt_rl
477 ,p_enrt_perd_id_o =>ben_erp_shd.g_old_rec.enrt_perd_id
478 ,p_pl_id_o =>ben_erp_shd.g_old_rec.pl_id
479 ,p_lee_rsn_id_o =>ben_erp_shd.g_old_rec.lee_rsn_id
480 ,p_business_group_id_o =>ben_erp_shd.g_old_rec.business_group_id
481 ,p_erp_attribute_category_o =>ben_erp_shd.g_old_rec.erp_attribute_category
482 ,p_erp_attribute1_o =>ben_erp_shd.g_old_rec.erp_attribute1
483 ,p_erp_attribute2_o =>ben_erp_shd.g_old_rec.erp_attribute2
484 ,p_erp_attribute3_o =>ben_erp_shd.g_old_rec.erp_attribute3
485 ,p_erp_attribute4_o =>ben_erp_shd.g_old_rec.erp_attribute4
486 ,p_erp_attribute5_o =>ben_erp_shd.g_old_rec.erp_attribute5
487 ,p_erp_attribute6_o =>ben_erp_shd.g_old_rec.erp_attribute6
488 ,p_erp_attribute7_o =>ben_erp_shd.g_old_rec.erp_attribute7
489 ,p_erp_attribute8_o =>ben_erp_shd.g_old_rec.erp_attribute8
490 ,p_erp_attribute9_o =>ben_erp_shd.g_old_rec.erp_attribute9
491 ,p_erp_attribute10_o =>ben_erp_shd.g_old_rec.erp_attribute10
492 ,p_erp_attribute11_o =>ben_erp_shd.g_old_rec.erp_attribute11
493 ,p_erp_attribute12_o =>ben_erp_shd.g_old_rec.erp_attribute12
494 ,p_erp_attribute13_o =>ben_erp_shd.g_old_rec.erp_attribute13
495 ,p_erp_attribute14_o =>ben_erp_shd.g_old_rec.erp_attribute14
496 ,p_erp_attribute15_o =>ben_erp_shd.g_old_rec.erp_attribute15
497 ,p_erp_attribute16_o =>ben_erp_shd.g_old_rec.erp_attribute16
498 ,p_erp_attribute17_o =>ben_erp_shd.g_old_rec.erp_attribute17
499 ,p_erp_attribute18_o =>ben_erp_shd.g_old_rec.erp_attribute18
500 ,p_erp_attribute19_o =>ben_erp_shd.g_old_rec.erp_attribute19
501 ,p_erp_attribute20_o =>ben_erp_shd.g_old_rec.erp_attribute20
502 ,p_erp_attribute21_o =>ben_erp_shd.g_old_rec.erp_attribute21
503 ,p_erp_attribute22_o =>ben_erp_shd.g_old_rec.erp_attribute22
504 ,p_erp_attribute23_o =>ben_erp_shd.g_old_rec.erp_attribute23
505 ,p_erp_attribute24_o =>ben_erp_shd.g_old_rec.erp_attribute24
506 ,p_erp_attribute25_o =>ben_erp_shd.g_old_rec.erp_attribute25
507 ,p_erp_attribute26_o =>ben_erp_shd.g_old_rec.erp_attribute26
508 ,p_erp_attribute27_o =>ben_erp_shd.g_old_rec.erp_attribute27
509 ,p_erp_attribute28_o =>ben_erp_shd.g_old_rec.erp_attribute28
510 ,p_erp_attribute29_o =>ben_erp_shd.g_old_rec.erp_attribute29
511 ,p_erp_attribute30_o =>ben_erp_shd.g_old_rec.erp_attribute30
512 ,p_object_version_number_o =>ben_erp_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_enrt_perd_for_pl_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_erp_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.enrt_cvg_strt_dt_cd = hr_api.g_varchar2) then
588 p_rec.enrt_cvg_strt_dt_cd :=
589 ben_erp_shd.g_old_rec.enrt_cvg_strt_dt_cd;
590 End If;
591 If (p_rec.enrt_cvg_strt_dt_rl = hr_api.g_number) then
592 p_rec.enrt_cvg_strt_dt_rl :=
593 ben_erp_shd.g_old_rec.enrt_cvg_strt_dt_rl;
594 End If;
595 If (p_rec.enrt_cvg_end_dt_cd = hr_api.g_varchar2) then
596 p_rec.enrt_cvg_end_dt_cd :=
597 ben_erp_shd.g_old_rec.enrt_cvg_end_dt_cd;
598 End If;
599 If (p_rec.enrt_cvg_end_dt_rl = hr_api.g_number) then
600 p_rec.enrt_cvg_end_dt_rl :=
601 ben_erp_shd.g_old_rec.enrt_cvg_end_dt_rl;
602 End If;
603 If (p_rec.rt_strt_dt_cd = hr_api.g_varchar2) then
604 p_rec.rt_strt_dt_cd :=
605 ben_erp_shd.g_old_rec.rt_strt_dt_cd;
606 End If;
607 If (p_rec.rt_strt_dt_rl = hr_api.g_number) then
608 p_rec.rt_strt_dt_rl :=
609 ben_erp_shd.g_old_rec.rt_strt_dt_rl;
610 End If;
611 If (p_rec.rt_end_dt_cd = hr_api.g_varchar2) then
612 p_rec.rt_end_dt_cd :=
613 ben_erp_shd.g_old_rec.rt_end_dt_cd;
614 End If;
615 If (p_rec.rt_end_dt_rl = hr_api.g_number) then
616 p_rec.rt_end_dt_rl :=
617 ben_erp_shd.g_old_rec.rt_end_dt_rl;
618 End If;
619 If (p_rec.enrt_perd_id = hr_api.g_number) then
620 p_rec.enrt_perd_id :=
621 ben_erp_shd.g_old_rec.enrt_perd_id;
622 End If;
623 If (p_rec.pl_id = hr_api.g_number) then
624 p_rec.pl_id :=
625 ben_erp_shd.g_old_rec.pl_id;
626 End If;
627 If (p_rec.lee_rsn_id = hr_api.g_number) then
628 p_rec.lee_rsn_id :=
629 ben_erp_shd.g_old_rec.lee_rsn_id;
630 End If;
631 If (p_rec.business_group_id = hr_api.g_number) then
632 p_rec.business_group_id :=
633 ben_erp_shd.g_old_rec.business_group_id;
634 End If;
635 If (p_rec.erp_attribute_category = hr_api.g_varchar2) then
636 p_rec.erp_attribute_category :=
637 ben_erp_shd.g_old_rec.erp_attribute_category;
638 End If;
639 If (p_rec.erp_attribute1 = hr_api.g_varchar2) then
640 p_rec.erp_attribute1 :=
641 ben_erp_shd.g_old_rec.erp_attribute1;
642 End If;
643 If (p_rec.erp_attribute2 = hr_api.g_varchar2) then
644 p_rec.erp_attribute2 :=
645 ben_erp_shd.g_old_rec.erp_attribute2;
646 End If;
647 If (p_rec.erp_attribute3 = hr_api.g_varchar2) then
648 p_rec.erp_attribute3 :=
649 ben_erp_shd.g_old_rec.erp_attribute3;
650 End If;
651 If (p_rec.erp_attribute4 = hr_api.g_varchar2) then
652 p_rec.erp_attribute4 :=
653 ben_erp_shd.g_old_rec.erp_attribute4;
654 End If;
655 If (p_rec.erp_attribute5 = hr_api.g_varchar2) then
656 p_rec.erp_attribute5 :=
657 ben_erp_shd.g_old_rec.erp_attribute5;
658 End If;
659 If (p_rec.erp_attribute6 = hr_api.g_varchar2) then
660 p_rec.erp_attribute6 :=
661 ben_erp_shd.g_old_rec.erp_attribute6;
662 End If;
663 If (p_rec.erp_attribute7 = hr_api.g_varchar2) then
664 p_rec.erp_attribute7 :=
665 ben_erp_shd.g_old_rec.erp_attribute7;
666 End If;
667 If (p_rec.erp_attribute8 = hr_api.g_varchar2) then
668 p_rec.erp_attribute8 :=
669 ben_erp_shd.g_old_rec.erp_attribute8;
670 End If;
671 If (p_rec.erp_attribute9 = hr_api.g_varchar2) then
672 p_rec.erp_attribute9 :=
673 ben_erp_shd.g_old_rec.erp_attribute9;
674 End If;
675 If (p_rec.erp_attribute10 = hr_api.g_varchar2) then
676 p_rec.erp_attribute10 :=
677 ben_erp_shd.g_old_rec.erp_attribute10;
678 End If;
679 If (p_rec.erp_attribute11 = hr_api.g_varchar2) then
680 p_rec.erp_attribute11 :=
681 ben_erp_shd.g_old_rec.erp_attribute11;
682 End If;
683 If (p_rec.erp_attribute12 = hr_api.g_varchar2) then
684 p_rec.erp_attribute12 :=
685 ben_erp_shd.g_old_rec.erp_attribute12;
686 End If;
687 If (p_rec.erp_attribute13 = hr_api.g_varchar2) then
688 p_rec.erp_attribute13 :=
689 ben_erp_shd.g_old_rec.erp_attribute13;
690 End If;
691 If (p_rec.erp_attribute14 = hr_api.g_varchar2) then
692 p_rec.erp_attribute14 :=
693 ben_erp_shd.g_old_rec.erp_attribute14;
694 End If;
695 If (p_rec.erp_attribute15 = hr_api.g_varchar2) then
696 p_rec.erp_attribute15 :=
697 ben_erp_shd.g_old_rec.erp_attribute15;
698 End If;
699 If (p_rec.erp_attribute16 = hr_api.g_varchar2) then
700 p_rec.erp_attribute16 :=
701 ben_erp_shd.g_old_rec.erp_attribute16;
702 End If;
703 If (p_rec.erp_attribute17 = hr_api.g_varchar2) then
704 p_rec.erp_attribute17 :=
705 ben_erp_shd.g_old_rec.erp_attribute17;
706 End If;
707 If (p_rec.erp_attribute18 = hr_api.g_varchar2) then
708 p_rec.erp_attribute18 :=
709 ben_erp_shd.g_old_rec.erp_attribute18;
710 End If;
711 If (p_rec.erp_attribute19 = hr_api.g_varchar2) then
712 p_rec.erp_attribute19 :=
713 ben_erp_shd.g_old_rec.erp_attribute19;
714 End If;
715 If (p_rec.erp_attribute20 = hr_api.g_varchar2) then
716 p_rec.erp_attribute20 :=
717 ben_erp_shd.g_old_rec.erp_attribute20;
718 End If;
719 If (p_rec.erp_attribute21 = hr_api.g_varchar2) then
720 p_rec.erp_attribute21 :=
721 ben_erp_shd.g_old_rec.erp_attribute21;
722 End If;
723 If (p_rec.erp_attribute22 = hr_api.g_varchar2) then
724 p_rec.erp_attribute22 :=
725 ben_erp_shd.g_old_rec.erp_attribute22;
726 End If;
727 If (p_rec.erp_attribute23 = hr_api.g_varchar2) then
728 p_rec.erp_attribute23 :=
729 ben_erp_shd.g_old_rec.erp_attribute23;
730 End If;
731 If (p_rec.erp_attribute24 = hr_api.g_varchar2) then
732 p_rec.erp_attribute24 :=
733 ben_erp_shd.g_old_rec.erp_attribute24;
734 End If;
735 If (p_rec.erp_attribute25 = hr_api.g_varchar2) then
736 p_rec.erp_attribute25 :=
737 ben_erp_shd.g_old_rec.erp_attribute25;
738 End If;
739 If (p_rec.erp_attribute26 = hr_api.g_varchar2) then
740 p_rec.erp_attribute26 :=
741 ben_erp_shd.g_old_rec.erp_attribute26;
742 End If;
743 If (p_rec.erp_attribute27 = hr_api.g_varchar2) then
744 p_rec.erp_attribute27 :=
745 ben_erp_shd.g_old_rec.erp_attribute27;
746 End If;
747 If (p_rec.erp_attribute28 = hr_api.g_varchar2) then
748 p_rec.erp_attribute28 :=
749 ben_erp_shd.g_old_rec.erp_attribute28;
750 End If;
751 If (p_rec.erp_attribute29 = hr_api.g_varchar2) then
752 p_rec.erp_attribute29 :=
753 ben_erp_shd.g_old_rec.erp_attribute29;
754 End If;
755 If (p_rec.erp_attribute30 = hr_api.g_varchar2) then
756 p_rec.erp_attribute30 :=
757 ben_erp_shd.g_old_rec.erp_attribute30;
758 End If;
759
760 --
761 hr_utility.set_location(' Leaving:'||l_proc, 10);
762 --
763 End convert_defs;
764 --
765 -- ----------------------------------------------------------------------------
766 -- |---------------------------------< upd >----------------------------------|
767 -- ----------------------------------------------------------------------------
768 Procedure upd
769 (
770 p_rec in out nocopy ben_erp_shd.g_rec_type,
771 p_effective_date in date,
772 p_datetrack_mode in varchar2
773 ) is
774 --
775 l_proc varchar2(72) := g_package||'upd';
776 l_validation_start_date date;
777 l_validation_end_date date;
778 --
779 Begin
780 hr_utility.set_location('Entering:'||l_proc, 5);
781 --
782 -- Ensure that the DateTrack update mode is valid
783 --
784 dt_api.validate_dt_upd_mode(p_datetrack_mode => p_datetrack_mode);
785 --
786 -- We must lock the row which we need to update.
787 --
788 ben_erp_shd.lck
789 (p_effective_date => p_effective_date,
790 p_datetrack_mode => p_datetrack_mode,
791 p_enrt_perd_for_pl_id => p_rec.enrt_perd_for_pl_id,
792 p_object_version_number => p_rec.object_version_number,
793 p_validation_start_date => l_validation_start_date,
794 p_validation_end_date => l_validation_end_date);
795 --
796 -- 1. During an update system defaults are used to determine if
797 -- arguments have been defaulted or not. We must therefore
798 -- derive the full record structure values to be updated.
799 --
800 -- 2. Call the supporting update validate operations.
801 --
802 convert_defs(p_rec);
803 ben_erp_bus.update_validate
804 (p_rec => p_rec,
805 p_effective_date => p_effective_date,
806 p_datetrack_mode => p_datetrack_mode,
807 p_validation_start_date => l_validation_start_date,
808 p_validation_end_date => l_validation_end_date);
809 --
810 -- Call the supporting pre-update operation
811 --
812 pre_update
813 (p_rec => p_rec,
814 p_effective_date => p_effective_date,
815 p_datetrack_mode => p_datetrack_mode,
816 p_validation_start_date => l_validation_start_date,
817 p_validation_end_date => l_validation_end_date);
818 --
819 -- Update the row.
820 --
821 update_dml
822 (p_rec => p_rec,
823 p_effective_date => p_effective_date,
824 p_datetrack_mode => p_datetrack_mode,
825 p_validation_start_date => l_validation_start_date,
826 p_validation_end_date => l_validation_end_date);
827 --
828 -- Call the supporting post-update operation
829 --
830 post_update
831 (p_rec => p_rec,
832 p_effective_date => p_effective_date,
833 p_datetrack_mode => p_datetrack_mode,
834 p_validation_start_date => l_validation_start_date,
835 p_validation_end_date => l_validation_end_date);
836 End upd;
837 --
838 -- ----------------------------------------------------------------------------
839 -- |---------------------------------< upd >----------------------------------|
840 -- ----------------------------------------------------------------------------
841 Procedure upd
842 (
843 p_enrt_perd_for_pl_id in number,
844 p_effective_start_date out nocopy date,
845 p_effective_end_date out nocopy date,
846 p_enrt_cvg_strt_dt_cd in varchar2 default hr_api.g_varchar2,
847 p_enrt_cvg_strt_dt_rl in number default hr_api.g_number,
848 p_enrt_cvg_end_dt_cd in varchar2 default hr_api.g_varchar2,
849 p_enrt_cvg_end_dt_rl in number default hr_api.g_number,
850 p_rt_strt_dt_cd in varchar2 default hr_api.g_varchar2,
851 p_rt_strt_dt_rl in number default hr_api.g_number,
852 p_rt_end_dt_cd in varchar2 default hr_api.g_varchar2,
853 p_rt_end_dt_rl in number default hr_api.g_number,
854 p_enrt_perd_id in number default hr_api.g_number,
855 p_pl_id in number default hr_api.g_number,
856 p_lee_rsn_id in number default hr_api.g_number,
857 p_business_group_id in number default hr_api.g_number,
858 p_erp_attribute_category in varchar2 default hr_api.g_varchar2,
859 p_erp_attribute1 in varchar2 default hr_api.g_varchar2,
860 p_erp_attribute2 in varchar2 default hr_api.g_varchar2,
861 p_erp_attribute3 in varchar2 default hr_api.g_varchar2,
862 p_erp_attribute4 in varchar2 default hr_api.g_varchar2,
863 p_erp_attribute5 in varchar2 default hr_api.g_varchar2,
864 p_erp_attribute6 in varchar2 default hr_api.g_varchar2,
865 p_erp_attribute7 in varchar2 default hr_api.g_varchar2,
866 p_erp_attribute8 in varchar2 default hr_api.g_varchar2,
867 p_erp_attribute9 in varchar2 default hr_api.g_varchar2,
868 p_erp_attribute10 in varchar2 default hr_api.g_varchar2,
869 p_erp_attribute11 in varchar2 default hr_api.g_varchar2,
870 p_erp_attribute12 in varchar2 default hr_api.g_varchar2,
871 p_erp_attribute13 in varchar2 default hr_api.g_varchar2,
872 p_erp_attribute14 in varchar2 default hr_api.g_varchar2,
873 p_erp_attribute15 in varchar2 default hr_api.g_varchar2,
874 p_erp_attribute16 in varchar2 default hr_api.g_varchar2,
875 p_erp_attribute17 in varchar2 default hr_api.g_varchar2,
876 p_erp_attribute18 in varchar2 default hr_api.g_varchar2,
877 p_erp_attribute19 in varchar2 default hr_api.g_varchar2,
878 p_erp_attribute20 in varchar2 default hr_api.g_varchar2,
879 p_erp_attribute21 in varchar2 default hr_api.g_varchar2,
880 p_erp_attribute22 in varchar2 default hr_api.g_varchar2,
881 p_erp_attribute23 in varchar2 default hr_api.g_varchar2,
882 p_erp_attribute24 in varchar2 default hr_api.g_varchar2,
883 p_erp_attribute25 in varchar2 default hr_api.g_varchar2,
884 p_erp_attribute26 in varchar2 default hr_api.g_varchar2,
885 p_erp_attribute27 in varchar2 default hr_api.g_varchar2,
886 p_erp_attribute28 in varchar2 default hr_api.g_varchar2,
887 p_erp_attribute29 in varchar2 default hr_api.g_varchar2,
888 p_erp_attribute30 in varchar2 default hr_api.g_varchar2,
889 p_object_version_number in out nocopy number,
890 p_effective_date in date,
891 p_datetrack_mode in varchar2
892 ) is
893 --
894 l_rec ben_erp_shd.g_rec_type;
895 l_proc varchar2(72) := g_package||'upd';
896 --
897 Begin
898 hr_utility.set_location('Entering:'||l_proc, 5);
899 --
900 -- Call conversion function to turn arguments into the
901 -- l_rec structure.
902 --
903 l_rec :=
904 ben_erp_shd.convert_args
905 (
906 p_enrt_perd_for_pl_id,
907 null,
908 null,
909 p_enrt_cvg_strt_dt_cd,
910 p_enrt_cvg_strt_dt_rl,
911 p_enrt_cvg_end_dt_cd,
912 p_enrt_cvg_end_dt_rl,
913 p_rt_strt_dt_cd,
914 p_rt_strt_dt_rl,
915 p_rt_end_dt_cd,
916 p_rt_end_dt_rl,
917 p_enrt_perd_id,
918 p_pl_id,
919 p_lee_rsn_id,
920 p_business_group_id,
921 p_erp_attribute_category,
922 p_erp_attribute1,
923 p_erp_attribute2,
924 p_erp_attribute3,
925 p_erp_attribute4,
926 p_erp_attribute5,
927 p_erp_attribute6,
928 p_erp_attribute7,
929 p_erp_attribute8,
930 p_erp_attribute9,
931 p_erp_attribute10,
932 p_erp_attribute11,
933 p_erp_attribute12,
934 p_erp_attribute13,
935 p_erp_attribute14,
936 p_erp_attribute15,
937 p_erp_attribute16,
938 p_erp_attribute17,
939 p_erp_attribute18,
940 p_erp_attribute19,
941 p_erp_attribute20,
942 p_erp_attribute21,
943 p_erp_attribute22,
944 p_erp_attribute23,
945 p_erp_attribute24,
946 p_erp_attribute25,
947 p_erp_attribute26,
948 p_erp_attribute27,
949 p_erp_attribute28,
950 p_erp_attribute29,
951 p_erp_attribute30,
952 p_object_version_number
953 );
954 --
955 -- Having converted the arguments into the
956 -- plsql record structure we call the corresponding record
957 -- business process.
958 --
959 upd(l_rec, p_effective_date, p_datetrack_mode);
960 p_object_version_number := l_rec.object_version_number;
961 p_effective_start_date := l_rec.effective_start_date;
962 p_effective_end_date := l_rec.effective_end_date;
963 --
964 --
965 hr_utility.set_location(' Leaving:'||l_proc, 10);
966 End upd;
967 --
968 end ben_erp_upd;