1 Package Body ben_cpr_upd as
2 /* $Header: becprrhi.pkb 115.12 2002/12/13 06:21:26 hmani ship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- | Private Global Definitions |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package varchar2(33) := ' ben_cpr_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_cpr_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_popl_org_role_f',
78 p_base_key_column => 'popl_org_role_id',
79 p_base_key_value => p_rec.popl_org_role_id);
80 --
81 ben_cpr_shd.g_api_dml := true; -- Set the api dml status
82 --
83 -- Update the ben_popl_org_role_f Row
84 --
85 update ben_popl_org_role_f
86 set
87 popl_org_role_id = p_rec.popl_org_role_id,
88 name = p_rec.name,
89 org_role_typ_cd = p_rec.org_role_typ_cd,
90 popl_org_id = p_rec.popl_org_id,
91 business_group_id = p_rec.business_group_id,
92 cpr_attribute_category = p_rec.cpr_attribute_category,
93 cpr_attribute1 = p_rec.cpr_attribute1,
94 cpr_attribute2 = p_rec.cpr_attribute2,
95 cpr_attribute3 = p_rec.cpr_attribute3,
96 cpr_attribute4 = p_rec.cpr_attribute4,
97 cpr_attribute5 = p_rec.cpr_attribute5,
98 cpr_attribute6 = p_rec.cpr_attribute6,
99 cpr_attribute7 = p_rec.cpr_attribute7,
100 cpr_attribute8 = p_rec.cpr_attribute8,
101 cpr_attribute9 = p_rec.cpr_attribute9,
102 cpr_attribute10 = p_rec.cpr_attribute10,
103 cpr_attribute11 = p_rec.cpr_attribute11,
104 cpr_attribute12 = p_rec.cpr_attribute12,
105 cpr_attribute13 = p_rec.cpr_attribute13,
106 cpr_attribute14 = p_rec.cpr_attribute14,
107 cpr_attribute15 = p_rec.cpr_attribute15,
108 cpr_attribute16 = p_rec.cpr_attribute16,
109 cpr_attribute17 = p_rec.cpr_attribute17,
110 cpr_attribute18 = p_rec.cpr_attribute18,
111 cpr_attribute19 = p_rec.cpr_attribute19,
112 cpr_attribute20 = p_rec.cpr_attribute20,
113 cpr_attribute21 = p_rec.cpr_attribute21,
114 cpr_attribute22 = p_rec.cpr_attribute22,
115 cpr_attribute23 = p_rec.cpr_attribute23,
116 cpr_attribute24 = p_rec.cpr_attribute24,
117 cpr_attribute25 = p_rec.cpr_attribute25,
118 cpr_attribute26 = p_rec.cpr_attribute26,
119 cpr_attribute27 = p_rec.cpr_attribute27,
120 cpr_attribute28 = p_rec.cpr_attribute28,
121 cpr_attribute29 = p_rec.cpr_attribute29,
122 cpr_attribute30 = p_rec.cpr_attribute30,
123 object_version_number = p_rec.object_version_number
124 where popl_org_role_id = p_rec.popl_org_role_id
125 and effective_start_date = p_validation_start_date
126 and effective_end_date = p_validation_end_date;
127 --
128 ben_cpr_shd.g_api_dml := false; -- Unset the api dml status
129 --
130 -- Set the effective start and end dates
131 --
132 p_rec.effective_start_date := p_validation_start_date;
133 p_rec.effective_end_date := p_validation_end_date;
134 End If;
135 --
136 hr_utility.set_location(' Leaving:'||l_proc, 15);
137 Exception
138 When hr_api.check_integrity_violated Then
139 -- A check constraint has been violated
140 ben_cpr_shd.g_api_dml := false; -- Unset the api dml status
141 ben_cpr_shd.constraint_error
142 (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
143 When hr_api.unique_integrity_violated Then
144 -- Unique integrity has been violated
145 ben_cpr_shd.g_api_dml := false; -- Unset the api dml status
146 ben_cpr_shd.constraint_error
147 (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
148 When Others Then
149 ben_cpr_shd.g_api_dml := false; -- Unset the api dml status
150 Raise;
151 End dt_update_dml;
152 --
153 -- ----------------------------------------------------------------------------
154 -- |------------------------------< update_dml >------------------------------|
155 -- ----------------------------------------------------------------------------
156 -- {Start Of Comments}
157 --
158 -- Description:
159 -- This procedure calls the dt_update_dml control logic which handles
160 -- the actual datetrack dml.
161 --
162 -- Prerequisites:
163 -- This is an internal private procedure which must be called from the upd
164 -- procedure.
165 --
166 -- In Parameters:
167 -- A Pl/Sql record structre.
168 --
169 -- Post Success:
170 -- Processing contines.
171 --
172 -- Post Failure:
173 -- No specific error handling is required within this procedure.
174 --
175 -- Developer Implementation Notes:
176 -- The update 'set' arguments list should be modified if any of your
177 -- attributes are not updateable.
178 --
179 -- Access Status:
180 -- Internal Row Handler Use Only.
181 --
182 -- {End Of Comments}
183 -- ----------------------------------------------------------------------------
184 Procedure update_dml
185 (p_rec in out nocopy ben_cpr_shd.g_rec_type,
186 p_effective_date in date,
187 p_datetrack_mode in varchar2,
188 p_validation_start_date in date,
189 p_validation_end_date in date) is
190 --
191 l_proc varchar2(72) := g_package||'update_dml';
192 --
193 Begin
194 hr_utility.set_location('Entering:'||l_proc, 5);
195 --
196 dt_update_dml(p_rec => p_rec,
197 p_effective_date => p_effective_date,
198 p_datetrack_mode => p_datetrack_mode,
199 p_validation_start_date => p_validation_start_date,
200 p_validation_end_date => p_validation_end_date);
201 --
202 hr_utility.set_location(' Leaving:'||l_proc, 10);
203 End update_dml;
204 --
205 -- ----------------------------------------------------------------------------
206 -- |----------------------------< dt_pre_update >-----------------------------|
207 -- ----------------------------------------------------------------------------
208 -- {Start Of Comments}
209 --
210 -- Description:
211 -- The dt_pre_update procedure controls the execution
212 -- of dml for the datetrack modes of: UPDATE, UPDATE_OVERRIDE
213 -- and UPDATE_CHANGE_INSERT only. The execution required is as
214 -- follows:
215 --
216 -- 1) Providing the datetrack update mode is not 'CORRECTION'
217 -- then set the effective end date of the current row (this
218 -- will be the validation_start_date - 1).
219 -- 2) If the datetrack mode is 'UPDATE_OVERRIDE' then call the
220 -- corresponding delete_dml process to delete any future rows
221 -- where the effective_start_date is greater than or equal to
222 -- the validation_start_date.
223 -- 3) Call the insert_dml process to insert the new updated row
224 -- details..
225 --
226 -- Prerequisites:
227 -- This is an internal procedure which is called from the
228 -- pre_update procedure.
229 --
230 -- In Parameters:
231 --
232 -- Post Success:
233 -- Processing continues.
234 --
235 -- Post Failure:
236 -- If an error has occurred, an error message and exception will be raised
237 -- but not handled.
238 --
239 -- Developer Implementation Notes:
240 -- This is an internal procedure which is required by Datetrack. Don't
241 -- remove or modify.
242 --
243 -- Access Status:
244 -- Internal Row Handler Use Only.
245 --
246 -- {End Of Comments}
247 -- ----------------------------------------------------------------------------
248 Procedure dt_pre_update
249 (p_rec in out nocopy ben_cpr_shd.g_rec_type,
250 p_effective_date in date,
251 p_datetrack_mode in varchar2,
252 p_validation_start_date in date,
253 p_validation_end_date in date) is
254 --
255 l_proc varchar2(72) := g_package||'dt_pre_update';
256 l_dummy_version_number number;
257 --
258 Begin
259 hr_utility.set_location('Entering:'||l_proc, 5);
260 If (p_datetrack_mode <> 'CORRECTION') then
261 hr_utility.set_location(l_proc, 10);
262 --
263 -- Update the current effective end date
264 --
265 ben_cpr_shd.upd_effective_end_date
266 (p_effective_date => p_effective_date,
267 p_base_key_value => p_rec.popl_org_role_id,
268 p_new_effective_end_date => (p_validation_start_date - 1),
269 p_validation_start_date => p_validation_start_date,
270 p_validation_end_date => p_validation_end_date,
271 p_object_version_number => l_dummy_version_number);
272 --
273 If (p_datetrack_mode = 'UPDATE_OVERRIDE') then
274 hr_utility.set_location(l_proc, 15);
275 --
276 -- As the datetrack mode is 'UPDATE_OVERRIDE' then we must
277 -- delete any future rows
278 --
279 ben_cpr_del.delete_dml
280 (p_rec => p_rec,
281 p_effective_date => p_effective_date,
282 p_datetrack_mode => p_datetrack_mode,
283 p_validation_start_date => p_validation_start_date,
284 p_validation_end_date => p_validation_end_date);
285 End If;
286 hr_utility.set_location(l_proc, 20);
287 --
288 -- We must now insert the updated row
289 --
290 ben_cpr_ins.insert_dml
291 (p_rec => p_rec,
292 p_effective_date => p_effective_date,
293 p_datetrack_mode => p_datetrack_mode,
294 p_validation_start_date => p_validation_start_date,
295 p_validation_end_date => p_validation_end_date);
296 End If;
297 hr_utility.set_location(' Leaving:'||l_proc, 20);
298 End dt_pre_update;
299 --
300 -- ----------------------------------------------------------------------------
301 -- |------------------------------< pre_update >------------------------------|
302 -- ----------------------------------------------------------------------------
303 -- {Start Of Comments}
304 --
305 -- Description:
306 -- This private procedure contains any processing which is required before
307 -- the update dml.
308 --
309 -- Prerequisites:
310 -- This is an internal procedure which is called from the upd procedure.
311 --
312 -- In Parameters:
313 -- A Pl/Sql record structre.
314 --
315 -- Post Success:
316 -- Processing continues.
317 --
318 -- Post Failure:
319 -- If an error has occurred, an error message and exception will be raised
320 -- but not handled.
321 --
322 -- Developer Implementation Notes:
323 -- Any pre-processing required before the update dml is issued should be
324 -- coded within this procedure. It is important to note that any 3rd party
325 -- maintenance should be reviewed before placing in this procedure. The call
326 -- to the dt_update_dml procedure should NOT be removed.
327 --
328 -- Access Status:
329 -- Internal Row Handler Use Only.
330 --
331 -- {End Of Comments}
332 -- ----------------------------------------------------------------------------
333 Procedure pre_update
334 (p_rec in out nocopy ben_cpr_shd.g_rec_type,
335 p_effective_date in date,
336 p_datetrack_mode in varchar2,
337 p_validation_start_date in date,
338 p_validation_end_date in date) is
339 --
340 l_proc varchar2(72) := g_package||'pre_update';
341 --
342 Begin
343 hr_utility.set_location('Entering:'||l_proc, 5);
344 --
345 --
346 --
347 dt_pre_update
348 (p_rec => p_rec,
349 p_effective_date => p_effective_date,
350 p_datetrack_mode => p_datetrack_mode,
351 p_validation_start_date => p_validation_start_date,
352 p_validation_end_date => p_validation_end_date);
353 --
354 hr_utility.set_location(' Leaving:'||l_proc, 10);
355 End pre_update;
356 --
357 -- ----------------------------------------------------------------------------
358 -- |-----------------------------< post_update >------------------------------|
359 -- ----------------------------------------------------------------------------
360 -- {Start Of Comments}
361 --
362 -- Description:
363 -- This private procedure contains any processing which is required after the
364 -- update dml.
365 --
366 -- Prerequisites:
367 -- This is an internal procedure which is called from the upd procedure.
368 --
369 -- In Parameters:
370 -- A Pl/Sql record structre.
371 --
372 -- Post Success:
373 -- Processing continues.
374 --
375 -- Post Failure:
376 -- If an error has occurred, an error message and exception will be raised
377 -- but not handled.
378 --
379 -- Developer Implementation Notes:
380 -- Any post-processing required after the update dml is issued should be
381 -- coded within this procedure. It is important to note that any 3rd party
382 -- maintenance should be reviewed before placing in this procedure.
383 --
384 -- Access Status:
385 -- Internal Row Handler Use Only.
386 --
387 -- {End Of Comments}
388 -- ----------------------------------------------------------------------------
389 Procedure post_update
390 (p_rec in ben_cpr_shd.g_rec_type,
391 p_effective_date in date,
392 p_datetrack_mode in varchar2,
393 p_validation_start_date in date,
394 p_validation_end_date in date) is
395 --
396 l_proc varchar2(72) := g_package||'post_update';
397 --
398 Begin
399 hr_utility.set_location('Entering:'||l_proc, 5);
400 --
401 --
402 -- Start of API User Hook for post_update.
403 --
404 begin
405 --
406 ben_cpr_rku.after_update
407 (
408 p_popl_org_role_id =>p_rec.popl_org_role_id
409 ,p_effective_start_date =>p_rec.effective_start_date
410 ,p_effective_end_date =>p_rec.effective_end_date
411 ,p_name =>p_rec.name
412 ,p_org_role_typ_cd =>p_rec.org_role_typ_cd
413 ,p_popl_org_id =>p_rec.popl_org_id
414 ,p_business_group_id =>p_rec.business_group_id
415 ,p_cpr_attribute_category =>p_rec.cpr_attribute_category
416 ,p_cpr_attribute1 =>p_rec.cpr_attribute1
417 ,p_cpr_attribute2 =>p_rec.cpr_attribute2
418 ,p_cpr_attribute3 =>p_rec.cpr_attribute3
419 ,p_cpr_attribute4 =>p_rec.cpr_attribute4
420 ,p_cpr_attribute5 =>p_rec.cpr_attribute5
421 ,p_cpr_attribute6 =>p_rec.cpr_attribute6
422 ,p_cpr_attribute7 =>p_rec.cpr_attribute7
423 ,p_cpr_attribute8 =>p_rec.cpr_attribute8
424 ,p_cpr_attribute9 =>p_rec.cpr_attribute9
425 ,p_cpr_attribute10 =>p_rec.cpr_attribute10
426 ,p_cpr_attribute11 =>p_rec.cpr_attribute11
427 ,p_cpr_attribute12 =>p_rec.cpr_attribute12
428 ,p_cpr_attribute13 =>p_rec.cpr_attribute13
429 ,p_cpr_attribute14 =>p_rec.cpr_attribute14
430 ,p_cpr_attribute15 =>p_rec.cpr_attribute15
431 ,p_cpr_attribute16 =>p_rec.cpr_attribute16
432 ,p_cpr_attribute17 =>p_rec.cpr_attribute17
433 ,p_cpr_attribute18 =>p_rec.cpr_attribute18
434 ,p_cpr_attribute19 =>p_rec.cpr_attribute19
435 ,p_cpr_attribute20 =>p_rec.cpr_attribute20
436 ,p_cpr_attribute21 =>p_rec.cpr_attribute21
437 ,p_cpr_attribute22 =>p_rec.cpr_attribute22
438 ,p_cpr_attribute23 =>p_rec.cpr_attribute23
439 ,p_cpr_attribute24 =>p_rec.cpr_attribute24
440 ,p_cpr_attribute25 =>p_rec.cpr_attribute25
441 ,p_cpr_attribute26 =>p_rec.cpr_attribute26
442 ,p_cpr_attribute27 =>p_rec.cpr_attribute27
443 ,p_cpr_attribute28 =>p_rec.cpr_attribute28
444 ,p_cpr_attribute29 =>p_rec.cpr_attribute29
445 ,p_cpr_attribute30 =>p_rec.cpr_attribute30
446 ,p_object_version_number =>p_rec.object_version_number
447 ,p_effective_date =>p_effective_date
448 ,p_datetrack_mode =>p_datetrack_mode
449 ,p_validation_start_date =>p_validation_start_date
450 ,p_validation_end_date =>p_validation_end_date
451 ,p_effective_start_date_o =>ben_cpr_shd.g_old_rec.effective_start_date
452 ,p_effective_end_date_o =>ben_cpr_shd.g_old_rec.effective_end_date
453 ,p_name_o =>ben_cpr_shd.g_old_rec.name
454 ,p_org_role_typ_cd_o =>ben_cpr_shd.g_old_rec.org_role_typ_cd
455 ,p_popl_org_id_o =>ben_cpr_shd.g_old_rec.popl_org_id
456 ,p_business_group_id_o =>ben_cpr_shd.g_old_rec.business_group_id
457 ,p_cpr_attribute_category_o =>ben_cpr_shd.g_old_rec.cpr_attribute_category
458 ,p_cpr_attribute1_o =>ben_cpr_shd.g_old_rec.cpr_attribute1
459 ,p_cpr_attribute2_o =>ben_cpr_shd.g_old_rec.cpr_attribute2
460 ,p_cpr_attribute3_o =>ben_cpr_shd.g_old_rec.cpr_attribute3
461 ,p_cpr_attribute4_o =>ben_cpr_shd.g_old_rec.cpr_attribute4
462 ,p_cpr_attribute5_o =>ben_cpr_shd.g_old_rec.cpr_attribute5
463 ,p_cpr_attribute6_o =>ben_cpr_shd.g_old_rec.cpr_attribute6
464 ,p_cpr_attribute7_o =>ben_cpr_shd.g_old_rec.cpr_attribute7
465 ,p_cpr_attribute8_o =>ben_cpr_shd.g_old_rec.cpr_attribute8
466 ,p_cpr_attribute9_o =>ben_cpr_shd.g_old_rec.cpr_attribute9
467 ,p_cpr_attribute10_o =>ben_cpr_shd.g_old_rec.cpr_attribute10
468 ,p_cpr_attribute11_o =>ben_cpr_shd.g_old_rec.cpr_attribute11
469 ,p_cpr_attribute12_o =>ben_cpr_shd.g_old_rec.cpr_attribute12
470 ,p_cpr_attribute13_o =>ben_cpr_shd.g_old_rec.cpr_attribute13
471 ,p_cpr_attribute14_o =>ben_cpr_shd.g_old_rec.cpr_attribute14
472 ,p_cpr_attribute15_o =>ben_cpr_shd.g_old_rec.cpr_attribute15
473 ,p_cpr_attribute16_o =>ben_cpr_shd.g_old_rec.cpr_attribute16
474 ,p_cpr_attribute17_o =>ben_cpr_shd.g_old_rec.cpr_attribute17
475 ,p_cpr_attribute18_o =>ben_cpr_shd.g_old_rec.cpr_attribute18
476 ,p_cpr_attribute19_o =>ben_cpr_shd.g_old_rec.cpr_attribute19
477 ,p_cpr_attribute20_o =>ben_cpr_shd.g_old_rec.cpr_attribute20
478 ,p_cpr_attribute21_o =>ben_cpr_shd.g_old_rec.cpr_attribute21
479 ,p_cpr_attribute22_o =>ben_cpr_shd.g_old_rec.cpr_attribute22
480 ,p_cpr_attribute23_o =>ben_cpr_shd.g_old_rec.cpr_attribute23
481 ,p_cpr_attribute24_o =>ben_cpr_shd.g_old_rec.cpr_attribute24
482 ,p_cpr_attribute25_o =>ben_cpr_shd.g_old_rec.cpr_attribute25
483 ,p_cpr_attribute26_o =>ben_cpr_shd.g_old_rec.cpr_attribute26
484 ,p_cpr_attribute27_o =>ben_cpr_shd.g_old_rec.cpr_attribute27
485 ,p_cpr_attribute28_o =>ben_cpr_shd.g_old_rec.cpr_attribute28
486 ,p_cpr_attribute29_o =>ben_cpr_shd.g_old_rec.cpr_attribute29
487 ,p_cpr_attribute30_o =>ben_cpr_shd.g_old_rec.cpr_attribute30
488 ,p_object_version_number_o =>ben_cpr_shd.g_old_rec.object_version_number
489 );
490 --
491 exception
492 --
493 when hr_api.cannot_find_prog_unit then
494 --
495 hr_api.cannot_find_prog_unit_error
496 (p_module_name => 'ben_popl_org_role_f'
497 ,p_hook_type => 'AU');
498 --
499 end;
500 --
501 -- End of API User Hook for post_update.
502 --
503 --
504 hr_utility.set_location(' Leaving:'||l_proc, 10);
505 End post_update;
506 --
507 -- ----------------------------------------------------------------------------
508 -- |-----------------------------< convert_defs >-----------------------------|
509 -- ----------------------------------------------------------------------------
510 -- {Start Of Comments}
511 --
512 -- Description:
513 -- The Convert_Defs procedure has one very important function:
514 -- It must return the record structure for the row with all system defaulted
515 -- values converted into its corresponding parameter value for update. When
516 -- we attempt to update a row through the Upd process , certain
517 -- parameters can be defaulted which enables flexibility in the calling of
518 -- the upd process (e.g. only attributes which need to be updated need to be
519 -- specified). For the upd process to determine which attributes
520 -- have NOT been specified we need to check if the parameter has a reserved
521 -- system default value. Therefore, for all parameters which have a
522 -- corresponding reserved system default mechanism specified we need to
523 -- check if a system default is being used. If a system default is being
524 -- used then we convert the defaulted value into its corresponding attribute
525 -- value held in the g_old_rec data structure.
526 --
527 -- Prerequisites:
528 -- This private function can only be called from the upd process.
529 --
530 -- In Parameters:
531 -- A Pl/Sql record structre.
532 --
533 -- Post Success:
534 -- The record structure will be returned with all system defaulted parameter
535 -- values converted into its current row attribute value.
536 --
537 -- Post Failure:
538 -- No direct error handling is required within this function. Any possible
539 -- errors within this procedure will be a PL/SQL value error due to conversion
540 -- of datatypes or data lengths.
541 --
542 -- Developer Implementation Notes:
543 -- None.
544 --
545 -- Access Status:
546 -- Internal Row Handler Use Only.
547 --
548 -- {End Of Comments}
549 -- ----------------------------------------------------------------------------
550 Procedure convert_defs(p_rec in out nocopy ben_cpr_shd.g_rec_type) is
551 --
552 l_proc varchar2(72) := g_package||'convert_defs';
553 --
554 Begin
555 --
556 hr_utility.set_location('Entering:'||l_proc, 5);
557 --
558 -- We must now examine each argument value in the
559 -- p_rec plsql record structure
560 -- to see if a system default is being used. If a system default
561 -- is being used then we must set to the 'current' argument value.
562 --
563 If (p_rec.name = hr_api.g_varchar2) then
564 p_rec.name :=
565 ben_cpr_shd.g_old_rec.name;
566 End If;
567 If (p_rec.popl_org_id = hr_api.g_number) then
568 p_rec.popl_org_id :=
569 ben_cpr_shd.g_old_rec.popl_org_id;
570 End If;
571 If (p_rec.business_group_id = hr_api.g_number) then
572 p_rec.business_group_id :=
573 ben_cpr_shd.g_old_rec.business_group_id;
574 End If;
575 If (p_rec.cpr_attribute_category = hr_api.g_varchar2) then
576 p_rec.cpr_attribute_category :=
577 ben_cpr_shd.g_old_rec.cpr_attribute_category;
578 End If;
579 If (p_rec.cpr_attribute1 = hr_api.g_varchar2) then
580 p_rec.cpr_attribute1 :=
581 ben_cpr_shd.g_old_rec.cpr_attribute1;
582 End If;
583 If (p_rec.cpr_attribute2 = hr_api.g_varchar2) then
584 p_rec.cpr_attribute2 :=
585 ben_cpr_shd.g_old_rec.cpr_attribute2;
586 End If;
587 If (p_rec.cpr_attribute3 = hr_api.g_varchar2) then
588 p_rec.cpr_attribute3 :=
589 ben_cpr_shd.g_old_rec.cpr_attribute3;
590 End If;
591 If (p_rec.cpr_attribute4 = hr_api.g_varchar2) then
592 p_rec.cpr_attribute4 :=
593 ben_cpr_shd.g_old_rec.cpr_attribute4;
594 End If;
595 If (p_rec.cpr_attribute5 = hr_api.g_varchar2) then
596 p_rec.cpr_attribute5 :=
597 ben_cpr_shd.g_old_rec.cpr_attribute5;
598 End If;
599 If (p_rec.cpr_attribute6 = hr_api.g_varchar2) then
600 p_rec.cpr_attribute6 :=
601 ben_cpr_shd.g_old_rec.cpr_attribute6;
602 End If;
603 If (p_rec.cpr_attribute7 = hr_api.g_varchar2) then
604 p_rec.cpr_attribute7 :=
605 ben_cpr_shd.g_old_rec.cpr_attribute7;
606 End If;
607 If (p_rec.cpr_attribute8 = hr_api.g_varchar2) then
608 p_rec.cpr_attribute8 :=
609 ben_cpr_shd.g_old_rec.cpr_attribute8;
610 End If;
611 If (p_rec.cpr_attribute9 = hr_api.g_varchar2) then
612 p_rec.cpr_attribute9 :=
613 ben_cpr_shd.g_old_rec.cpr_attribute9;
614 End If;
615 If (p_rec.cpr_attribute10 = hr_api.g_varchar2) then
616 p_rec.cpr_attribute10 :=
617 ben_cpr_shd.g_old_rec.cpr_attribute10;
618 End If;
619 If (p_rec.cpr_attribute11 = hr_api.g_varchar2) then
620 p_rec.cpr_attribute11 :=
621 ben_cpr_shd.g_old_rec.cpr_attribute11;
622 End If;
623 If (p_rec.cpr_attribute12 = hr_api.g_varchar2) then
624 p_rec.cpr_attribute12 :=
625 ben_cpr_shd.g_old_rec.cpr_attribute12;
626 End If;
627 If (p_rec.cpr_attribute13 = hr_api.g_varchar2) then
628 p_rec.cpr_attribute13 :=
629 ben_cpr_shd.g_old_rec.cpr_attribute13;
630 End If;
631 If (p_rec.cpr_attribute14 = hr_api.g_varchar2) then
632 p_rec.cpr_attribute14 :=
633 ben_cpr_shd.g_old_rec.cpr_attribute14;
634 End If;
635 If (p_rec.cpr_attribute15 = hr_api.g_varchar2) then
636 p_rec.cpr_attribute15 :=
637 ben_cpr_shd.g_old_rec.cpr_attribute15;
638 End If;
639 If (p_rec.cpr_attribute16 = hr_api.g_varchar2) then
640 p_rec.cpr_attribute16 :=
641 ben_cpr_shd.g_old_rec.cpr_attribute16;
642 End If;
643 If (p_rec.cpr_attribute17 = hr_api.g_varchar2) then
644 p_rec.cpr_attribute17 :=
645 ben_cpr_shd.g_old_rec.cpr_attribute17;
646 End If;
647 If (p_rec.cpr_attribute18 = hr_api.g_varchar2) then
648 p_rec.cpr_attribute18 :=
649 ben_cpr_shd.g_old_rec.cpr_attribute18;
650 End If;
651 If (p_rec.cpr_attribute19 = hr_api.g_varchar2) then
652 p_rec.cpr_attribute19 :=
653 ben_cpr_shd.g_old_rec.cpr_attribute19;
654 End If;
655 If (p_rec.cpr_attribute20 = hr_api.g_varchar2) then
656 p_rec.cpr_attribute20 :=
657 ben_cpr_shd.g_old_rec.cpr_attribute20;
658 End If;
659 If (p_rec.cpr_attribute21 = hr_api.g_varchar2) then
660 p_rec.cpr_attribute21 :=
661 ben_cpr_shd.g_old_rec.cpr_attribute21;
662 End If;
663 If (p_rec.cpr_attribute22 = hr_api.g_varchar2) then
664 p_rec.cpr_attribute22 :=
665 ben_cpr_shd.g_old_rec.cpr_attribute22;
666 End If;
667 If (p_rec.cpr_attribute23 = hr_api.g_varchar2) then
668 p_rec.cpr_attribute23 :=
669 ben_cpr_shd.g_old_rec.cpr_attribute23;
670 End If;
671 If (p_rec.cpr_attribute24 = hr_api.g_varchar2) then
672 p_rec.cpr_attribute24 :=
673 ben_cpr_shd.g_old_rec.cpr_attribute24;
674 End If;
675 If (p_rec.cpr_attribute25 = hr_api.g_varchar2) then
676 p_rec.cpr_attribute25 :=
677 ben_cpr_shd.g_old_rec.cpr_attribute25;
678 End If;
679 If (p_rec.cpr_attribute26 = hr_api.g_varchar2) then
680 p_rec.cpr_attribute26 :=
681 ben_cpr_shd.g_old_rec.cpr_attribute26;
682 End If;
683 If (p_rec.cpr_attribute27 = hr_api.g_varchar2) then
684 p_rec.cpr_attribute27 :=
685 ben_cpr_shd.g_old_rec.cpr_attribute27;
686 End If;
687 If (p_rec.cpr_attribute28 = hr_api.g_varchar2) then
688 p_rec.cpr_attribute28 :=
689 ben_cpr_shd.g_old_rec.cpr_attribute28;
690 End If;
691 If (p_rec.cpr_attribute29 = hr_api.g_varchar2) then
692 p_rec.cpr_attribute29 :=
693 ben_cpr_shd.g_old_rec.cpr_attribute29;
694 End If;
695 If (p_rec.cpr_attribute30 = hr_api.g_varchar2) then
696 p_rec.cpr_attribute30 :=
697 ben_cpr_shd.g_old_rec.cpr_attribute30;
698 End If;
699
700 --
701 hr_utility.set_location(' Leaving:'||l_proc, 10);
702 --
703 End convert_defs;
704 --
705 -- ----------------------------------------------------------------------------
706 -- |---------------------------------< upd >----------------------------------|
707 -- ----------------------------------------------------------------------------
708 Procedure upd
709 (
710 p_rec in out nocopy ben_cpr_shd.g_rec_type,
711 p_effective_date in date,
712 p_datetrack_mode in varchar2
713 ) is
714 --
715 l_proc varchar2(72) := g_package||'upd';
716 l_validation_start_date date;
717 l_validation_end_date date;
718 --
719 Begin
720 hr_utility.set_location('Entering:'||l_proc, 5);
721 --
722 -- Ensure that the DateTrack update mode is valid
723 --
724 dt_api.validate_dt_upd_mode(p_datetrack_mode => p_datetrack_mode);
725 --
726 -- We must lock the row which we need to update.
727 --
728 ben_cpr_shd.lck
729 (p_effective_date => p_effective_date,
730 p_datetrack_mode => p_datetrack_mode,
731 p_popl_org_role_id => p_rec.popl_org_role_id,
732 p_object_version_number => p_rec.object_version_number,
733 p_validation_start_date => l_validation_start_date,
734 p_validation_end_date => l_validation_end_date);
735 --
736 -- 1. During an update system defaults are used to determine if
737 -- arguments have been defaulted or not. We must therefore
738 -- derive the full record structure values to be updated.
739 --
740 -- 2. Call the supporting update validate operations.
741 --
742 convert_defs(p_rec);
743 ben_cpr_bus.update_validate
744 (p_rec => p_rec,
745 p_effective_date => p_effective_date,
746 p_datetrack_mode => p_datetrack_mode,
747 p_validation_start_date => l_validation_start_date,
748 p_validation_end_date => l_validation_end_date);
749 --
750 -- Call the supporting pre-update operation
751 --
752 pre_update
753 (p_rec => p_rec,
754 p_effective_date => p_effective_date,
755 p_datetrack_mode => p_datetrack_mode,
756 p_validation_start_date => l_validation_start_date,
757 p_validation_end_date => l_validation_end_date);
758 --
759 -- Update the row.
760 --
761 update_dml
762 (p_rec => p_rec,
763 p_effective_date => p_effective_date,
764 p_datetrack_mode => p_datetrack_mode,
765 p_validation_start_date => l_validation_start_date,
766 p_validation_end_date => l_validation_end_date);
767 --
768 -- Call the supporting post-update operation
769 --
770 post_update
771 (p_rec => p_rec,
772 p_effective_date => p_effective_date,
773 p_datetrack_mode => p_datetrack_mode,
774 p_validation_start_date => l_validation_start_date,
775 p_validation_end_date => l_validation_end_date);
776 End upd;
777 --
778 -- ----------------------------------------------------------------------------
779 -- |---------------------------------< upd >----------------------------------|
780 -- ----------------------------------------------------------------------------
781 Procedure upd
782 (
783 p_popl_org_role_id in number,
784 p_effective_start_date out nocopy date,
785 p_effective_end_date out nocopy date,
786 p_name in varchar2 default hr_api.g_varchar2,
787 p_org_role_typ_cd in varchar2 default hr_api.g_varchar2,
788 p_popl_org_id in number default hr_api.g_number,
789 p_business_group_id in number default hr_api.g_number,
790 p_cpr_attribute_category in varchar2 default hr_api.g_varchar2,
791 p_cpr_attribute1 in varchar2 default hr_api.g_varchar2,
792 p_cpr_attribute2 in varchar2 default hr_api.g_varchar2,
793 p_cpr_attribute3 in varchar2 default hr_api.g_varchar2,
794 p_cpr_attribute4 in varchar2 default hr_api.g_varchar2,
795 p_cpr_attribute5 in varchar2 default hr_api.g_varchar2,
796 p_cpr_attribute6 in varchar2 default hr_api.g_varchar2,
797 p_cpr_attribute7 in varchar2 default hr_api.g_varchar2,
798 p_cpr_attribute8 in varchar2 default hr_api.g_varchar2,
799 p_cpr_attribute9 in varchar2 default hr_api.g_varchar2,
800 p_cpr_attribute10 in varchar2 default hr_api.g_varchar2,
801 p_cpr_attribute11 in varchar2 default hr_api.g_varchar2,
802 p_cpr_attribute12 in varchar2 default hr_api.g_varchar2,
803 p_cpr_attribute13 in varchar2 default hr_api.g_varchar2,
804 p_cpr_attribute14 in varchar2 default hr_api.g_varchar2,
805 p_cpr_attribute15 in varchar2 default hr_api.g_varchar2,
806 p_cpr_attribute16 in varchar2 default hr_api.g_varchar2,
807 p_cpr_attribute17 in varchar2 default hr_api.g_varchar2,
808 p_cpr_attribute18 in varchar2 default hr_api.g_varchar2,
809 p_cpr_attribute19 in varchar2 default hr_api.g_varchar2,
810 p_cpr_attribute20 in varchar2 default hr_api.g_varchar2,
811 p_cpr_attribute21 in varchar2 default hr_api.g_varchar2,
812 p_cpr_attribute22 in varchar2 default hr_api.g_varchar2,
813 p_cpr_attribute23 in varchar2 default hr_api.g_varchar2,
814 p_cpr_attribute24 in varchar2 default hr_api.g_varchar2,
815 p_cpr_attribute25 in varchar2 default hr_api.g_varchar2,
816 p_cpr_attribute26 in varchar2 default hr_api.g_varchar2,
817 p_cpr_attribute27 in varchar2 default hr_api.g_varchar2,
818 p_cpr_attribute28 in varchar2 default hr_api.g_varchar2,
819 p_cpr_attribute29 in varchar2 default hr_api.g_varchar2,
820 p_cpr_attribute30 in varchar2 default hr_api.g_varchar2,
821 p_object_version_number in out nocopy number,
822 p_effective_date in date,
823 p_datetrack_mode in varchar2
824 ) is
825 --
826 l_rec ben_cpr_shd.g_rec_type;
827 l_proc varchar2(72) := g_package||'upd';
828 --
829 Begin
830 hr_utility.set_location('Entering:'||l_proc, 5);
831 --
832 -- Call conversion function to turn arguments into the
833 -- l_rec structure.
834 --
835 l_rec :=
836 ben_cpr_shd.convert_args
837 (
838 p_popl_org_role_id,
839 null,
840 null,
841 p_name,
842 p_org_role_typ_cd,
843 p_popl_org_id,
844 p_business_group_id,
845 p_cpr_attribute_category,
846 p_cpr_attribute1,
847 p_cpr_attribute2,
848 p_cpr_attribute3,
849 p_cpr_attribute4,
850 p_cpr_attribute5,
851 p_cpr_attribute6,
852 p_cpr_attribute7,
853 p_cpr_attribute8,
854 p_cpr_attribute9,
855 p_cpr_attribute10,
856 p_cpr_attribute11,
857 p_cpr_attribute12,
858 p_cpr_attribute13,
859 p_cpr_attribute14,
860 p_cpr_attribute15,
861 p_cpr_attribute16,
862 p_cpr_attribute17,
863 p_cpr_attribute18,
864 p_cpr_attribute19,
865 p_cpr_attribute20,
866 p_cpr_attribute21,
867 p_cpr_attribute22,
868 p_cpr_attribute23,
869 p_cpr_attribute24,
870 p_cpr_attribute25,
871 p_cpr_attribute26,
872 p_cpr_attribute27,
873 p_cpr_attribute28,
874 p_cpr_attribute29,
875 p_cpr_attribute30,
876 p_object_version_number
877 );
878 --
879 -- Having converted the arguments into the
880 -- plsql record structure we call the corresponding record
881 -- business process.
882 --
883 upd(l_rec, p_effective_date, p_datetrack_mode);
884 p_object_version_number := l_rec.object_version_number;
885 p_effective_start_date := l_rec.effective_start_date;
886 p_effective_end_date := l_rec.effective_end_date;
887 --
888 --
889 hr_utility.set_location(' Leaving:'||l_proc, 10);
890 End upd;
891 --
892 end ben_cpr_upd;