DBA Data[Home] [Help]

PACKAGE BODY: APPS.BEN_CCT_UPD

Source


1 Package Body ben_cct_upd as
2 /* $Header: becctrhi.pkb 120.0 2005/05/28 00:58:57 appldev noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33)	:= '  ben_cct_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_cct_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_f',
78 	   p_base_key_column	=> 'cm_typ_id',
79 	   p_base_key_value	=> p_rec.cm_typ_id);
80     --
81     ben_cct_shd.g_api_dml := true;  -- Set the api dml status
82     --
83     -- Update the ben_cm_typ_f Row
84     --
85     update  ben_cm_typ_f
86     set
87         cm_typ_id                       = p_rec.cm_typ_id,
88     name                            = p_rec.name,
89     desc_txt                        = p_rec.desc_txt,
90     cm_typ_rl                       = p_rec.cm_typ_rl,
91     cm_usg_cd                       = p_rec.cm_usg_cd,
92     whnvr_trgrd_flag                = p_rec.whnvr_trgrd_flag,
93     shrt_name                       = p_rec.shrt_name,
94     pc_kit_cd                       = p_rec.pc_kit_cd,
95     trk_mlg_flag                    = p_rec.trk_mlg_flag,
96     mx_num_avlbl_val                = p_rec.mx_num_avlbl_val,
97     to_be_sent_dt_cd                = p_rec.to_be_sent_dt_cd,
98     to_be_sent_dt_rl                = p_rec.to_be_sent_dt_rl,
99     inspn_rqd_flag                  = p_rec.inspn_rqd_flag,
100     inspn_rqd_rl                    = p_rec.inspn_rqd_rl,
101     rcpent_cd                       = p_rec.rcpent_cd,
102     parnt_cm_typ_id                 = p_rec.parnt_cm_typ_id,
103     business_group_id               = p_rec.business_group_id,
104     cct_attribute_category          = p_rec.cct_attribute_category,
105     cct_attribute1                  = p_rec.cct_attribute1,
106     cct_attribute10                 = p_rec.cct_attribute10,
107     cct_attribute11                 = p_rec.cct_attribute11,
108     cct_attribute12                 = p_rec.cct_attribute12,
109     cct_attribute13                 = p_rec.cct_attribute13,
110     cct_attribute14                 = p_rec.cct_attribute14,
111     cct_attribute15                 = p_rec.cct_attribute15,
112     cct_attribute16                 = p_rec.cct_attribute16,
113     cct_attribute17                 = p_rec.cct_attribute17,
114     cct_attribute18                 = p_rec.cct_attribute18,
115     cct_attribute19                 = p_rec.cct_attribute19,
116     cct_attribute2                  = p_rec.cct_attribute2,
117     cct_attribute20                 = p_rec.cct_attribute20,
118     cct_attribute21                 = p_rec.cct_attribute21,
119     cct_attribute22                 = p_rec.cct_attribute22,
120     cct_attribute23                 = p_rec.cct_attribute23,
121     cct_attribute24                 = p_rec.cct_attribute24,
122     cct_attribute25                 = p_rec.cct_attribute25,
123     cct_attribute26                 = p_rec.cct_attribute26,
124     cct_attribute27                 = p_rec.cct_attribute27,
125     cct_attribute28                 = p_rec.cct_attribute28,
126     cct_attribute29                 = p_rec.cct_attribute29,
127     cct_attribute3                  = p_rec.cct_attribute3,
128     cct_attribute30                 = p_rec.cct_attribute30,
129     cct_attribute4                  = p_rec.cct_attribute4,
130     cct_attribute5                  = p_rec.cct_attribute5,
131     cct_attribute6                  = p_rec.cct_attribute6,
132     cct_attribute7                  = p_rec.cct_attribute7,
133     cct_attribute8                  = p_rec.cct_attribute8,
134     cct_attribute9                  = p_rec.cct_attribute9,
135     object_version_number           = p_rec.object_version_number
136     where   cm_typ_id = p_rec.cm_typ_id
137     and     effective_start_date = p_validation_start_date
138     and     effective_end_date   = p_validation_end_date;
139     --
140     --  Update MLS table.
141     --
142     update ben_cm_typ_f_tl
143     set shrt_name   = p_rec.shrt_name,
144         name  = p_rec.name,
145     last_update_date  = sysdate,
146     last_updated_by   = fnd_global.user_id,
147     last_update_login = fnd_global.login_id,
148     source_lang = userenv('LANG')
149     where cm_typ_id = p_rec.cm_typ_id
150     and   effective_start_date = p_validation_start_date
151     and   effective_end_date = p_validation_end_date
152     and   userenv('LANG') in (language, source_lang);
153     --
154     ben_cct_shd.g_api_dml := false;   -- Unset the api dml status
155     --
156     -- Set the effective start and end dates
157     --
158     p_rec.effective_start_date := p_validation_start_date;
159     p_rec.effective_end_date   := p_validation_end_date;
160   End If;
161 --
162 hr_utility.set_location(' Leaving:'||l_proc, 15);
163 Exception
164   When hr_api.check_integrity_violated Then
165     -- A check constraint has been violated
166     ben_cct_shd.g_api_dml := false;   -- Unset the api dml status
167     ben_cct_shd.constraint_error
168       (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
169   When hr_api.unique_integrity_violated Then
170     -- Unique integrity has been violated
171     ben_cct_shd.g_api_dml := false;   -- Unset the api dml status
172     ben_cct_shd.constraint_error
173       (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
174   When Others Then
175     ben_cct_shd.g_api_dml := false;   -- Unset the api dml status
176     Raise;
177 End dt_update_dml;
178 --
179 -- ----------------------------------------------------------------------------
180 -- |------------------------------< update_dml >------------------------------|
181 -- ----------------------------------------------------------------------------
182 -- {Start Of Comments}
183 --
184 -- Description:
185 --   This procedure calls the dt_update_dml control logic which handles
186 --   the actual datetrack dml.
187 --
188 -- Prerequisites:
189 --   This is an internal private procedure which must be called from the upd
190 --   procedure.
191 --
192 -- In Parameters:
193 --   A Pl/Sql record structre.
194 --
195 -- Post Success:
196 --   Processing contines.
197 --
198 -- Post Failure:
199 --   No specific error handling is required within this procedure.
200 --
201 -- Developer Implementation Notes:
202 --   The update 'set' arguments list should be modified if any of your
203 --   attributes are not updateable.
204 --
205 -- Access Status:
206 --   Internal Row Handler Use Only.
207 --
208 -- {End Of Comments}
209 -- ----------------------------------------------------------------------------
210 Procedure update_dml
211 	(p_rec 			 in out nocopy ben_cct_shd.g_rec_type,
212 	 p_effective_date	 in	date,
213 	 p_datetrack_mode	 in	varchar2,
214 	 p_validation_start_date in	date,
215 	 p_validation_end_date	 in	date) is
216 --
217   l_proc	varchar2(72) := g_package||'update_dml';
218 --
219 Begin
220   hr_utility.set_location('Entering:'||l_proc, 5);
221   --
222   dt_update_dml(p_rec			=> p_rec,
223 		p_effective_date	=> p_effective_date,
224 		p_datetrack_mode	=> p_datetrack_mode,
225        		p_validation_start_date	=> p_validation_start_date,
226 		p_validation_end_date	=> p_validation_end_date);
227   --
228   hr_utility.set_location(' Leaving:'||l_proc, 10);
229 End update_dml;
230 --
231 -- ----------------------------------------------------------------------------
232 -- |----------------------------< dt_pre_update >-----------------------------|
233 -- ----------------------------------------------------------------------------
234 -- {Start Of Comments}
235 --
236 -- Description:
237 --   The dt_pre_update procedure controls the execution
238 --   of dml for the datetrack modes of: UPDATE, UPDATE_OVERRIDE
239 --   and UPDATE_CHANGE_INSERT only. The execution required is as
240 --   follows:
241 --
242 --   1) Providing the datetrack update mode is not 'CORRECTION'
243 --      then set the effective end date of the current row (this
244 --      will be the validation_start_date - 1).
245 --   2) If the datetrack mode is 'UPDATE_OVERRIDE' then call the
246 --      corresponding delete_dml process to delete any future rows
247 --      where the effective_start_date is greater than or equal to
248 --	the validation_start_date.
249 --   3) Call the insert_dml process to insert the new updated row
250 --      details..
251 --
252 -- Prerequisites:
253 --   This is an internal procedure which is called from the
254 --   pre_update procedure.
255 --
256 -- In Parameters:
257 --
258 -- Post Success:
259 --   Processing continues.
260 --
261 -- Post Failure:
262 --   If an error has occurred, an error message and exception will be raised
263 --   but not handled.
264 --
265 -- Developer Implementation Notes:
266 --   This is an internal procedure which is required by Datetrack. Don't
267 --   remove or modify.
268 --
269 -- Access Status:
270 --   Internal Row Handler Use Only.
271 --
272 -- {End Of Comments}
273 -- ----------------------------------------------------------------------------
274 Procedure dt_pre_update
275 	(p_rec 			 in out nocopy ben_cct_shd.g_rec_type,
276 	 p_effective_date	 in	date,
277 	 p_datetrack_mode	 in	varchar2,
278 	 p_validation_start_date in	date,
279 	 p_validation_end_date	 in	date) is
280 --
281   l_proc	         varchar2(72) := g_package||'dt_pre_update';
282   l_dummy_version_number number;
283 --
284 Begin
285   hr_utility.set_location('Entering:'||l_proc, 5);
286   If (p_datetrack_mode <> 'CORRECTION') then
287     hr_utility.set_location(l_proc, 10);
288     --
289     -- Update the current effective end date
290     --
291     ben_cct_shd.upd_effective_end_date
292      (p_effective_date	       => p_effective_date,
293       p_base_key_value	       => p_rec.cm_typ_id,
294       p_new_effective_end_date => (p_validation_start_date - 1),
295       p_validation_start_date  => p_validation_start_date,
296       p_validation_end_date    => p_validation_end_date,
297       p_object_version_number  => l_dummy_version_number);
298     --
299     If (p_datetrack_mode = 'UPDATE_OVERRIDE') then
300       hr_utility.set_location(l_proc, 15);
301       --
302       -- As the datetrack mode is 'UPDATE_OVERRIDE' then we must
303       -- delete any future rows
304       --
305       ben_cct_del.delete_dml
306         (p_rec			 => p_rec,
307 	 p_effective_date	 => p_effective_date,
308 	 p_datetrack_mode	 => p_datetrack_mode,
309 	 p_validation_start_date => p_validation_start_date,
310 	 p_validation_end_date   => p_validation_end_date);
311     End If;
312     hr_utility.set_location(l_proc, 20);
313     --
314     -- We must now insert the updated row
315     --
316     ben_cct_ins.insert_dml
317       (p_rec			=> p_rec,
318        p_effective_date		=> p_effective_date,
319        p_datetrack_mode		=> p_datetrack_mode,
320        p_validation_start_date	=> p_validation_start_date,
321        p_validation_end_date	=> p_validation_end_date);
322   End If;
323   hr_utility.set_location(' Leaving:'||l_proc, 20);
324 End dt_pre_update;
325 --
326 -- ----------------------------------------------------------------------------
327 -- |------------------------------< pre_update >------------------------------|
328 -- ----------------------------------------------------------------------------
329 -- {Start Of Comments}
330 --
331 -- Description:
332 --   This private procedure contains any processing which is required before
333 --   the update dml.
334 --
335 -- Prerequisites:
336 --   This is an internal procedure which is called from the upd procedure.
337 --
338 -- In Parameters:
339 --   A Pl/Sql record structre.
340 --
341 -- Post Success:
342 --   Processing continues.
343 --
344 -- Post Failure:
345 --   If an error has occurred, an error message and exception will be raised
346 --   but not handled.
347 --
348 -- Developer Implementation Notes:
349 --   Any pre-processing required before the update dml is issued should be
350 --   coded within this procedure. It is important to note that any 3rd party
351 --   maintenance should be reviewed before placing in this procedure. The call
352 --   to the dt_update_dml procedure should NOT be removed.
353 --
354 -- Access Status:
355 --   Internal Row Handler Use Only.
356 --
357 -- {End Of Comments}
358 -- ----------------------------------------------------------------------------
359 Procedure pre_update
360 	(p_rec 			 in out nocopy ben_cct_shd.g_rec_type,
361 	 p_effective_date	 in	date,
362 	 p_datetrack_mode	 in	varchar2,
363 	 p_validation_start_date in	date,
364 	 p_validation_end_date	 in	date) is
365 --
366   l_proc	varchar2(72) := g_package||'pre_update';
367 --
368 Begin
369   hr_utility.set_location('Entering:'||l_proc, 5);
370   --
371   --
372   --
373   dt_pre_update
374     (p_rec 		     => p_rec,
375      p_effective_date	     => p_effective_date,
376      p_datetrack_mode	     => p_datetrack_mode,
377      p_validation_start_date => p_validation_start_date,
378      p_validation_end_date   => p_validation_end_date);
379   --
380   hr_utility.set_location(' Leaving:'||l_proc, 10);
381 End pre_update;
382 --
383 -- ----------------------------------------------------------------------------
384 -- |-----------------------------< post_update >------------------------------|
385 -- ----------------------------------------------------------------------------
386 -- {Start Of Comments}
387 --
388 -- Description:
389 --   This private procedure contains any processing which is required after the
390 --   update dml.
391 --
392 -- Prerequisites:
393 --   This is an internal procedure which is called from the upd procedure.
394 --
395 -- In Parameters:
396 --   A Pl/Sql record structre.
397 --
398 -- Post Success:
399 --   Processing continues.
400 --
401 -- Post Failure:
402 --   If an error has occurred, an error message and exception will be raised
403 --   but not handled.
404 --
405 -- Developer Implementation Notes:
406 --   Any post-processing required after the update dml is issued should be
407 --   coded within this procedure. It is important to note that any 3rd party
408 --   maintenance should be reviewed before placing in this procedure.
409 --
410 -- Access Status:
411 --   Internal Row Handler Use Only.
412 --
413 -- {End Of Comments}
414 -- ----------------------------------------------------------------------------
415 Procedure post_update
416 	(p_rec 			 in ben_cct_shd.g_rec_type,
417 	 p_effective_date	 in date,
418 	 p_datetrack_mode	 in varchar2,
419 	 p_validation_start_date in date,
420 	 p_validation_end_date	 in date) is
421 --
422   l_proc	varchar2(72) := g_package||'post_update';
423 --
424 Begin
425   hr_utility.set_location('Entering:'||l_proc, 5);
426 --
427   --
428   -- Start of API User Hook for post_update.
429   --
430   begin
431     --
432     ben_cct_rku.after_update
433       (p_cm_typ_id                     =>p_rec.cm_typ_id
434       ,p_effective_start_date          =>p_rec.effective_start_date
435       ,p_effective_end_date            =>p_rec.effective_end_date
436       ,p_name                          =>p_rec.name
437       ,p_desc_txt                      =>p_rec.desc_txt
438       ,p_cm_typ_rl                     =>p_rec.cm_typ_rl
439       ,p_cm_usg_cd                     =>p_rec.cm_usg_cd
440       ,p_whnvr_trgrd_flag              =>p_rec.whnvr_trgrd_flag
441       ,p_shrt_name                     =>p_rec.shrt_name
442       ,p_pc_kit_cd                     =>p_rec.pc_kit_cd
443       ,p_trk_mlg_flag                  =>p_rec.trk_mlg_flag
444       ,p_mx_num_avlbl_val              =>p_rec.mx_num_avlbl_val
445       ,p_to_be_sent_dt_cd              =>p_rec.to_be_sent_dt_cd
446       ,p_to_be_sent_dt_rl              =>p_rec.to_be_sent_dt_rl
447       ,p_inspn_rqd_flag                =>p_rec.inspn_rqd_flag
448       ,p_inspn_rqd_rl                  =>p_rec.inspn_rqd_rl
449       ,p_rcpent_cd                     =>p_rec.rcpent_cd
450       ,p_parnt_cm_typ_id               =>p_rec.parnt_cm_typ_id
451       ,p_business_group_id             =>p_rec.business_group_id
452       ,p_cct_attribute_category        =>p_rec.cct_attribute_category
453       ,p_cct_attribute1                =>p_rec.cct_attribute1
454       ,p_cct_attribute10               =>p_rec.cct_attribute10
455       ,p_cct_attribute11               =>p_rec.cct_attribute11
456       ,p_cct_attribute12               =>p_rec.cct_attribute12
457       ,p_cct_attribute13               =>p_rec.cct_attribute13
458       ,p_cct_attribute14               =>p_rec.cct_attribute14
459       ,p_cct_attribute15               =>p_rec.cct_attribute15
460       ,p_cct_attribute16               =>p_rec.cct_attribute16
461       ,p_cct_attribute17               =>p_rec.cct_attribute17
462       ,p_cct_attribute18               =>p_rec.cct_attribute18
463       ,p_cct_attribute19               =>p_rec.cct_attribute19
464       ,p_cct_attribute2                =>p_rec.cct_attribute2
465       ,p_cct_attribute20               =>p_rec.cct_attribute20
466       ,p_cct_attribute21               =>p_rec.cct_attribute21
467       ,p_cct_attribute22               =>p_rec.cct_attribute22
468       ,p_cct_attribute23               =>p_rec.cct_attribute23
469       ,p_cct_attribute24               =>p_rec.cct_attribute24
470       ,p_cct_attribute25               =>p_rec.cct_attribute25
471       ,p_cct_attribute26               =>p_rec.cct_attribute26
472       ,p_cct_attribute27               =>p_rec.cct_attribute27
473       ,p_cct_attribute28               =>p_rec.cct_attribute28
474       ,p_cct_attribute29               =>p_rec.cct_attribute29
475       ,p_cct_attribute3                =>p_rec.cct_attribute3
476       ,p_cct_attribute30               =>p_rec.cct_attribute30
477       ,p_cct_attribute4                =>p_rec.cct_attribute4
478       ,p_cct_attribute5                =>p_rec.cct_attribute5
479       ,p_cct_attribute6                =>p_rec.cct_attribute6
480       ,p_cct_attribute7                =>p_rec.cct_attribute7
481       ,p_cct_attribute8                =>p_rec.cct_attribute8
482       ,p_cct_attribute9                =>p_rec.cct_attribute9
483       ,p_object_version_number         =>p_rec.object_version_number
484       ,p_effective_date                =>p_effective_date
485       ,p_datetrack_mode                =>p_datetrack_mode
486       ,p_validation_start_date         =>p_validation_start_date
487       ,p_validation_end_date           =>p_validation_end_date
488       ,p_effective_start_date_o        =>ben_cct_shd.g_old_rec.effective_start_date
489       ,p_effective_end_date_o          =>ben_cct_shd.g_old_rec.effective_end_date
490       ,p_name_o                        =>ben_cct_shd.g_old_rec.name
491       ,p_desc_txt_o                    =>ben_cct_shd.g_old_rec.desc_txt
492       ,p_cm_typ_rl_o                   =>ben_cct_shd.g_old_rec.cm_typ_rl
493       ,p_cm_usg_cd_o                   =>ben_cct_shd.g_old_rec.cm_usg_cd
494       ,p_whnvr_trgrd_flag_o            =>ben_cct_shd.g_old_rec.whnvr_trgrd_flag
495       ,p_shrt_name_o                   =>ben_cct_shd.g_old_rec.shrt_name
496       ,p_pc_kit_cd_o                   =>ben_cct_shd.g_old_rec.pc_kit_cd
497       ,p_trk_mlg_flag_o                =>ben_cct_shd.g_old_rec.trk_mlg_flag
498       ,p_mx_num_avlbl_val_o            =>ben_cct_shd.g_old_rec.mx_num_avlbl_val
499       ,p_to_be_sent_dt_cd_o            =>ben_cct_shd.g_old_rec.to_be_sent_dt_cd
500       ,p_to_be_sent_dt_rl_o            =>ben_cct_shd.g_old_rec.to_be_sent_dt_rl
501       ,p_inspn_rqd_flag_o              =>ben_cct_shd.g_old_rec.inspn_rqd_flag
502       ,p_inspn_rqd_rl_o                =>ben_cct_shd.g_old_rec.inspn_rqd_rl
503       ,p_rcpent_cd_o                   =>ben_cct_shd.g_old_rec.rcpent_cd
504       ,p_parnt_cm_typ_id_o             =>ben_cct_shd.g_old_rec.parnt_cm_typ_id
505       ,p_business_group_id_o           =>ben_cct_shd.g_old_rec.business_group_id
506       ,p_cct_attribute_category_o      =>ben_cct_shd.g_old_rec.cct_attribute_category
507       ,p_cct_attribute1_o              =>ben_cct_shd.g_old_rec.cct_attribute1
508       ,p_cct_attribute10_o             =>ben_cct_shd.g_old_rec.cct_attribute10
509       ,p_cct_attribute11_o             =>ben_cct_shd.g_old_rec.cct_attribute11
510       ,p_cct_attribute12_o             =>ben_cct_shd.g_old_rec.cct_attribute12
511       ,p_cct_attribute13_o             =>ben_cct_shd.g_old_rec.cct_attribute13
512       ,p_cct_attribute14_o             =>ben_cct_shd.g_old_rec.cct_attribute14
513       ,p_cct_attribute15_o             =>ben_cct_shd.g_old_rec.cct_attribute15
514       ,p_cct_attribute16_o             =>ben_cct_shd.g_old_rec.cct_attribute16
515       ,p_cct_attribute17_o             =>ben_cct_shd.g_old_rec.cct_attribute17
516       ,p_cct_attribute18_o             =>ben_cct_shd.g_old_rec.cct_attribute18
517       ,p_cct_attribute19_o             =>ben_cct_shd.g_old_rec.cct_attribute19
518       ,p_cct_attribute2_o              =>ben_cct_shd.g_old_rec.cct_attribute2
519       ,p_cct_attribute20_o             =>ben_cct_shd.g_old_rec.cct_attribute20
520       ,p_cct_attribute21_o             =>ben_cct_shd.g_old_rec.cct_attribute21
521       ,p_cct_attribute22_o             =>ben_cct_shd.g_old_rec.cct_attribute22
522       ,p_cct_attribute23_o             =>ben_cct_shd.g_old_rec.cct_attribute23
523       ,p_cct_attribute24_o             =>ben_cct_shd.g_old_rec.cct_attribute24
524       ,p_cct_attribute25_o             =>ben_cct_shd.g_old_rec.cct_attribute25
525       ,p_cct_attribute26_o             =>ben_cct_shd.g_old_rec.cct_attribute26
526       ,p_cct_attribute27_o             =>ben_cct_shd.g_old_rec.cct_attribute27
527       ,p_cct_attribute28_o             =>ben_cct_shd.g_old_rec.cct_attribute28
528       ,p_cct_attribute29_o             =>ben_cct_shd.g_old_rec.cct_attribute29
529       ,p_cct_attribute3_o              =>ben_cct_shd.g_old_rec.cct_attribute3
530       ,p_cct_attribute30_o             =>ben_cct_shd.g_old_rec.cct_attribute30
531       ,p_cct_attribute4_o              =>ben_cct_shd.g_old_rec.cct_attribute4
532       ,p_cct_attribute5_o              =>ben_cct_shd.g_old_rec.cct_attribute5
533       ,p_cct_attribute6_o              =>ben_cct_shd.g_old_rec.cct_attribute6
534       ,p_cct_attribute7_o              =>ben_cct_shd.g_old_rec.cct_attribute7
535       ,p_cct_attribute8_o              =>ben_cct_shd.g_old_rec.cct_attribute8
536       ,p_cct_attribute9_o              =>ben_cct_shd.g_old_rec.cct_attribute9
537       ,p_object_version_number_o       =>ben_cct_shd.g_old_rec.object_version_number);
538     --
539   exception
540     --
541     when hr_api.cannot_find_prog_unit then
542       --
543       hr_api.cannot_find_prog_unit_error
544         (p_module_name => 'ben_cm_typ_f'
545         ,p_hook_type   => 'AU');
546       --
547   end;
548   --
549   -- End of API User Hook for post_update.
550   --
551   --
552   hr_utility.set_location(' Leaving:'||l_proc, 10);
553 End post_update;
554 --
555 -- ----------------------------------------------------------------------------
556 -- |-----------------------------< convert_defs >-----------------------------|
557 -- ----------------------------------------------------------------------------
558 -- {Start Of Comments}
559 --
560 -- Description:
561 --   The Convert_Defs procedure has one very important function:
562 --   It must return the record structure for the row with all system defaulted
563 --   values converted into its corresponding parameter value for update. When
564 --   we attempt to update a row through the Upd process , certain
565 --   parameters can be defaulted which enables flexibility in the calling of
566 --   the upd process (e.g. only attributes which need to be updated need to be
567 --   specified). For the upd process to determine which attributes
568 --   have NOT been specified we need to check if the parameter has a reserved
569 --   system default value. Therefore, for all parameters which have a
570 --   corresponding reserved system default mechanism specified we need to
571 --   check if a system default is being used. If a system default is being
572 --   used then we convert the defaulted value into its corresponding attribute
573 --   value held in the g_old_rec data structure.
574 --
575 -- Prerequisites:
576 --   This private function can only be called from the upd process.
577 --
578 -- In Parameters:
579 --   A Pl/Sql record structre.
580 --
581 -- Post Success:
582 --   The record structure will be returned with all system defaulted parameter
583 --   values converted into its current row attribute value.
584 --
585 -- Post Failure:
586 --   No direct error handling is required within this function. Any possible
587 --   errors within this procedure will be a PL/SQL value error due to conversion
588 --   of datatypes or data lengths.
589 --
590 -- Developer Implementation Notes:
591 --   None.
592 --
593 -- Access Status:
594 --   Internal Row Handler Use Only.
595 --
596 -- {End Of Comments}
597 -- ----------------------------------------------------------------------------
598 Procedure convert_defs(p_rec in out nocopy ben_cct_shd.g_rec_type) is
599 --
600   l_proc  varchar2(72) := g_package||'convert_defs';
601 --
602 Begin
603   --
604   hr_utility.set_location('Entering:'||l_proc, 5);
605   --
606   -- We must now examine each argument value in the
607   -- p_rec plsql record structure
608   -- to see if a system default is being used. If a system default
609   -- is being used then we must set to the 'current' argument value.
610   --
611   If (p_rec.name = hr_api.g_varchar2) then
612     p_rec.name :=
613     ben_cct_shd.g_old_rec.name;
614   End If;
615   If (p_rec.desc_txt = hr_api.g_varchar2) then
616     p_rec.desc_txt :=
617     ben_cct_shd.g_old_rec.desc_txt;
618   End If;
619   If (p_rec.cm_typ_rl = hr_api.g_number) then
620     p_rec.cm_typ_rl :=
621     ben_cct_shd.g_old_rec.cm_typ_rl;
622   End If;
623   If (p_rec.cm_usg_cd = hr_api.g_varchar2) then
624     p_rec.cm_usg_cd :=
625     ben_cct_shd.g_old_rec.cm_usg_cd;
626   End If;
627   If (p_rec.whnvr_trgrd_flag = hr_api.g_varchar2) then
628     p_rec.whnvr_trgrd_flag :=
629     ben_cct_shd.g_old_rec.whnvr_trgrd_flag;
630   End If;
631   If (p_rec.shrt_name = hr_api.g_varchar2) then
632     p_rec.shrt_name :=
633     ben_cct_shd.g_old_rec.shrt_name;
634   End If;
635   If (p_rec.pc_kit_cd = hr_api.g_varchar2) then
636     p_rec.pc_kit_cd :=
637     ben_cct_shd.g_old_rec.pc_kit_cd;
638   End If;
639   If (p_rec.trk_mlg_flag = hr_api.g_varchar2) then
640     p_rec.trk_mlg_flag :=
641     ben_cct_shd.g_old_rec.trk_mlg_flag;
642   End If;
643   If (p_rec.mx_num_avlbl_val = hr_api.g_number) then
644     p_rec.mx_num_avlbl_val :=
645     ben_cct_shd.g_old_rec.mx_num_avlbl_val;
646   End If;
647   If (p_rec.to_be_sent_dt_cd = hr_api.g_varchar2) then
648     p_rec.to_be_sent_dt_cd :=
649     ben_cct_shd.g_old_rec.to_be_sent_dt_cd;
650   End If;
651   If (p_rec.to_be_sent_dt_rl = hr_api.g_number) then
652     p_rec.to_be_sent_dt_rl :=
653     ben_cct_shd.g_old_rec.to_be_sent_dt_rl;
654   End If;
655   If (p_rec.inspn_rqd_flag = hr_api.g_varchar2) then
656     p_rec.inspn_rqd_flag :=
657     ben_cct_shd.g_old_rec.inspn_rqd_flag;
658   End If;
659   If (p_rec.inspn_rqd_rl = hr_api.g_number) then
660     p_rec.inspn_rqd_rl :=
661     ben_cct_shd.g_old_rec.inspn_rqd_rl;
662   End If;
663   If (p_rec.rcpent_cd = hr_api.g_varchar2) then
664     p_rec.rcpent_cd :=
665     ben_cct_shd.g_old_rec.rcpent_cd;
666   End If;
667   If (p_rec.parnt_cm_typ_id = hr_api.g_number) then
668     p_rec.parnt_cm_typ_id :=
669     ben_cct_shd.g_old_rec.parnt_cm_typ_id;
670   End If;
671   If (p_rec.business_group_id = hr_api.g_number) then
672     p_rec.business_group_id :=
673     ben_cct_shd.g_old_rec.business_group_id;
674   End If;
675   If (p_rec.cct_attribute_category = hr_api.g_varchar2) then
676     p_rec.cct_attribute_category :=
677     ben_cct_shd.g_old_rec.cct_attribute_category;
678   End If;
679   If (p_rec.cct_attribute1 = hr_api.g_varchar2) then
680     p_rec.cct_attribute1 :=
681     ben_cct_shd.g_old_rec.cct_attribute1;
682   End If;
683   If (p_rec.cct_attribute10 = hr_api.g_varchar2) then
684     p_rec.cct_attribute10 :=
685     ben_cct_shd.g_old_rec.cct_attribute10;
686   End If;
687   If (p_rec.cct_attribute11 = hr_api.g_varchar2) then
688     p_rec.cct_attribute11 :=
689     ben_cct_shd.g_old_rec.cct_attribute11;
690   End If;
691   If (p_rec.cct_attribute12 = hr_api.g_varchar2) then
692     p_rec.cct_attribute12 :=
693     ben_cct_shd.g_old_rec.cct_attribute12;
694   End If;
695   If (p_rec.cct_attribute13 = hr_api.g_varchar2) then
696     p_rec.cct_attribute13 :=
697     ben_cct_shd.g_old_rec.cct_attribute13;
698   End If;
699   If (p_rec.cct_attribute14 = hr_api.g_varchar2) then
700     p_rec.cct_attribute14 :=
701     ben_cct_shd.g_old_rec.cct_attribute14;
702   End If;
703   If (p_rec.cct_attribute15 = hr_api.g_varchar2) then
704     p_rec.cct_attribute15 :=
705     ben_cct_shd.g_old_rec.cct_attribute15;
706   End If;
707   If (p_rec.cct_attribute16 = hr_api.g_varchar2) then
708     p_rec.cct_attribute16 :=
709     ben_cct_shd.g_old_rec.cct_attribute16;
710   End If;
711   If (p_rec.cct_attribute17 = hr_api.g_varchar2) then
712     p_rec.cct_attribute17 :=
713     ben_cct_shd.g_old_rec.cct_attribute17;
714   End If;
715   If (p_rec.cct_attribute18 = hr_api.g_varchar2) then
716     p_rec.cct_attribute18 :=
717     ben_cct_shd.g_old_rec.cct_attribute18;
718   End If;
719   If (p_rec.cct_attribute19 = hr_api.g_varchar2) then
720     p_rec.cct_attribute19 :=
721     ben_cct_shd.g_old_rec.cct_attribute19;
722   End If;
723   If (p_rec.cct_attribute2 = hr_api.g_varchar2) then
724     p_rec.cct_attribute2 :=
725     ben_cct_shd.g_old_rec.cct_attribute2;
726   End If;
727   If (p_rec.cct_attribute20 = hr_api.g_varchar2) then
728     p_rec.cct_attribute20 :=
729     ben_cct_shd.g_old_rec.cct_attribute20;
730   End If;
731   If (p_rec.cct_attribute21 = hr_api.g_varchar2) then
732     p_rec.cct_attribute21 :=
733     ben_cct_shd.g_old_rec.cct_attribute21;
734   End If;
735   If (p_rec.cct_attribute22 = hr_api.g_varchar2) then
736     p_rec.cct_attribute22 :=
737     ben_cct_shd.g_old_rec.cct_attribute22;
738   End If;
739   If (p_rec.cct_attribute23 = hr_api.g_varchar2) then
740     p_rec.cct_attribute23 :=
741     ben_cct_shd.g_old_rec.cct_attribute23;
742   End If;
743   If (p_rec.cct_attribute24 = hr_api.g_varchar2) then
744     p_rec.cct_attribute24 :=
745     ben_cct_shd.g_old_rec.cct_attribute24;
746   End If;
747   If (p_rec.cct_attribute25 = hr_api.g_varchar2) then
748     p_rec.cct_attribute25 :=
749     ben_cct_shd.g_old_rec.cct_attribute25;
750   End If;
751   If (p_rec.cct_attribute26 = hr_api.g_varchar2) then
752     p_rec.cct_attribute26 :=
753     ben_cct_shd.g_old_rec.cct_attribute26;
754   End If;
755   If (p_rec.cct_attribute27 = hr_api.g_varchar2) then
756     p_rec.cct_attribute27 :=
757     ben_cct_shd.g_old_rec.cct_attribute27;
758   End If;
759   If (p_rec.cct_attribute28 = hr_api.g_varchar2) then
760     p_rec.cct_attribute28 :=
761     ben_cct_shd.g_old_rec.cct_attribute28;
762   End If;
763   If (p_rec.cct_attribute29 = hr_api.g_varchar2) then
764     p_rec.cct_attribute29 :=
765     ben_cct_shd.g_old_rec.cct_attribute29;
766   End If;
767   If (p_rec.cct_attribute3 = hr_api.g_varchar2) then
768     p_rec.cct_attribute3 :=
769     ben_cct_shd.g_old_rec.cct_attribute3;
770   End If;
771   If (p_rec.cct_attribute30 = hr_api.g_varchar2) then
772     p_rec.cct_attribute30 :=
773     ben_cct_shd.g_old_rec.cct_attribute30;
774   End If;
775   If (p_rec.cct_attribute4 = hr_api.g_varchar2) then
776     p_rec.cct_attribute4 :=
777     ben_cct_shd.g_old_rec.cct_attribute4;
778   End If;
779   If (p_rec.cct_attribute5 = hr_api.g_varchar2) then
780     p_rec.cct_attribute5 :=
781     ben_cct_shd.g_old_rec.cct_attribute5;
782   End If;
783   If (p_rec.cct_attribute6 = hr_api.g_varchar2) then
784     p_rec.cct_attribute6 :=
785     ben_cct_shd.g_old_rec.cct_attribute6;
786   End If;
787   If (p_rec.cct_attribute7 = hr_api.g_varchar2) then
788     p_rec.cct_attribute7 :=
789     ben_cct_shd.g_old_rec.cct_attribute7;
790   End If;
791   If (p_rec.cct_attribute8 = hr_api.g_varchar2) then
792     p_rec.cct_attribute8 :=
793     ben_cct_shd.g_old_rec.cct_attribute8;
794   End If;
795   If (p_rec.cct_attribute9 = hr_api.g_varchar2) then
796     p_rec.cct_attribute9 :=
797     ben_cct_shd.g_old_rec.cct_attribute9;
798   End If;
799   --
800   hr_utility.set_location(' Leaving:'||l_proc, 10);
801 --
802 End convert_defs;
803 --
804 -- ----------------------------------------------------------------------------
805 -- |---------------------------------< upd >----------------------------------|
806 -- ----------------------------------------------------------------------------
807 Procedure upd
808   (
809   p_rec			in out nocopy 	ben_cct_shd.g_rec_type,
810   p_effective_date	in 	date,
811   p_datetrack_mode	in 	varchar2
812   ) is
813 --
814   l_proc			varchar2(72) := g_package||'upd';
815   l_validation_start_date	date;
816   l_validation_end_date		date;
817 --
818 Begin
819   hr_utility.set_location('Entering:'||l_proc, 5);
820   --
821   -- Ensure that the DateTrack update mode is valid
822   --
823   dt_api.validate_dt_upd_mode(p_datetrack_mode => p_datetrack_mode);
824   --
825   -- We must lock the row which we need to update.
826   --
827   ben_cct_shd.lck
828 	(p_effective_date	 => p_effective_date,
829       	 p_datetrack_mode	 => p_datetrack_mode,
830       	 p_cm_typ_id	 => p_rec.cm_typ_id,
831       	 p_object_version_number => p_rec.object_version_number,
832       	 p_validation_start_date => l_validation_start_date,
833       	 p_validation_end_date	 => l_validation_end_date);
834   --
835   -- 1. During an update system defaults are used to determine if
836   --    arguments have been defaulted or not. We must therefore
837   --    derive the full record structure values to be updated.
838   --
839   -- 2. Call the supporting update validate operations.
840   --
841   convert_defs(p_rec);
842   ben_cct_bus.update_validate
843 	(p_rec			 => p_rec,
844 	 p_effective_date	 => p_effective_date,
845 	 p_datetrack_mode  	 => p_datetrack_mode,
846 	 p_validation_start_date => l_validation_start_date,
847 	 p_validation_end_date	 => l_validation_end_date);
848   --
849   -- Call the supporting pre-update operation
850   --
851   pre_update
852 	(p_rec			 => p_rec,
853 	 p_effective_date	 => p_effective_date,
854 	 p_datetrack_mode	 => p_datetrack_mode,
855 	 p_validation_start_date => l_validation_start_date,
856 	 p_validation_end_date	 => l_validation_end_date);
857   --
858   -- Update the row.
859   --
860   update_dml
861 	(p_rec			 => p_rec,
862 	 p_effective_date	 => p_effective_date,
863 	 p_datetrack_mode	 => p_datetrack_mode,
864 	 p_validation_start_date => l_validation_start_date,
865 	 p_validation_end_date	 => l_validation_end_date);
866   --
867   -- Call the supporting post-update operation
868   --
869   post_update
870 	(p_rec			 => p_rec,
871 	 p_effective_date	 => p_effective_date,
872 	 p_datetrack_mode	 => p_datetrack_mode,
873 	 p_validation_start_date => l_validation_start_date,
874 	 p_validation_end_date	 => l_validation_end_date);
875 End upd;
876 --
877 -- ----------------------------------------------------------------------------
878 -- |---------------------------------< upd >----------------------------------|
879 -- ----------------------------------------------------------------------------
880 Procedure upd
881   (
882   p_cm_typ_id                    in number,
883   p_effective_start_date         out nocopy date,
884   p_effective_end_date           out nocopy date,
885   p_name                         in varchar2         default hr_api.g_varchar2,
886   p_desc_txt                     in varchar2         default hr_api.g_varchar2,
887   p_cm_typ_rl                    in number           default hr_api.g_number,
888   p_cm_usg_cd                    in varchar2         default hr_api.g_varchar2,
889   p_whnvr_trgrd_flag             in varchar2         default hr_api.g_varchar2,
890   p_shrt_name                    in varchar2         default hr_api.g_varchar2,
891   p_pc_kit_cd                    in varchar2         default hr_api.g_varchar2,
892   p_trk_mlg_flag                 in varchar2         default hr_api.g_varchar2,
893   p_mx_num_avlbl_val             in number           default hr_api.g_number,
894   p_to_be_sent_dt_cd             in varchar2         default hr_api.g_varchar2,
895   p_to_be_sent_dt_rl             in number           default hr_api.g_number,
896   p_inspn_rqd_flag               in varchar2         default hr_api.g_varchar2,
897   p_inspn_rqd_rl                 in number           default hr_api.g_number,
898   p_rcpent_cd                    in varchar2         default hr_api.g_varchar2,
899   p_parnt_cm_typ_id              in number           default hr_api.g_number,
900   p_business_group_id            in number           default hr_api.g_number,
901   p_cct_attribute_category       in varchar2         default hr_api.g_varchar2,
902   p_cct_attribute1               in varchar2         default hr_api.g_varchar2,
903   p_cct_attribute10              in varchar2         default hr_api.g_varchar2,
904   p_cct_attribute11              in varchar2         default hr_api.g_varchar2,
905   p_cct_attribute12              in varchar2         default hr_api.g_varchar2,
906   p_cct_attribute13              in varchar2         default hr_api.g_varchar2,
907   p_cct_attribute14              in varchar2         default hr_api.g_varchar2,
908   p_cct_attribute15              in varchar2         default hr_api.g_varchar2,
909   p_cct_attribute16              in varchar2         default hr_api.g_varchar2,
910   p_cct_attribute17              in varchar2         default hr_api.g_varchar2,
911   p_cct_attribute18              in varchar2         default hr_api.g_varchar2,
912   p_cct_attribute19              in varchar2         default hr_api.g_varchar2,
913   p_cct_attribute2               in varchar2         default hr_api.g_varchar2,
914   p_cct_attribute20              in varchar2         default hr_api.g_varchar2,
915   p_cct_attribute21              in varchar2         default hr_api.g_varchar2,
916   p_cct_attribute22              in varchar2         default hr_api.g_varchar2,
917   p_cct_attribute23              in varchar2         default hr_api.g_varchar2,
918   p_cct_attribute24              in varchar2         default hr_api.g_varchar2,
919   p_cct_attribute25              in varchar2         default hr_api.g_varchar2,
920   p_cct_attribute26              in varchar2         default hr_api.g_varchar2,
921   p_cct_attribute27              in varchar2         default hr_api.g_varchar2,
922   p_cct_attribute28              in varchar2         default hr_api.g_varchar2,
923   p_cct_attribute29              in varchar2         default hr_api.g_varchar2,
924   p_cct_attribute3               in varchar2         default hr_api.g_varchar2,
925   p_cct_attribute30              in varchar2         default hr_api.g_varchar2,
926   p_cct_attribute4               in varchar2         default hr_api.g_varchar2,
927   p_cct_attribute5               in varchar2         default hr_api.g_varchar2,
928   p_cct_attribute6               in varchar2         default hr_api.g_varchar2,
929   p_cct_attribute7               in varchar2         default hr_api.g_varchar2,
930   p_cct_attribute8               in varchar2         default hr_api.g_varchar2,
931   p_cct_attribute9               in varchar2         default hr_api.g_varchar2,
932   p_object_version_number        in out nocopy number,
933   p_effective_date		 in date,
934   p_datetrack_mode		 in varchar2
935   ) is
936 --
937   l_rec		ben_cct_shd.g_rec_type;
938   l_proc	varchar2(72) := g_package||'upd';
939 --
940 Begin
941   hr_utility.set_location('Entering:'||l_proc, 5);
942   --
943   -- Call conversion function to turn arguments into the
944   -- l_rec structure.
945   --
946   l_rec :=
947   ben_cct_shd.convert_args
948   (
949   p_cm_typ_id,
950   null,
951   null,
952   p_name,
953   p_desc_txt,
954   p_cm_typ_rl,
955   p_cm_usg_cd,
956   p_whnvr_trgrd_flag,
957   p_shrt_name,
958   p_pc_kit_cd,
959   p_trk_mlg_flag,
960   p_mx_num_avlbl_val,
961   p_to_be_sent_dt_cd,
962   p_to_be_sent_dt_rl,
963   p_inspn_rqd_flag,
964   p_inspn_rqd_rl,
965   p_rcpent_cd,
966   p_parnt_cm_typ_id,
967   p_business_group_id,
968   p_cct_attribute_category,
969   p_cct_attribute1,
970   p_cct_attribute10,
971   p_cct_attribute11,
972   p_cct_attribute12,
973   p_cct_attribute13,
974   p_cct_attribute14,
975   p_cct_attribute15,
976   p_cct_attribute16,
977   p_cct_attribute17,
978   p_cct_attribute18,
979   p_cct_attribute19,
980   p_cct_attribute2,
981   p_cct_attribute20,
982   p_cct_attribute21,
983   p_cct_attribute22,
984   p_cct_attribute23,
985   p_cct_attribute24,
986   p_cct_attribute25,
987   p_cct_attribute26,
988   p_cct_attribute27,
989   p_cct_attribute28,
990   p_cct_attribute29,
991   p_cct_attribute3,
992   p_cct_attribute30,
993   p_cct_attribute4,
994   p_cct_attribute5,
995   p_cct_attribute6,
996   p_cct_attribute7,
997   p_cct_attribute8,
998   p_cct_attribute9,
999   p_object_version_number
1000   );
1001   --
1002   -- Having converted the arguments into the
1003   -- plsql record structure we call the corresponding record
1004   -- business process.
1005   --
1006   upd(l_rec, p_effective_date, p_datetrack_mode);
1007   p_object_version_number       := l_rec.object_version_number;
1008   p_effective_start_date        := l_rec.effective_start_date;
1009   p_effective_end_date          := l_rec.effective_end_date;
1010   --
1011   --
1012   hr_utility.set_location(' Leaving:'||l_proc, 10);
1013 End upd;
1014 --
1015 end ben_cct_upd;