DBA Data[Home] [Help]

PACKAGE BODY: APPS.BEN_CTU_UPD

Source


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