1 Package Body ben_pcd_upd as
2 /* $Header: bepcdrhi.pkb 115.9 2002/12/16 11:57:29 vsethi ship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- | Private Global Definitions |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package varchar2(33) := ' ben_pcd_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_pcd_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_per_cm_prvdd_f',
78 p_base_key_column => 'per_cm_prvdd_id',
79 p_base_key_value => p_rec.per_cm_prvdd_id);
80 --
81 ben_pcd_shd.g_api_dml := true; -- Set the api dml status
82 --
83 -- Update the ben_per_cm_prvdd_f Row
84 --
85 update ben_per_cm_prvdd_f
86 set
87 per_cm_prvdd_id = p_rec.per_cm_prvdd_id,
88 rqstd_flag = p_rec.rqstd_flag,
89 inspn_rqd_flag = p_rec.inspn_rqd_flag,
90 resnd_rsn_cd = p_rec.resnd_rsn_cd,
91 resnd_cmnt_txt = p_rec.resnd_cmnt_txt,
92 per_cm_prvdd_stat_cd = p_rec.per_cm_prvdd_stat_cd,
93 cm_dlvry_med_cd = p_rec.cm_dlvry_med_cd,
94 cm_dlvry_mthd_cd = p_rec.cm_dlvry_mthd_cd,
95 sent_dt = p_rec.sent_dt,
96 instnc_num = p_rec.instnc_num,
97 to_be_sent_dt = p_rec.to_be_sent_dt,
98 dlvry_instn_txt = p_rec.dlvry_instn_txt,
99 per_cm_id = p_rec.per_cm_id,
100 address_id = p_rec.address_id,
101 business_group_id = p_rec.business_group_id,
102 pcd_attribute_category = p_rec.pcd_attribute_category,
103 pcd_attribute1 = p_rec.pcd_attribute1,
104 pcd_attribute2 = p_rec.pcd_attribute2,
105 pcd_attribute3 = p_rec.pcd_attribute3,
106 pcd_attribute4 = p_rec.pcd_attribute4,
107 pcd_attribute5 = p_rec.pcd_attribute5,
108 pcd_attribute6 = p_rec.pcd_attribute6,
109 pcd_attribute7 = p_rec.pcd_attribute7,
110 pcd_attribute8 = p_rec.pcd_attribute8,
111 pcd_attribute9 = p_rec.pcd_attribute9,
112 pcd_attribute10 = p_rec.pcd_attribute10,
113 pcd_attribute11 = p_rec.pcd_attribute11,
114 pcd_attribute12 = p_rec.pcd_attribute12,
115 pcd_attribute13 = p_rec.pcd_attribute13,
116 pcd_attribute14 = p_rec.pcd_attribute14,
117 pcd_attribute15 = p_rec.pcd_attribute15,
118 pcd_attribute16 = p_rec.pcd_attribute16,
119 pcd_attribute17 = p_rec.pcd_attribute17,
120 pcd_attribute18 = p_rec.pcd_attribute18,
121 pcd_attribute19 = p_rec.pcd_attribute19,
122 pcd_attribute20 = p_rec.pcd_attribute20,
123 pcd_attribute21 = p_rec.pcd_attribute21,
124 pcd_attribute22 = p_rec.pcd_attribute22,
125 pcd_attribute23 = p_rec.pcd_attribute23,
126 pcd_attribute24 = p_rec.pcd_attribute24,
127 pcd_attribute25 = p_rec.pcd_attribute25,
128 pcd_attribute26 = p_rec.pcd_attribute26,
129 pcd_attribute27 = p_rec.pcd_attribute27,
130 pcd_attribute28 = p_rec.pcd_attribute28,
131 pcd_attribute29 = p_rec.pcd_attribute29,
132 pcd_attribute30 = p_rec.pcd_attribute30,
133 request_id = p_rec.request_id,
134 program_application_id = p_rec.program_application_id,
135 program_id = p_rec.program_id,
136 program_update_date = p_rec.program_update_date,
137 object_version_number = p_rec.object_version_number
138 where per_cm_prvdd_id = p_rec.per_cm_prvdd_id
139 and effective_start_date = p_validation_start_date
140 and effective_end_date = p_validation_end_date;
141 --
142 ben_pcd_shd.g_api_dml := false; -- Unset the api dml status
143 --
144 -- Set the effective start and end dates
145 --
146 p_rec.effective_start_date := p_validation_start_date;
147 p_rec.effective_end_date := p_validation_end_date;
148 End If;
149 --
150 hr_utility.set_location(' Leaving:'||l_proc, 15);
151 Exception
152 When hr_api.check_integrity_violated Then
153 -- A check constraint has been violated
154 ben_pcd_shd.g_api_dml := false; -- Unset the api dml status
155 ben_pcd_shd.constraint_error
156 (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
157 When hr_api.unique_integrity_violated Then
158 -- Unique integrity has been violated
159 ben_pcd_shd.g_api_dml := false; -- Unset the api dml status
160 ben_pcd_shd.constraint_error
161 (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
162 When Others Then
163 ben_pcd_shd.g_api_dml := false; -- Unset the api dml status
164 Raise;
165 End dt_update_dml;
166 --
167 -- ----------------------------------------------------------------------------
168 -- |------------------------------< update_dml >------------------------------|
169 -- ----------------------------------------------------------------------------
170 -- {Start Of Comments}
171 --
172 -- Description:
173 -- This procedure calls the dt_update_dml control logic which handles
174 -- the actual datetrack dml.
175 --
176 -- Prerequisites:
177 -- This is an internal private procedure which must be called from the upd
178 -- procedure.
179 --
180 -- In Parameters:
181 -- A Pl/Sql record structre.
182 --
183 -- Post Success:
184 -- Processing contines.
185 --
186 -- Post Failure:
187 -- No specific error handling is required within this procedure.
188 --
189 -- Developer Implementation Notes:
190 -- The update 'set' arguments list should be modified if any of your
191 -- attributes are not updateable.
192 --
193 -- Access Status:
194 -- Internal Row Handler Use Only.
195 --
196 -- {End Of Comments}
197 -- ----------------------------------------------------------------------------
198 Procedure update_dml
199 (p_rec in out nocopy ben_pcd_shd.g_rec_type,
200 p_effective_date in date,
201 p_datetrack_mode in varchar2,
202 p_validation_start_date in date,
203 p_validation_end_date in date) is
204 --
205 l_proc varchar2(72) := g_package||'update_dml';
206 --
207 Begin
208 hr_utility.set_location('Entering:'||l_proc, 5);
209 --
210 dt_update_dml(p_rec => p_rec,
211 p_effective_date => p_effective_date,
212 p_datetrack_mode => p_datetrack_mode,
213 p_validation_start_date => p_validation_start_date,
214 p_validation_end_date => p_validation_end_date);
215 --
216 hr_utility.set_location(' Leaving:'||l_proc, 10);
217 End update_dml;
218 --
219 -- ----------------------------------------------------------------------------
220 -- |----------------------------< dt_pre_update >-----------------------------|
221 -- ----------------------------------------------------------------------------
222 -- {Start Of Comments}
223 --
224 -- Description:
225 -- The dt_pre_update procedure controls the execution
226 -- of dml for the datetrack modes of: UPDATE, UPDATE_OVERRIDE
227 -- and UPDATE_CHANGE_INSERT only. The execution required is as
228 -- follows:
229 --
230 -- 1) Providing the datetrack update mode is not 'CORRECTION'
231 -- then set the effective end date of the current row (this
232 -- will be the validation_start_date - 1).
233 -- 2) If the datetrack mode is 'UPDATE_OVERRIDE' then call the
234 -- corresponding delete_dml process to delete any future rows
235 -- where the effective_start_date is greater than or equal to
236 -- the validation_start_date.
237 -- 3) Call the insert_dml process to insert the new updated row
238 -- details..
239 --
240 -- Prerequisites:
241 -- This is an internal procedure which is called from the
242 -- pre_update procedure.
243 --
244 -- In Parameters:
245 --
246 -- Post Success:
247 -- Processing continues.
248 --
249 -- Post Failure:
250 -- If an error has occurred, an error message and exception will be raised
251 -- but not handled.
252 --
253 -- Developer Implementation Notes:
254 -- This is an internal procedure which is required by Datetrack. Don't
255 -- remove or modify.
256 --
257 -- Access Status:
258 -- Internal Row Handler Use Only.
259 --
260 -- {End Of Comments}
261 -- ----------------------------------------------------------------------------
262 Procedure dt_pre_update
263 (p_rec in out nocopy ben_pcd_shd.g_rec_type,
264 p_effective_date in date,
265 p_datetrack_mode in varchar2,
266 p_validation_start_date in date,
267 p_validation_end_date in date) is
268 --
269 l_proc varchar2(72) := g_package||'dt_pre_update';
270 l_dummy_version_number number;
271 --
272 Begin
273 hr_utility.set_location('Entering:'||l_proc, 5);
274 If (p_datetrack_mode <> 'CORRECTION') then
275 hr_utility.set_location(l_proc, 10);
276 --
277 -- Update the current effective end date
278 --
279 ben_pcd_shd.upd_effective_end_date
280 (p_effective_date => p_effective_date,
281 p_base_key_value => p_rec.per_cm_prvdd_id,
282 p_new_effective_end_date => (p_validation_start_date - 1),
283 p_validation_start_date => p_validation_start_date,
284 p_validation_end_date => p_validation_end_date,
285 p_object_version_number => l_dummy_version_number);
286 --
287 If (p_datetrack_mode = 'UPDATE_OVERRIDE') then
288 hr_utility.set_location(l_proc, 15);
289 --
290 -- As the datetrack mode is 'UPDATE_OVERRIDE' then we must
291 -- delete any future rows
292 --
293 ben_pcd_del.delete_dml
294 (p_rec => p_rec,
295 p_effective_date => p_effective_date,
296 p_datetrack_mode => p_datetrack_mode,
297 p_validation_start_date => p_validation_start_date,
298 p_validation_end_date => p_validation_end_date);
299 End If;
300 hr_utility.set_location(l_proc, 20);
301 --
302 -- We must now insert the updated row
303 --
304 ben_pcd_ins.insert_dml
305 (p_rec => p_rec,
306 p_effective_date => p_effective_date,
307 p_datetrack_mode => p_datetrack_mode,
308 p_validation_start_date => p_validation_start_date,
309 p_validation_end_date => p_validation_end_date);
310 End If;
311 hr_utility.set_location(' Leaving:'||l_proc, 20);
312 End dt_pre_update;
313 --
314 -- ----------------------------------------------------------------------------
315 -- |------------------------------< pre_update >------------------------------|
316 -- ----------------------------------------------------------------------------
317 -- {Start Of Comments}
318 --
319 -- Description:
320 -- This private procedure contains any processing which is required before
321 -- the update dml.
322 --
323 -- Prerequisites:
324 -- This is an internal procedure which is called from the upd procedure.
325 --
326 -- In Parameters:
327 -- A Pl/Sql record structre.
328 --
329 -- Post Success:
330 -- Processing continues.
331 --
332 -- Post Failure:
333 -- If an error has occurred, an error message and exception will be raised
334 -- but not handled.
335 --
336 -- Developer Implementation Notes:
337 -- Any pre-processing required before the update dml is issued should be
338 -- coded within this procedure. It is important to note that any 3rd party
339 -- maintenance should be reviewed before placing in this procedure. The call
340 -- to the dt_update_dml procedure should NOT be removed.
341 --
342 -- Access Status:
343 -- Internal Row Handler Use Only.
344 --
345 -- {End Of Comments}
346 -- ----------------------------------------------------------------------------
347 Procedure pre_update
348 (p_rec in out nocopy ben_pcd_shd.g_rec_type,
349 p_effective_date in date,
350 p_datetrack_mode in varchar2,
351 p_validation_start_date in date,
352 p_validation_end_date in date) is
353 --
354 l_proc varchar2(72) := g_package||'pre_update';
355 --
356 Begin
357 hr_utility.set_location('Entering:'||l_proc, 5);
358 --
359 --
360 --
361 dt_pre_update
362 (p_rec => p_rec,
363 p_effective_date => p_effective_date,
364 p_datetrack_mode => p_datetrack_mode,
365 p_validation_start_date => p_validation_start_date,
366 p_validation_end_date => p_validation_end_date);
367 --
368 hr_utility.set_location(' Leaving:'||l_proc, 10);
369 End pre_update;
370 --
371 -- ----------------------------------------------------------------------------
372 -- |-----------------------------< post_update >------------------------------|
373 -- ----------------------------------------------------------------------------
374 -- {Start Of Comments}
375 --
376 -- Description:
377 -- This private procedure contains any processing which is required after the
378 -- update dml.
379 --
380 -- Prerequisites:
381 -- This is an internal procedure which is called from the upd procedure.
382 --
383 -- In Parameters:
384 -- A Pl/Sql record structre.
385 --
386 -- Post Success:
387 -- Processing continues.
388 --
389 -- Post Failure:
390 -- If an error has occurred, an error message and exception will be raised
391 -- but not handled.
392 --
393 -- Developer Implementation Notes:
394 -- Any post-processing required after the update dml is issued should be
395 -- coded within this procedure. It is important to note that any 3rd party
396 -- maintenance should be reviewed before placing in this procedure.
397 --
398 -- Access Status:
399 -- Internal Row Handler Use Only.
400 --
401 -- {End Of Comments}
402 -- ----------------------------------------------------------------------------
403 Procedure post_update
404 (p_rec in ben_pcd_shd.g_rec_type,
405 p_effective_date in date,
406 p_datetrack_mode in varchar2,
407 p_validation_start_date in date,
408 p_validation_end_date in date) is
409 --
410 l_proc varchar2(72) := g_package||'post_update';
411 --
412 Begin
413 hr_utility.set_location('Entering:'||l_proc, 5);
414 --
415 --
416 -- Start of API User Hook for post_update.
417 --
418 begin
419 --
420 ben_pcd_rku.after_update
421 (
422 p_per_cm_prvdd_id =>p_rec.per_cm_prvdd_id
423 ,p_effective_start_date =>p_rec.effective_start_date
424 ,p_effective_end_date =>p_rec.effective_end_date
425 ,p_rqstd_flag =>p_rec.rqstd_flag
426 ,p_inspn_rqd_flag =>p_rec.inspn_rqd_flag
427 ,p_resnd_rsn_cd =>p_rec.resnd_rsn_cd
428 ,p_resnd_cmnt_txt =>p_rec.resnd_cmnt_txt
429 ,p_per_cm_prvdd_stat_cd =>p_rec.per_cm_prvdd_stat_cd
430 ,p_cm_dlvry_med_cd =>p_rec.cm_dlvry_med_cd
431 ,p_cm_dlvry_mthd_cd =>p_rec.cm_dlvry_mthd_cd
432 ,p_sent_dt =>p_rec.sent_dt
433 ,p_instnc_num =>p_rec.instnc_num
434 ,p_to_be_sent_dt =>p_rec.to_be_sent_dt
435 ,p_dlvry_instn_txt =>p_rec.dlvry_instn_txt
436 ,p_per_cm_id =>p_rec.per_cm_id
437 ,p_address_id =>p_rec.address_id
438 ,p_business_group_id =>p_rec.business_group_id
439 ,p_pcd_attribute_category =>p_rec.pcd_attribute_category
440 ,p_pcd_attribute1 =>p_rec.pcd_attribute1
441 ,p_pcd_attribute2 =>p_rec.pcd_attribute2
442 ,p_pcd_attribute3 =>p_rec.pcd_attribute3
443 ,p_pcd_attribute4 =>p_rec.pcd_attribute4
444 ,p_pcd_attribute5 =>p_rec.pcd_attribute5
445 ,p_pcd_attribute6 =>p_rec.pcd_attribute6
446 ,p_pcd_attribute7 =>p_rec.pcd_attribute7
447 ,p_pcd_attribute8 =>p_rec.pcd_attribute8
448 ,p_pcd_attribute9 =>p_rec.pcd_attribute9
449 ,p_pcd_attribute10 =>p_rec.pcd_attribute10
450 ,p_pcd_attribute11 =>p_rec.pcd_attribute11
451 ,p_pcd_attribute12 =>p_rec.pcd_attribute12
452 ,p_pcd_attribute13 =>p_rec.pcd_attribute13
453 ,p_pcd_attribute14 =>p_rec.pcd_attribute14
454 ,p_pcd_attribute15 =>p_rec.pcd_attribute15
455 ,p_pcd_attribute16 =>p_rec.pcd_attribute16
456 ,p_pcd_attribute17 =>p_rec.pcd_attribute17
457 ,p_pcd_attribute18 =>p_rec.pcd_attribute18
458 ,p_pcd_attribute19 =>p_rec.pcd_attribute19
459 ,p_pcd_attribute20 =>p_rec.pcd_attribute20
460 ,p_pcd_attribute21 =>p_rec.pcd_attribute21
461 ,p_pcd_attribute22 =>p_rec.pcd_attribute22
462 ,p_pcd_attribute23 =>p_rec.pcd_attribute23
463 ,p_pcd_attribute24 =>p_rec.pcd_attribute24
464 ,p_pcd_attribute25 =>p_rec.pcd_attribute25
465 ,p_pcd_attribute26 =>p_rec.pcd_attribute26
466 ,p_pcd_attribute27 =>p_rec.pcd_attribute27
467 ,p_pcd_attribute28 =>p_rec.pcd_attribute28
468 ,p_pcd_attribute29 =>p_rec.pcd_attribute29
469 ,p_pcd_attribute30 =>p_rec.pcd_attribute30
470 ,p_request_id =>p_rec.request_id
471 ,p_program_application_id =>p_rec.program_application_id
472 ,p_program_id =>p_rec.program_id
473 ,p_program_update_date =>p_rec.program_update_date
474 ,p_object_version_number =>p_rec.object_version_number
475 ,p_effective_date =>p_effective_date
476 ,p_datetrack_mode =>p_datetrack_mode
477 ,p_validation_start_date =>p_validation_start_date
478 ,p_validation_end_date =>p_validation_end_date
479 ,p_effective_start_date_o =>ben_pcd_shd.g_old_rec.effective_start_date
480 ,p_effective_end_date_o =>ben_pcd_shd.g_old_rec.effective_end_date
481 ,p_rqstd_flag_o =>ben_pcd_shd.g_old_rec.rqstd_flag
482 ,p_inspn_rqd_flag_o =>ben_pcd_shd.g_old_rec.inspn_rqd_flag
483 ,p_resnd_rsn_cd_o =>ben_pcd_shd.g_old_rec.resnd_rsn_cd
484 ,p_resnd_cmnt_txt_o =>ben_pcd_shd.g_old_rec.resnd_cmnt_txt
485 ,p_per_cm_prvdd_stat_cd_o =>ben_pcd_shd.g_old_rec.per_cm_prvdd_stat_cd
486 ,p_cm_dlvry_med_cd_o =>ben_pcd_shd.g_old_rec.cm_dlvry_med_cd
487 ,p_cm_dlvry_mthd_cd_o =>ben_pcd_shd.g_old_rec.cm_dlvry_mthd_cd
488 ,p_sent_dt_o =>ben_pcd_shd.g_old_rec.sent_dt
489 ,p_instnc_num_o =>ben_pcd_shd.g_old_rec.instnc_num
490 ,p_to_be_sent_dt_o =>ben_pcd_shd.g_old_rec.to_be_sent_dt
491 ,p_dlvry_instn_txt_o =>ben_pcd_shd.g_old_rec.dlvry_instn_txt
492 ,p_per_cm_id_o =>ben_pcd_shd.g_old_rec.per_cm_id
493 ,p_address_id_o =>ben_pcd_shd.g_old_rec.address_id
494 ,p_business_group_id_o =>ben_pcd_shd.g_old_rec.business_group_id
495 ,p_pcd_attribute_category_o =>ben_pcd_shd.g_old_rec.pcd_attribute_category
496 ,p_pcd_attribute1_o =>ben_pcd_shd.g_old_rec.pcd_attribute1
497 ,p_pcd_attribute2_o =>ben_pcd_shd.g_old_rec.pcd_attribute2
498 ,p_pcd_attribute3_o =>ben_pcd_shd.g_old_rec.pcd_attribute3
499 ,p_pcd_attribute4_o =>ben_pcd_shd.g_old_rec.pcd_attribute4
500 ,p_pcd_attribute5_o =>ben_pcd_shd.g_old_rec.pcd_attribute5
501 ,p_pcd_attribute6_o =>ben_pcd_shd.g_old_rec.pcd_attribute6
502 ,p_pcd_attribute7_o =>ben_pcd_shd.g_old_rec.pcd_attribute7
503 ,p_pcd_attribute8_o =>ben_pcd_shd.g_old_rec.pcd_attribute8
504 ,p_pcd_attribute9_o =>ben_pcd_shd.g_old_rec.pcd_attribute9
505 ,p_pcd_attribute10_o =>ben_pcd_shd.g_old_rec.pcd_attribute10
506 ,p_pcd_attribute11_o =>ben_pcd_shd.g_old_rec.pcd_attribute11
507 ,p_pcd_attribute12_o =>ben_pcd_shd.g_old_rec.pcd_attribute12
508 ,p_pcd_attribute13_o =>ben_pcd_shd.g_old_rec.pcd_attribute13
509 ,p_pcd_attribute14_o =>ben_pcd_shd.g_old_rec.pcd_attribute14
510 ,p_pcd_attribute15_o =>ben_pcd_shd.g_old_rec.pcd_attribute15
511 ,p_pcd_attribute16_o =>ben_pcd_shd.g_old_rec.pcd_attribute16
512 ,p_pcd_attribute17_o =>ben_pcd_shd.g_old_rec.pcd_attribute17
513 ,p_pcd_attribute18_o =>ben_pcd_shd.g_old_rec.pcd_attribute18
514 ,p_pcd_attribute19_o =>ben_pcd_shd.g_old_rec.pcd_attribute19
515 ,p_pcd_attribute20_o =>ben_pcd_shd.g_old_rec.pcd_attribute20
516 ,p_pcd_attribute21_o =>ben_pcd_shd.g_old_rec.pcd_attribute21
517 ,p_pcd_attribute22_o =>ben_pcd_shd.g_old_rec.pcd_attribute22
518 ,p_pcd_attribute23_o =>ben_pcd_shd.g_old_rec.pcd_attribute23
519 ,p_pcd_attribute24_o =>ben_pcd_shd.g_old_rec.pcd_attribute24
520 ,p_pcd_attribute25_o =>ben_pcd_shd.g_old_rec.pcd_attribute25
521 ,p_pcd_attribute26_o =>ben_pcd_shd.g_old_rec.pcd_attribute26
522 ,p_pcd_attribute27_o =>ben_pcd_shd.g_old_rec.pcd_attribute27
523 ,p_pcd_attribute28_o =>ben_pcd_shd.g_old_rec.pcd_attribute28
524 ,p_pcd_attribute29_o =>ben_pcd_shd.g_old_rec.pcd_attribute29
525 ,p_pcd_attribute30_o =>ben_pcd_shd.g_old_rec.pcd_attribute30
526 ,p_request_id_o =>ben_pcd_shd.g_old_rec.request_id
527 ,p_program_application_id_o =>ben_pcd_shd.g_old_rec.program_application_id
528 ,p_program_id_o =>ben_pcd_shd.g_old_rec.program_id
529 ,p_program_update_date_o =>ben_pcd_shd.g_old_rec.program_update_date
530 ,p_object_version_number_o =>ben_pcd_shd.g_old_rec.object_version_number
531 );
532 --
533 exception
534 --
535 when hr_api.cannot_find_prog_unit then
536 --
537 hr_api.cannot_find_prog_unit_error
538 (p_module_name => 'ben_per_cm_prvdd_f'
539 ,p_hook_type => 'AU');
540 --
541 end;
542 --
543 -- End of API User Hook for post_update.
544 --
545 --
546 hr_utility.set_location(' Leaving:'||l_proc, 10);
547 End post_update;
548 --
549 -- ----------------------------------------------------------------------------
550 -- |-----------------------------< convert_defs >-----------------------------|
551 -- ----------------------------------------------------------------------------
552 -- {Start Of Comments}
553 --
554 -- Description:
555 -- The Convert_Defs procedure has one very important function:
556 -- It must return the record structure for the row with all system defaulted
557 -- values converted into its corresponding parameter value for update. When
558 -- we attempt to update a row through the Upd process , certain
559 -- parameters can be defaulted which enables flexibility in the calling of
560 -- the upd process (e.g. only attributes which need to be updated need to be
561 -- specified). For the upd process to determine which attributes
562 -- have NOT been specified we need to check if the parameter has a reserved
563 -- system default value. Therefore, for all parameters which have a
564 -- corresponding reserved system default mechanism specified we need to
565 -- check if a system default is being used. If a system default is being
566 -- used then we convert the defaulted value into its corresponding attribute
567 -- value held in the g_old_rec data structure.
568 --
569 -- Prerequisites:
570 -- This private function can only be called from the upd process.
571 --
572 -- In Parameters:
573 -- A Pl/Sql record structre.
574 --
575 -- Post Success:
576 -- The record structure will be returned with all system defaulted parameter
577 -- values converted into its current row attribute value.
578 --
579 -- Post Failure:
580 -- No direct error handling is required within this function. Any possible
581 -- errors within this procedure will be a PL/SQL value error due to conversion
582 -- of datatypes or data lengths.
583 --
584 -- Developer Implementation Notes:
585 -- None.
586 --
587 -- Access Status:
588 -- Internal Row Handler Use Only.
589 --
590 -- {End Of Comments}
591 -- ----------------------------------------------------------------------------
592 Procedure convert_defs(p_rec in out nocopy ben_pcd_shd.g_rec_type) is
593 --
594 l_proc varchar2(72) := g_package||'convert_defs';
595 --
596 Begin
597 --
598 hr_utility.set_location('Entering:'||l_proc, 5);
599 --
600 -- We must now examine each argument value in the
601 -- p_rec plsql record structure
602 -- to see if a system default is being used. If a system default
603 -- is being used then we must set to the 'current' argument value.
604 --
605 If (p_rec.rqstd_flag = hr_api.g_varchar2) then
606 p_rec.rqstd_flag :=
607 ben_pcd_shd.g_old_rec.rqstd_flag;
608 End If;
609 If (p_rec.inspn_rqd_flag = hr_api.g_varchar2) then
610 p_rec.inspn_rqd_flag :=
611 ben_pcd_shd.g_old_rec.inspn_rqd_flag;
612 End If;
613 If (p_rec.resnd_rsn_cd = hr_api.g_varchar2) then
614 p_rec.resnd_rsn_cd :=
615 ben_pcd_shd.g_old_rec.resnd_rsn_cd;
616 End If;
617 If (p_rec.resnd_cmnt_txt = hr_api.g_varchar2) then
618 p_rec.resnd_cmnt_txt :=
619 ben_pcd_shd.g_old_rec.resnd_cmnt_txt;
620 End If;
621 If (p_rec.per_cm_prvdd_stat_cd = hr_api.g_varchar2) then
622 p_rec.per_cm_prvdd_stat_cd :=
623 ben_pcd_shd.g_old_rec.per_cm_prvdd_stat_cd;
624 End If;
625 If (p_rec.cm_dlvry_med_cd = hr_api.g_varchar2) then
626 p_rec.cm_dlvry_med_cd :=
627 ben_pcd_shd.g_old_rec.cm_dlvry_med_cd;
628 End If;
629 If (p_rec.cm_dlvry_mthd_cd = hr_api.g_varchar2) then
630 p_rec.cm_dlvry_mthd_cd :=
631 ben_pcd_shd.g_old_rec.cm_dlvry_mthd_cd;
632 End If;
633 If (p_rec.sent_dt = hr_api.g_date) then
634 p_rec.sent_dt :=
635 ben_pcd_shd.g_old_rec.sent_dt;
636 End If;
637 If (p_rec.instnc_num = hr_api.g_number) then
638 p_rec.instnc_num :=
639 ben_pcd_shd.g_old_rec.instnc_num;
640 End If;
641 If (p_rec.to_be_sent_dt = hr_api.g_date) then
642 p_rec.to_be_sent_dt :=
643 ben_pcd_shd.g_old_rec.to_be_sent_dt;
644 End If;
645 If (p_rec.dlvry_instn_txt = hr_api.g_varchar2) then
646 p_rec.dlvry_instn_txt :=
647 ben_pcd_shd.g_old_rec.dlvry_instn_txt;
648 End If;
649 If (p_rec.per_cm_id = hr_api.g_number) then
650 p_rec.per_cm_id :=
651 ben_pcd_shd.g_old_rec.per_cm_id;
652 End If;
653 If (p_rec.address_id = hr_api.g_number) then
654 p_rec.address_id :=
655 ben_pcd_shd.g_old_rec.address_id;
656 End If;
657 If (p_rec.business_group_id = hr_api.g_number) then
658 p_rec.business_group_id :=
659 ben_pcd_shd.g_old_rec.business_group_id;
660 End If;
661 If (p_rec.pcd_attribute_category = hr_api.g_varchar2) then
662 p_rec.pcd_attribute_category :=
663 ben_pcd_shd.g_old_rec.pcd_attribute_category;
664 End If;
665 If (p_rec.pcd_attribute1 = hr_api.g_varchar2) then
666 p_rec.pcd_attribute1 :=
667 ben_pcd_shd.g_old_rec.pcd_attribute1;
668 End If;
669 If (p_rec.pcd_attribute2 = hr_api.g_varchar2) then
670 p_rec.pcd_attribute2 :=
671 ben_pcd_shd.g_old_rec.pcd_attribute2;
672 End If;
673 If (p_rec.pcd_attribute3 = hr_api.g_varchar2) then
674 p_rec.pcd_attribute3 :=
675 ben_pcd_shd.g_old_rec.pcd_attribute3;
676 End If;
677 If (p_rec.pcd_attribute4 = hr_api.g_varchar2) then
678 p_rec.pcd_attribute4 :=
679 ben_pcd_shd.g_old_rec.pcd_attribute4;
680 End If;
681 If (p_rec.pcd_attribute5 = hr_api.g_varchar2) then
682 p_rec.pcd_attribute5 :=
683 ben_pcd_shd.g_old_rec.pcd_attribute5;
684 End If;
685 If (p_rec.pcd_attribute6 = hr_api.g_varchar2) then
686 p_rec.pcd_attribute6 :=
687 ben_pcd_shd.g_old_rec.pcd_attribute6;
688 End If;
689 If (p_rec.pcd_attribute7 = hr_api.g_varchar2) then
690 p_rec.pcd_attribute7 :=
691 ben_pcd_shd.g_old_rec.pcd_attribute7;
692 End If;
693 If (p_rec.pcd_attribute8 = hr_api.g_varchar2) then
694 p_rec.pcd_attribute8 :=
695 ben_pcd_shd.g_old_rec.pcd_attribute8;
696 End If;
697 If (p_rec.pcd_attribute9 = hr_api.g_varchar2) then
698 p_rec.pcd_attribute9 :=
699 ben_pcd_shd.g_old_rec.pcd_attribute9;
700 End If;
701 If (p_rec.pcd_attribute10 = hr_api.g_varchar2) then
702 p_rec.pcd_attribute10 :=
703 ben_pcd_shd.g_old_rec.pcd_attribute10;
704 End If;
705 If (p_rec.pcd_attribute11 = hr_api.g_varchar2) then
706 p_rec.pcd_attribute11 :=
707 ben_pcd_shd.g_old_rec.pcd_attribute11;
708 End If;
709 If (p_rec.pcd_attribute12 = hr_api.g_varchar2) then
710 p_rec.pcd_attribute12 :=
711 ben_pcd_shd.g_old_rec.pcd_attribute12;
712 End If;
713 If (p_rec.pcd_attribute13 = hr_api.g_varchar2) then
714 p_rec.pcd_attribute13 :=
715 ben_pcd_shd.g_old_rec.pcd_attribute13;
716 End If;
717 If (p_rec.pcd_attribute14 = hr_api.g_varchar2) then
718 p_rec.pcd_attribute14 :=
719 ben_pcd_shd.g_old_rec.pcd_attribute14;
720 End If;
721 If (p_rec.pcd_attribute15 = hr_api.g_varchar2) then
722 p_rec.pcd_attribute15 :=
723 ben_pcd_shd.g_old_rec.pcd_attribute15;
724 End If;
725 If (p_rec.pcd_attribute16 = hr_api.g_varchar2) then
726 p_rec.pcd_attribute16 :=
727 ben_pcd_shd.g_old_rec.pcd_attribute16;
728 End If;
729 If (p_rec.pcd_attribute17 = hr_api.g_varchar2) then
730 p_rec.pcd_attribute17 :=
731 ben_pcd_shd.g_old_rec.pcd_attribute17;
732 End If;
733 If (p_rec.pcd_attribute18 = hr_api.g_varchar2) then
734 p_rec.pcd_attribute18 :=
735 ben_pcd_shd.g_old_rec.pcd_attribute18;
736 End If;
737 If (p_rec.pcd_attribute19 = hr_api.g_varchar2) then
738 p_rec.pcd_attribute19 :=
739 ben_pcd_shd.g_old_rec.pcd_attribute19;
740 End If;
741 If (p_rec.pcd_attribute20 = hr_api.g_varchar2) then
742 p_rec.pcd_attribute20 :=
743 ben_pcd_shd.g_old_rec.pcd_attribute20;
744 End If;
745 If (p_rec.pcd_attribute21 = hr_api.g_varchar2) then
746 p_rec.pcd_attribute21 :=
747 ben_pcd_shd.g_old_rec.pcd_attribute21;
748 End If;
749 If (p_rec.pcd_attribute22 = hr_api.g_varchar2) then
750 p_rec.pcd_attribute22 :=
751 ben_pcd_shd.g_old_rec.pcd_attribute22;
752 End If;
753 If (p_rec.pcd_attribute23 = hr_api.g_varchar2) then
754 p_rec.pcd_attribute23 :=
755 ben_pcd_shd.g_old_rec.pcd_attribute23;
756 End If;
757 If (p_rec.pcd_attribute24 = hr_api.g_varchar2) then
758 p_rec.pcd_attribute24 :=
759 ben_pcd_shd.g_old_rec.pcd_attribute24;
760 End If;
761 If (p_rec.pcd_attribute25 = hr_api.g_varchar2) then
762 p_rec.pcd_attribute25 :=
763 ben_pcd_shd.g_old_rec.pcd_attribute25;
764 End If;
765 If (p_rec.pcd_attribute26 = hr_api.g_varchar2) then
766 p_rec.pcd_attribute26 :=
767 ben_pcd_shd.g_old_rec.pcd_attribute26;
768 End If;
769 If (p_rec.pcd_attribute27 = hr_api.g_varchar2) then
770 p_rec.pcd_attribute27 :=
771 ben_pcd_shd.g_old_rec.pcd_attribute27;
772 End If;
773 If (p_rec.pcd_attribute28 = hr_api.g_varchar2) then
774 p_rec.pcd_attribute28 :=
775 ben_pcd_shd.g_old_rec.pcd_attribute28;
776 End If;
777 If (p_rec.pcd_attribute29 = hr_api.g_varchar2) then
778 p_rec.pcd_attribute29 :=
779 ben_pcd_shd.g_old_rec.pcd_attribute29;
780 End If;
781 If (p_rec.pcd_attribute30 = hr_api.g_varchar2) then
782 p_rec.pcd_attribute30 :=
783 ben_pcd_shd.g_old_rec.pcd_attribute30;
784 End If;
785 If (p_rec.request_id = hr_api.g_number) then
786 p_rec.request_id :=
787 ben_pcd_shd.g_old_rec.request_id;
788 End If;
789 If (p_rec.program_application_id = hr_api.g_number) then
790 p_rec.program_application_id :=
791 ben_pcd_shd.g_old_rec.program_application_id;
792 End If;
793 If (p_rec.program_id = hr_api.g_number) then
794 p_rec.program_id :=
795 ben_pcd_shd.g_old_rec.program_id;
796 End If;
797 If (p_rec.program_update_date = hr_api.g_date) then
798 p_rec.program_update_date :=
799 ben_pcd_shd.g_old_rec.program_update_date;
800 End If;
801 --
802 hr_utility.set_location(' Leaving:'||l_proc, 10);
803 --
804 End convert_defs;
805 --
806 -- ----------------------------------------------------------------------------
807 -- |---------------------------------< upd >----------------------------------|
808 -- ----------------------------------------------------------------------------
809 Procedure upd
810 (
811 p_rec in out nocopy ben_pcd_shd.g_rec_type,
812 p_effective_date in date,
813 p_datetrack_mode in varchar2
814 ) is
815 --
816 l_proc varchar2(72) := g_package||'upd';
817 l_validation_start_date date;
818 l_validation_end_date date;
819 --
820 Begin
821 hr_utility.set_location('Entering:'||l_proc, 5);
822 --
823 -- Ensure that the DateTrack update mode is valid
824 --
825 dt_api.validate_dt_upd_mode(p_datetrack_mode => p_datetrack_mode);
826 --
827 -- We must lock the row which we need to update.
828 --
829 ben_pcd_shd.lck
830 (p_effective_date => p_effective_date,
831 p_datetrack_mode => p_datetrack_mode,
832 p_per_cm_prvdd_id => p_rec.per_cm_prvdd_id,
833 p_object_version_number => p_rec.object_version_number,
834 p_validation_start_date => l_validation_start_date,
835 p_validation_end_date => l_validation_end_date);
836 --
837 -- 1. During an update system defaults are used to determine if
838 -- arguments have been defaulted or not. We must therefore
839 -- derive the full record structure values to be updated.
840 --
841 -- 2. Call the supporting update validate operations.
842 --
843 convert_defs(p_rec);
844 ben_pcd_bus.update_validate
845 (p_rec => p_rec,
846 p_effective_date => p_effective_date,
847 p_datetrack_mode => p_datetrack_mode,
848 p_validation_start_date => l_validation_start_date,
849 p_validation_end_date => l_validation_end_date);
850 --
851 -- Call the supporting pre-update operation
852 --
853 pre_update
854 (p_rec => p_rec,
855 p_effective_date => p_effective_date,
856 p_datetrack_mode => p_datetrack_mode,
857 p_validation_start_date => l_validation_start_date,
858 p_validation_end_date => l_validation_end_date);
859 --
860 -- Update the row.
861 --
862 update_dml
863 (p_rec => p_rec,
864 p_effective_date => p_effective_date,
865 p_datetrack_mode => p_datetrack_mode,
866 p_validation_start_date => l_validation_start_date,
867 p_validation_end_date => l_validation_end_date);
868 --
869 -- Call the supporting post-update operation
870 --
871 post_update
872 (p_rec => p_rec,
873 p_effective_date => p_effective_date,
874 p_datetrack_mode => p_datetrack_mode,
875 p_validation_start_date => l_validation_start_date,
876 p_validation_end_date => l_validation_end_date);
877 End upd;
878 --
879 -- ----------------------------------------------------------------------------
880 -- |---------------------------------< upd >----------------------------------|
881 -- ----------------------------------------------------------------------------
882 Procedure upd
883 (
884 p_per_cm_prvdd_id in number,
885 p_effective_start_date out nocopy date,
886 p_effective_end_date out nocopy date,
887 p_rqstd_flag in varchar2 default hr_api.g_varchar2,
888 p_per_cm_prvdd_stat_cd in varchar2 default hr_api.g_varchar2,
889 p_cm_dlvry_med_cd in varchar2 default hr_api.g_varchar2,
890 p_cm_dlvry_mthd_cd in varchar2 default hr_api.g_varchar2,
891 p_sent_dt in date default hr_api.g_date,
892 p_instnc_num in number default hr_api.g_number,
893 p_to_be_sent_dt in date default hr_api.g_date,
894 p_dlvry_instn_txt in varchar2 default hr_api.g_varchar2,
895 p_inspn_rqd_flag in varchar2 default hr_api.g_varchar2,
896 p_resnd_rsn_cd in varchar2 default hr_api.g_varchar2,
897 p_resnd_cmnt_txt in varchar2 default hr_api.g_varchar2,
898 p_per_cm_id in number default hr_api.g_number,
899 p_address_id in number default hr_api.g_number,
900 p_business_group_id in number default hr_api.g_number,
901 p_pcd_attribute_category in varchar2 default hr_api.g_varchar2,
902 p_pcd_attribute1 in varchar2 default hr_api.g_varchar2,
903 p_pcd_attribute2 in varchar2 default hr_api.g_varchar2,
904 p_pcd_attribute3 in varchar2 default hr_api.g_varchar2,
905 p_pcd_attribute4 in varchar2 default hr_api.g_varchar2,
906 p_pcd_attribute5 in varchar2 default hr_api.g_varchar2,
907 p_pcd_attribute6 in varchar2 default hr_api.g_varchar2,
908 p_pcd_attribute7 in varchar2 default hr_api.g_varchar2,
909 p_pcd_attribute8 in varchar2 default hr_api.g_varchar2,
910 p_pcd_attribute9 in varchar2 default hr_api.g_varchar2,
911 p_pcd_attribute10 in varchar2 default hr_api.g_varchar2,
912 p_pcd_attribute11 in varchar2 default hr_api.g_varchar2,
913 p_pcd_attribute12 in varchar2 default hr_api.g_varchar2,
914 p_pcd_attribute13 in varchar2 default hr_api.g_varchar2,
915 p_pcd_attribute14 in varchar2 default hr_api.g_varchar2,
916 p_pcd_attribute15 in varchar2 default hr_api.g_varchar2,
917 p_pcd_attribute16 in varchar2 default hr_api.g_varchar2,
918 p_pcd_attribute17 in varchar2 default hr_api.g_varchar2,
919 p_pcd_attribute18 in varchar2 default hr_api.g_varchar2,
920 p_pcd_attribute19 in varchar2 default hr_api.g_varchar2,
921 p_pcd_attribute20 in varchar2 default hr_api.g_varchar2,
922 p_pcd_attribute21 in varchar2 default hr_api.g_varchar2,
923 p_pcd_attribute22 in varchar2 default hr_api.g_varchar2,
924 p_pcd_attribute23 in varchar2 default hr_api.g_varchar2,
925 p_pcd_attribute24 in varchar2 default hr_api.g_varchar2,
926 p_pcd_attribute25 in varchar2 default hr_api.g_varchar2,
927 p_pcd_attribute26 in varchar2 default hr_api.g_varchar2,
928 p_pcd_attribute27 in varchar2 default hr_api.g_varchar2,
929 p_pcd_attribute28 in varchar2 default hr_api.g_varchar2,
930 p_pcd_attribute29 in varchar2 default hr_api.g_varchar2,
931 p_pcd_attribute30 in varchar2 default hr_api.g_varchar2,
932 p_request_id in number default hr_api.g_number,
933 p_program_application_id in number default hr_api.g_number,
934 p_program_id in number default hr_api.g_number,
935 p_program_update_date in date default hr_api.g_date,
936 p_object_version_number in out nocopy number,
937 p_effective_date in date,
938 p_datetrack_mode in varchar2
939 ) is
940 --
941 l_rec ben_pcd_shd.g_rec_type;
942 l_proc varchar2(72) := g_package||'upd';
943 --
944 Begin
945 hr_utility.set_location('Entering:'||l_proc, 5);
946 --
947 -- Call conversion function to turn arguments into the
948 -- l_rec structure.
949 --
950 l_rec :=
951 ben_pcd_shd.convert_args
952 (
953 p_per_cm_prvdd_id,
954 null,
955 null,
956 p_rqstd_flag,
957 p_per_cm_prvdd_stat_cd,
958 p_cm_dlvry_med_cd,
959 p_cm_dlvry_mthd_cd,
960 p_sent_dt,
961 p_instnc_num,
962 p_to_be_sent_dt,
963 p_dlvry_instn_txt,
964 p_inspn_rqd_flag,
965 p_resnd_rsn_cd,
966 p_resnd_cmnt_txt,
967 p_per_cm_id,
968 p_address_id,
969 p_business_group_id,
970 p_pcd_attribute_category,
971 p_pcd_attribute1,
972 p_pcd_attribute2,
973 p_pcd_attribute3,
974 p_pcd_attribute4,
975 p_pcd_attribute5,
976 p_pcd_attribute6,
977 p_pcd_attribute7,
978 p_pcd_attribute8,
979 p_pcd_attribute9,
980 p_pcd_attribute10,
981 p_pcd_attribute11,
982 p_pcd_attribute12,
983 p_pcd_attribute13,
984 p_pcd_attribute14,
985 p_pcd_attribute15,
986 p_pcd_attribute16,
987 p_pcd_attribute17,
988 p_pcd_attribute18,
989 p_pcd_attribute19,
990 p_pcd_attribute20,
991 p_pcd_attribute21,
992 p_pcd_attribute22,
993 p_pcd_attribute23,
994 p_pcd_attribute24,
995 p_pcd_attribute25,
996 p_pcd_attribute26,
997 p_pcd_attribute27,
998 p_pcd_attribute28,
999 p_pcd_attribute29,
1000 p_pcd_attribute30,
1001 p_request_id,
1002 p_program_application_id,
1003 p_program_id,
1004 p_program_update_date,
1005 p_object_version_number
1006 );
1007 --
1008 -- Having converted the arguments into the
1009 -- plsql record structure we call the corresponding record
1010 -- business process.
1011 --
1012 upd(l_rec, p_effective_date, p_datetrack_mode);
1013 p_object_version_number := l_rec.object_version_number;
1014 p_effective_start_date := l_rec.effective_start_date;
1015 p_effective_end_date := l_rec.effective_end_date;
1016 --
1017 --
1018 hr_utility.set_location(' Leaving:'||l_proc, 10);
1019 End upd;
1020 --
1021 end ben_pcd_upd;