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