1 Package Body ben_ctt_upd as
2 /* $Header: becttrhi.pkb 115.7 2002/12/16 17:35:13 glingapp ship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- | Private Global Definitions |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package varchar2(33) := ' ben_ctt_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_ctt_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_cm_typ_trgr_f',
78 p_base_key_column => 'cm_typ_trgr_id',
79 p_base_key_value => p_rec.cm_typ_trgr_id);
80 --
81 ben_ctt_shd.g_api_dml := true; -- Set the api dml status
82 --
83 -- Update the ben_cm_typ_trgr_f Row
84 --
85 update ben_cm_typ_trgr_f
86 set
87 cm_typ_trgr_id = p_rec.cm_typ_trgr_id,
88 cm_typ_trgr_rl = p_rec.cm_typ_trgr_rl,
89 cm_trgr_id = p_rec.cm_trgr_id,
90 cm_typ_id = p_rec.cm_typ_id,
91 business_group_id = p_rec.business_group_id,
92 ctt_attribute_category = p_rec.ctt_attribute_category,
93 ctt_attribute1 = p_rec.ctt_attribute1,
94 ctt_attribute2 = p_rec.ctt_attribute2,
95 ctt_attribute3 = p_rec.ctt_attribute3,
96 ctt_attribute4 = p_rec.ctt_attribute4,
97 ctt_attribute5 = p_rec.ctt_attribute5,
98 ctt_attribute6 = p_rec.ctt_attribute6,
99 ctt_attribute7 = p_rec.ctt_attribute7,
100 ctt_attribute8 = p_rec.ctt_attribute8,
101 ctt_attribute9 = p_rec.ctt_attribute9,
102 ctt_attribute10 = p_rec.ctt_attribute10,
103 ctt_attribute11 = p_rec.ctt_attribute11,
104 ctt_attribute12 = p_rec.ctt_attribute12,
105 ctt_attribute13 = p_rec.ctt_attribute13,
106 ctt_attribute14 = p_rec.ctt_attribute14,
107 ctt_attribute15 = p_rec.ctt_attribute15,
108 ctt_attribute16 = p_rec.ctt_attribute16,
109 ctt_attribute17 = p_rec.ctt_attribute17,
110 ctt_attribute18 = p_rec.ctt_attribute18,
111 ctt_attribute19 = p_rec.ctt_attribute19,
112 ctt_attribute20 = p_rec.ctt_attribute20,
113 ctt_attribute21 = p_rec.ctt_attribute21,
114 ctt_attribute22 = p_rec.ctt_attribute22,
115 ctt_attribute23 = p_rec.ctt_attribute23,
116 ctt_attribute24 = p_rec.ctt_attribute24,
117 ctt_attribute25 = p_rec.ctt_attribute25,
118 ctt_attribute26 = p_rec.ctt_attribute26,
119 ctt_attribute27 = p_rec.ctt_attribute27,
120 ctt_attribute28 = p_rec.ctt_attribute28,
121 ctt_attribute29 = p_rec.ctt_attribute29,
122 ctt_attribute30 = p_rec.ctt_attribute30,
123 object_version_number = p_rec.object_version_number
124 where cm_typ_trgr_id = p_rec.cm_typ_trgr_id
125 and effective_start_date = p_validation_start_date
126 and effective_end_date = p_validation_end_date;
127 --
128 ben_ctt_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_ctt_shd.g_api_dml := false; -- Unset the api dml status
141 ben_ctt_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_ctt_shd.g_api_dml := false; -- Unset the api dml status
146 ben_ctt_shd.constraint_error
147 (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
148 When Others Then
149 ben_ctt_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_ctt_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_ctt_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_ctt_shd.upd_effective_end_date
266 (p_effective_date => p_effective_date,
267 p_base_key_value => p_rec.cm_typ_trgr_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_ctt_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_ctt_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_ctt_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_ctt_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_ctt_rku.after_update
407 (p_cm_typ_trgr_id =>p_rec.cm_typ_trgr_id
408 ,p_effective_start_date =>p_rec.effective_start_date
409 ,p_effective_end_date =>p_rec.effective_end_date
410 ,p_cm_typ_trgr_rl =>p_rec.cm_typ_trgr_rl
411 ,p_cm_trgr_id =>p_rec.cm_trgr_id
412 ,p_cm_typ_id =>p_rec.cm_typ_id
413 ,p_business_group_id =>p_rec.business_group_id
414 ,p_ctt_attribute_category =>p_rec.ctt_attribute_category
415 ,p_ctt_attribute1 =>p_rec.ctt_attribute1
416 ,p_ctt_attribute2 =>p_rec.ctt_attribute2
417 ,p_ctt_attribute3 =>p_rec.ctt_attribute3
418 ,p_ctt_attribute4 =>p_rec.ctt_attribute4
419 ,p_ctt_attribute5 =>p_rec.ctt_attribute5
420 ,p_ctt_attribute6 =>p_rec.ctt_attribute6
421 ,p_ctt_attribute7 =>p_rec.ctt_attribute7
422 ,p_ctt_attribute8 =>p_rec.ctt_attribute8
423 ,p_ctt_attribute9 =>p_rec.ctt_attribute9
424 ,p_ctt_attribute10 =>p_rec.ctt_attribute10
425 ,p_ctt_attribute11 =>p_rec.ctt_attribute11
426 ,p_ctt_attribute12 =>p_rec.ctt_attribute12
427 ,p_ctt_attribute13 =>p_rec.ctt_attribute13
428 ,p_ctt_attribute14 =>p_rec.ctt_attribute14
429 ,p_ctt_attribute15 =>p_rec.ctt_attribute15
430 ,p_ctt_attribute16 =>p_rec.ctt_attribute16
431 ,p_ctt_attribute17 =>p_rec.ctt_attribute17
432 ,p_ctt_attribute18 =>p_rec.ctt_attribute18
433 ,p_ctt_attribute19 =>p_rec.ctt_attribute19
434 ,p_ctt_attribute20 =>p_rec.ctt_attribute20
435 ,p_ctt_attribute21 =>p_rec.ctt_attribute21
436 ,p_ctt_attribute22 =>p_rec.ctt_attribute22
437 ,p_ctt_attribute23 =>p_rec.ctt_attribute23
438 ,p_ctt_attribute24 =>p_rec.ctt_attribute24
439 ,p_ctt_attribute25 =>p_rec.ctt_attribute25
440 ,p_ctt_attribute26 =>p_rec.ctt_attribute26
441 ,p_ctt_attribute27 =>p_rec.ctt_attribute27
442 ,p_ctt_attribute28 =>p_rec.ctt_attribute28
443 ,p_ctt_attribute29 =>p_rec.ctt_attribute29
444 ,p_ctt_attribute30 =>p_rec.ctt_attribute30
445 ,p_object_version_number =>p_rec.object_version_number
446 ,p_effective_date =>p_effective_date
447 ,p_datetrack_mode =>p_datetrack_mode
448 ,p_validation_start_date =>p_validation_start_date
449 ,p_validation_end_date =>p_validation_end_date
450 ,p_effective_start_date_o =>ben_ctt_shd.g_old_rec.effective_start_date
451 ,p_effective_end_date_o =>ben_ctt_shd.g_old_rec.effective_end_date
452 ,p_cm_typ_trgr_rl_o =>ben_ctt_shd.g_old_rec.cm_typ_trgr_rl
453 ,p_cm_trgr_id_o =>ben_ctt_shd.g_old_rec.cm_trgr_id
454 ,p_cm_typ_id_o =>ben_ctt_shd.g_old_rec.cm_typ_id
455 ,p_business_group_id_o =>ben_ctt_shd.g_old_rec.business_group_id
456 ,p_ctt_attribute_category_o =>ben_ctt_shd.g_old_rec.ctt_attribute_category
457 ,p_ctt_attribute1_o =>ben_ctt_shd.g_old_rec.ctt_attribute1
458 ,p_ctt_attribute2_o =>ben_ctt_shd.g_old_rec.ctt_attribute2
459 ,p_ctt_attribute3_o =>ben_ctt_shd.g_old_rec.ctt_attribute3
460 ,p_ctt_attribute4_o =>ben_ctt_shd.g_old_rec.ctt_attribute4
461 ,p_ctt_attribute5_o =>ben_ctt_shd.g_old_rec.ctt_attribute5
462 ,p_ctt_attribute6_o =>ben_ctt_shd.g_old_rec.ctt_attribute6
463 ,p_ctt_attribute7_o =>ben_ctt_shd.g_old_rec.ctt_attribute7
464 ,p_ctt_attribute8_o =>ben_ctt_shd.g_old_rec.ctt_attribute8
465 ,p_ctt_attribute9_o =>ben_ctt_shd.g_old_rec.ctt_attribute9
466 ,p_ctt_attribute10_o =>ben_ctt_shd.g_old_rec.ctt_attribute10
467 ,p_ctt_attribute11_o =>ben_ctt_shd.g_old_rec.ctt_attribute11
468 ,p_ctt_attribute12_o =>ben_ctt_shd.g_old_rec.ctt_attribute12
469 ,p_ctt_attribute13_o =>ben_ctt_shd.g_old_rec.ctt_attribute13
470 ,p_ctt_attribute14_o =>ben_ctt_shd.g_old_rec.ctt_attribute14
471 ,p_ctt_attribute15_o =>ben_ctt_shd.g_old_rec.ctt_attribute15
472 ,p_ctt_attribute16_o =>ben_ctt_shd.g_old_rec.ctt_attribute16
473 ,p_ctt_attribute17_o =>ben_ctt_shd.g_old_rec.ctt_attribute17
474 ,p_ctt_attribute18_o =>ben_ctt_shd.g_old_rec.ctt_attribute18
475 ,p_ctt_attribute19_o =>ben_ctt_shd.g_old_rec.ctt_attribute19
476 ,p_ctt_attribute20_o =>ben_ctt_shd.g_old_rec.ctt_attribute20
477 ,p_ctt_attribute21_o =>ben_ctt_shd.g_old_rec.ctt_attribute21
478 ,p_ctt_attribute22_o =>ben_ctt_shd.g_old_rec.ctt_attribute22
479 ,p_ctt_attribute23_o =>ben_ctt_shd.g_old_rec.ctt_attribute23
480 ,p_ctt_attribute24_o =>ben_ctt_shd.g_old_rec.ctt_attribute24
481 ,p_ctt_attribute25_o =>ben_ctt_shd.g_old_rec.ctt_attribute25
482 ,p_ctt_attribute26_o =>ben_ctt_shd.g_old_rec.ctt_attribute26
483 ,p_ctt_attribute27_o =>ben_ctt_shd.g_old_rec.ctt_attribute27
484 ,p_ctt_attribute28_o =>ben_ctt_shd.g_old_rec.ctt_attribute28
485 ,p_ctt_attribute29_o =>ben_ctt_shd.g_old_rec.ctt_attribute29
486 ,p_ctt_attribute30_o =>ben_ctt_shd.g_old_rec.ctt_attribute30
487 ,p_object_version_number_o =>ben_ctt_shd.g_old_rec.object_version_number);
488 --
489 exception
490 --
491 when hr_api.cannot_find_prog_unit then
492 --
493 hr_api.cannot_find_prog_unit_error
494 (p_module_name => 'ben_cm_typ_trgr_f'
495 ,p_hook_type => 'AU');
496 --
497 end;
498 --
499 -- End of API User Hook for post_update.
500 --
501 --
502 hr_utility.set_location(' Leaving:'||l_proc, 10);
503 End post_update;
504 --
505 -- ----------------------------------------------------------------------------
506 -- |-----------------------------< convert_defs >-----------------------------|
507 -- ----------------------------------------------------------------------------
508 -- {Start Of Comments}
509 --
510 -- Description:
511 -- The Convert_Defs procedure has one very important function:
512 -- It must return the record structure for the row with all system defaulted
513 -- values converted into its corresponding parameter value for update. When
514 -- we attempt to update a row through the Upd process , certain
515 -- parameters can be defaulted which enables flexibility in the calling of
516 -- the upd process (e.g. only attributes which need to be updated need to be
517 -- specified). For the upd process to determine which attributes
518 -- have NOT been specified we need to check if the parameter has a reserved
519 -- system default value. Therefore, for all parameters which have a
520 -- corresponding reserved system default mechanism specified we need to
521 -- check if a system default is being used. If a system default is being
522 -- used then we convert the defaulted value into its corresponding attribute
523 -- value held in the g_old_rec data structure.
524 --
525 -- Prerequisites:
526 -- This private function can only be called from the upd process.
527 --
528 -- In Parameters:
529 -- A Pl/Sql record structre.
530 --
531 -- Post Success:
532 -- The record structure will be returned with all system defaulted parameter
533 -- values converted into its current row attribute value.
534 --
535 -- Post Failure:
536 -- No direct error handling is required within this function. Any possible
537 -- errors within this procedure will be a PL/SQL value error due to conversion
538 -- of datatypes or data lengths.
539 --
540 -- Developer Implementation Notes:
541 -- None.
542 --
543 -- Access Status:
544 -- Internal Row Handler Use Only.
545 --
546 -- {End Of Comments}
547 -- ----------------------------------------------------------------------------
548 Procedure convert_defs(p_rec in out nocopy ben_ctt_shd.g_rec_type) is
549 --
550 l_proc varchar2(72) := g_package||'convert_defs';
551 --
552 Begin
553 --
554 hr_utility.set_location('Entering:'||l_proc, 5);
555 --
556 -- We must now examine each argument value in the
557 -- p_rec plsql record structure
558 -- to see if a system default is being used. If a system default
559 -- is being used then we must set to the 'current' argument value.
560 --
561 If (p_rec.cm_typ_trgr_rl = hr_api.g_number) then
562 p_rec.cm_typ_trgr_rl :=
563 ben_ctt_shd.g_old_rec.cm_typ_trgr_rl;
564 End If;
565 If (p_rec.cm_trgr_id = hr_api.g_number) then
566 p_rec.cm_trgr_id :=
567 ben_ctt_shd.g_old_rec.cm_trgr_id;
568 End If;
569 If (p_rec.cm_typ_id = hr_api.g_number) then
570 p_rec.cm_typ_id :=
571 ben_ctt_shd.g_old_rec.cm_typ_id;
572 End If;
573 If (p_rec.business_group_id = hr_api.g_number) then
574 p_rec.business_group_id :=
575 ben_ctt_shd.g_old_rec.business_group_id;
576 End If;
577 If (p_rec.ctt_attribute_category = hr_api.g_varchar2) then
578 p_rec.ctt_attribute_category :=
579 ben_ctt_shd.g_old_rec.ctt_attribute_category;
580 End If;
581 If (p_rec.ctt_attribute1 = hr_api.g_varchar2) then
582 p_rec.ctt_attribute1 :=
583 ben_ctt_shd.g_old_rec.ctt_attribute1;
584 End If;
585 If (p_rec.ctt_attribute2 = hr_api.g_varchar2) then
586 p_rec.ctt_attribute2 :=
587 ben_ctt_shd.g_old_rec.ctt_attribute2;
588 End If;
589 If (p_rec.ctt_attribute3 = hr_api.g_varchar2) then
590 p_rec.ctt_attribute3 :=
591 ben_ctt_shd.g_old_rec.ctt_attribute3;
592 End If;
593 If (p_rec.ctt_attribute4 = hr_api.g_varchar2) then
594 p_rec.ctt_attribute4 :=
595 ben_ctt_shd.g_old_rec.ctt_attribute4;
596 End If;
597 If (p_rec.ctt_attribute5 = hr_api.g_varchar2) then
598 p_rec.ctt_attribute5 :=
599 ben_ctt_shd.g_old_rec.ctt_attribute5;
600 End If;
601 If (p_rec.ctt_attribute6 = hr_api.g_varchar2) then
602 p_rec.ctt_attribute6 :=
603 ben_ctt_shd.g_old_rec.ctt_attribute6;
604 End If;
605 If (p_rec.ctt_attribute7 = hr_api.g_varchar2) then
606 p_rec.ctt_attribute7 :=
607 ben_ctt_shd.g_old_rec.ctt_attribute7;
608 End If;
609 If (p_rec.ctt_attribute8 = hr_api.g_varchar2) then
610 p_rec.ctt_attribute8 :=
611 ben_ctt_shd.g_old_rec.ctt_attribute8;
612 End If;
613 If (p_rec.ctt_attribute9 = hr_api.g_varchar2) then
614 p_rec.ctt_attribute9 :=
615 ben_ctt_shd.g_old_rec.ctt_attribute9;
616 End If;
617 If (p_rec.ctt_attribute10 = hr_api.g_varchar2) then
618 p_rec.ctt_attribute10 :=
619 ben_ctt_shd.g_old_rec.ctt_attribute10;
620 End If;
621 If (p_rec.ctt_attribute11 = hr_api.g_varchar2) then
622 p_rec.ctt_attribute11 :=
623 ben_ctt_shd.g_old_rec.ctt_attribute11;
624 End If;
625 If (p_rec.ctt_attribute12 = hr_api.g_varchar2) then
626 p_rec.ctt_attribute12 :=
627 ben_ctt_shd.g_old_rec.ctt_attribute12;
628 End If;
629 If (p_rec.ctt_attribute13 = hr_api.g_varchar2) then
630 p_rec.ctt_attribute13 :=
631 ben_ctt_shd.g_old_rec.ctt_attribute13;
632 End If;
633 If (p_rec.ctt_attribute14 = hr_api.g_varchar2) then
634 p_rec.ctt_attribute14 :=
635 ben_ctt_shd.g_old_rec.ctt_attribute14;
636 End If;
637 If (p_rec.ctt_attribute15 = hr_api.g_varchar2) then
638 p_rec.ctt_attribute15 :=
639 ben_ctt_shd.g_old_rec.ctt_attribute15;
640 End If;
641 If (p_rec.ctt_attribute16 = hr_api.g_varchar2) then
642 p_rec.ctt_attribute16 :=
643 ben_ctt_shd.g_old_rec.ctt_attribute16;
644 End If;
645 If (p_rec.ctt_attribute17 = hr_api.g_varchar2) then
646 p_rec.ctt_attribute17 :=
647 ben_ctt_shd.g_old_rec.ctt_attribute17;
648 End If;
649 If (p_rec.ctt_attribute18 = hr_api.g_varchar2) then
650 p_rec.ctt_attribute18 :=
651 ben_ctt_shd.g_old_rec.ctt_attribute18;
652 End If;
653 If (p_rec.ctt_attribute19 = hr_api.g_varchar2) then
654 p_rec.ctt_attribute19 :=
655 ben_ctt_shd.g_old_rec.ctt_attribute19;
656 End If;
657 If (p_rec.ctt_attribute20 = hr_api.g_varchar2) then
658 p_rec.ctt_attribute20 :=
659 ben_ctt_shd.g_old_rec.ctt_attribute20;
660 End If;
661 If (p_rec.ctt_attribute21 = hr_api.g_varchar2) then
662 p_rec.ctt_attribute21 :=
663 ben_ctt_shd.g_old_rec.ctt_attribute21;
664 End If;
665 If (p_rec.ctt_attribute22 = hr_api.g_varchar2) then
666 p_rec.ctt_attribute22 :=
667 ben_ctt_shd.g_old_rec.ctt_attribute22;
668 End If;
669 If (p_rec.ctt_attribute23 = hr_api.g_varchar2) then
670 p_rec.ctt_attribute23 :=
671 ben_ctt_shd.g_old_rec.ctt_attribute23;
672 End If;
673 If (p_rec.ctt_attribute24 = hr_api.g_varchar2) then
674 p_rec.ctt_attribute24 :=
675 ben_ctt_shd.g_old_rec.ctt_attribute24;
676 End If;
677 If (p_rec.ctt_attribute25 = hr_api.g_varchar2) then
678 p_rec.ctt_attribute25 :=
679 ben_ctt_shd.g_old_rec.ctt_attribute25;
680 End If;
681 If (p_rec.ctt_attribute26 = hr_api.g_varchar2) then
682 p_rec.ctt_attribute26 :=
683 ben_ctt_shd.g_old_rec.ctt_attribute26;
684 End If;
685 If (p_rec.ctt_attribute27 = hr_api.g_varchar2) then
686 p_rec.ctt_attribute27 :=
687 ben_ctt_shd.g_old_rec.ctt_attribute27;
688 End If;
689 If (p_rec.ctt_attribute28 = hr_api.g_varchar2) then
690 p_rec.ctt_attribute28 :=
691 ben_ctt_shd.g_old_rec.ctt_attribute28;
692 End If;
693 If (p_rec.ctt_attribute29 = hr_api.g_varchar2) then
694 p_rec.ctt_attribute29 :=
695 ben_ctt_shd.g_old_rec.ctt_attribute29;
696 End If;
697 If (p_rec.ctt_attribute30 = hr_api.g_varchar2) then
698 p_rec.ctt_attribute30 :=
699 ben_ctt_shd.g_old_rec.ctt_attribute30;
700 End If;
701
702 --
703 hr_utility.set_location(' Leaving:'||l_proc, 10);
704 --
705 End convert_defs;
706 --
707 -- ----------------------------------------------------------------------------
708 -- |---------------------------------< upd >----------------------------------|
709 -- ----------------------------------------------------------------------------
710 Procedure upd
711 (
712 p_rec in out nocopy ben_ctt_shd.g_rec_type,
713 p_effective_date in date,
714 p_datetrack_mode in varchar2
715 ) is
716 --
717 l_proc varchar2(72) := g_package||'upd';
718 l_validation_start_date date;
719 l_validation_end_date date;
720 --
721 Begin
722 hr_utility.set_location('Entering:'||l_proc, 5);
723 --
724 -- Ensure that the DateTrack update mode is valid
725 --
726 dt_api.validate_dt_upd_mode(p_datetrack_mode => p_datetrack_mode);
727 --
728 -- We must lock the row which we need to update.
729 --
730 ben_ctt_shd.lck
731 (p_effective_date => p_effective_date,
732 p_datetrack_mode => p_datetrack_mode,
733 p_cm_typ_trgr_id => p_rec.cm_typ_trgr_id,
734 p_object_version_number => p_rec.object_version_number,
735 p_validation_start_date => l_validation_start_date,
736 p_validation_end_date => l_validation_end_date);
737 --
738 -- 1. During an update system defaults are used to determine if
739 -- arguments have been defaulted or not. We must therefore
740 -- derive the full record structure values to be updated.
741 --
742 -- 2. Call the supporting update validate operations.
743 --
744 convert_defs(p_rec);
745 ben_ctt_bus.update_validate
746 (p_rec => p_rec,
747 p_effective_date => p_effective_date,
748 p_datetrack_mode => p_datetrack_mode,
749 p_validation_start_date => l_validation_start_date,
750 p_validation_end_date => l_validation_end_date);
751 --
752 -- Call the supporting pre-update operation
753 --
754 pre_update
755 (p_rec => p_rec,
756 p_effective_date => p_effective_date,
757 p_datetrack_mode => p_datetrack_mode,
758 p_validation_start_date => l_validation_start_date,
759 p_validation_end_date => l_validation_end_date);
760 --
761 -- Update the row.
762 --
763 update_dml
764 (p_rec => p_rec,
765 p_effective_date => p_effective_date,
766 p_datetrack_mode => p_datetrack_mode,
767 p_validation_start_date => l_validation_start_date,
768 p_validation_end_date => l_validation_end_date);
769 --
770 -- Call the supporting post-update operation
771 --
772 post_update
773 (p_rec => p_rec,
774 p_effective_date => p_effective_date,
775 p_datetrack_mode => p_datetrack_mode,
776 p_validation_start_date => l_validation_start_date,
777 p_validation_end_date => l_validation_end_date);
778 End upd;
779 --
780 -- ----------------------------------------------------------------------------
781 -- |---------------------------------< upd >----------------------------------|
782 -- ----------------------------------------------------------------------------
783 Procedure upd
784 (
785 p_cm_typ_trgr_id in number,
786 p_effective_start_date out nocopy date,
787 p_effective_end_date out nocopy date,
788 p_cm_typ_trgr_rl in number default hr_api.g_number,
789 p_cm_trgr_id in number default hr_api.g_number,
790 p_cm_typ_id in number default hr_api.g_number,
791 p_business_group_id in number default hr_api.g_number,
792 p_ctt_attribute_category in varchar2 default hr_api.g_varchar2,
793 p_ctt_attribute1 in varchar2 default hr_api.g_varchar2,
794 p_ctt_attribute2 in varchar2 default hr_api.g_varchar2,
795 p_ctt_attribute3 in varchar2 default hr_api.g_varchar2,
796 p_ctt_attribute4 in varchar2 default hr_api.g_varchar2,
797 p_ctt_attribute5 in varchar2 default hr_api.g_varchar2,
798 p_ctt_attribute6 in varchar2 default hr_api.g_varchar2,
799 p_ctt_attribute7 in varchar2 default hr_api.g_varchar2,
800 p_ctt_attribute8 in varchar2 default hr_api.g_varchar2,
801 p_ctt_attribute9 in varchar2 default hr_api.g_varchar2,
802 p_ctt_attribute10 in varchar2 default hr_api.g_varchar2,
803 p_ctt_attribute11 in varchar2 default hr_api.g_varchar2,
804 p_ctt_attribute12 in varchar2 default hr_api.g_varchar2,
805 p_ctt_attribute13 in varchar2 default hr_api.g_varchar2,
806 p_ctt_attribute14 in varchar2 default hr_api.g_varchar2,
807 p_ctt_attribute15 in varchar2 default hr_api.g_varchar2,
808 p_ctt_attribute16 in varchar2 default hr_api.g_varchar2,
809 p_ctt_attribute17 in varchar2 default hr_api.g_varchar2,
810 p_ctt_attribute18 in varchar2 default hr_api.g_varchar2,
811 p_ctt_attribute19 in varchar2 default hr_api.g_varchar2,
812 p_ctt_attribute20 in varchar2 default hr_api.g_varchar2,
813 p_ctt_attribute21 in varchar2 default hr_api.g_varchar2,
814 p_ctt_attribute22 in varchar2 default hr_api.g_varchar2,
815 p_ctt_attribute23 in varchar2 default hr_api.g_varchar2,
816 p_ctt_attribute24 in varchar2 default hr_api.g_varchar2,
817 p_ctt_attribute25 in varchar2 default hr_api.g_varchar2,
818 p_ctt_attribute26 in varchar2 default hr_api.g_varchar2,
819 p_ctt_attribute27 in varchar2 default hr_api.g_varchar2,
820 p_ctt_attribute28 in varchar2 default hr_api.g_varchar2,
821 p_ctt_attribute29 in varchar2 default hr_api.g_varchar2,
822 p_ctt_attribute30 in varchar2 default hr_api.g_varchar2,
823 p_object_version_number in out nocopy number,
824 p_effective_date in date,
825 p_datetrack_mode in varchar2
826 ) is
827 --
828 l_rec ben_ctt_shd.g_rec_type;
829 l_proc varchar2(72) := g_package||'upd';
830 --
831 Begin
832 hr_utility.set_location('Entering:'||l_proc, 5);
833 --
834 -- Call conversion function to turn arguments into the
835 -- l_rec structure.
836 --
837 l_rec :=
838 ben_ctt_shd.convert_args
839 (
840 p_cm_typ_trgr_id,
841 null,
842 null,
843 p_cm_typ_trgr_rl,
844 p_cm_trgr_id,
845 p_cm_typ_id,
846 p_business_group_id,
847 p_ctt_attribute_category,
848 p_ctt_attribute1,
849 p_ctt_attribute2,
850 p_ctt_attribute3,
851 p_ctt_attribute4,
852 p_ctt_attribute5,
853 p_ctt_attribute6,
854 p_ctt_attribute7,
855 p_ctt_attribute8,
856 p_ctt_attribute9,
857 p_ctt_attribute10,
858 p_ctt_attribute11,
859 p_ctt_attribute12,
860 p_ctt_attribute13,
861 p_ctt_attribute14,
862 p_ctt_attribute15,
863 p_ctt_attribute16,
864 p_ctt_attribute17,
865 p_ctt_attribute18,
866 p_ctt_attribute19,
867 p_ctt_attribute20,
868 p_ctt_attribute21,
869 p_ctt_attribute22,
870 p_ctt_attribute23,
871 p_ctt_attribute24,
872 p_ctt_attribute25,
873 p_ctt_attribute26,
874 p_ctt_attribute27,
875 p_ctt_attribute28,
876 p_ctt_attribute29,
877 p_ctt_attribute30,
878 p_object_version_number
879 );
880 --
881 -- Having converted the arguments into the
882 -- plsql record structure we call the corresponding record
883 -- business process.
884 --
885 upd(l_rec, p_effective_date, p_datetrack_mode);
886 p_object_version_number := l_rec.object_version_number;
887 p_effective_start_date := l_rec.effective_start_date;
888 p_effective_end_date := l_rec.effective_end_date;
889 --
890 --
891 hr_utility.set_location(' Leaving:'||l_proc, 10);
892 End upd;
893 --
894 end ben_ctt_upd;