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