DBA Data[Home] [Help]

PACKAGE BODY: APPS.BEN_BVR_UPD

Source


1 Package Body ben_bvr_upd as
2 /* $Header: bebvrrhi.pkb 120.0 2005/05/28 00:54:44 appldev noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33)	:= '  ben_bvr_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_bvr_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_bnft_vrbl_rt_f',
78 	   p_base_key_column	=> 'bnft_vrbl_rt_id',
79 	   p_base_key_value	=> p_rec.bnft_vrbl_rt_id);
80     --
81     ben_bvr_shd.g_api_dml := true;  -- Set the api dml status
82     --
83     -- Update the ben_bnft_vrbl_rt_f Row
84     --
85     update  ben_bnft_vrbl_rt_f
86     set
87         bnft_vrbl_rt_id                 = p_rec.bnft_vrbl_rt_id,
88     cvg_amt_calc_mthd_id            = p_rec.cvg_amt_calc_mthd_id,
89     vrbl_rt_prfl_id                 = p_rec.vrbl_rt_prfl_id,
90     business_group_id               = p_rec.business_group_id,
91     bvr_attribute_category          = p_rec.bvr_attribute_category,
92     bvr_attribute1                  = p_rec.bvr_attribute1,
93     bvr_attribute2                  = p_rec.bvr_attribute2,
94     bvr_attribute3                  = p_rec.bvr_attribute3,
95     bvr_attribute4                  = p_rec.bvr_attribute4,
96     bvr_attribute5                  = p_rec.bvr_attribute5,
97     bvr_attribute6                  = p_rec.bvr_attribute6,
98     bvr_attribute7                  = p_rec.bvr_attribute7,
99     bvr_attribute8                  = p_rec.bvr_attribute8,
100     bvr_attribute9                  = p_rec.bvr_attribute9,
101     bvr_attribute10                 = p_rec.bvr_attribute10,
102     bvr_attribute11                 = p_rec.bvr_attribute11,
103     bvr_attribute12                 = p_rec.bvr_attribute12,
104     bvr_attribute13                 = p_rec.bvr_attribute13,
105     bvr_attribute14                 = p_rec.bvr_attribute14,
106     bvr_attribute15                 = p_rec.bvr_attribute15,
107     bvr_attribute16                 = p_rec.bvr_attribute16,
108     bvr_attribute17                 = p_rec.bvr_attribute17,
109     bvr_attribute18                 = p_rec.bvr_attribute18,
110     bvr_attribute19                 = p_rec.bvr_attribute19,
111     bvr_attribute20                 = p_rec.bvr_attribute20,
112     bvr_attribute21                 = p_rec.bvr_attribute21,
113     bvr_attribute22                 = p_rec.bvr_attribute22,
114     bvr_attribute23                 = p_rec.bvr_attribute23,
115     bvr_attribute24                 = p_rec.bvr_attribute24,
116     bvr_attribute25                 = p_rec.bvr_attribute25,
117     bvr_attribute26                 = p_rec.bvr_attribute26,
118     bvr_attribute27                 = p_rec.bvr_attribute27,
119     bvr_attribute28                 = p_rec.bvr_attribute28,
120     bvr_attribute29                 = p_rec.bvr_attribute29,
121     bvr_attribute30                 = p_rec.bvr_attribute30,
122     object_version_number           = p_rec.object_version_number,
123     ordr_num                        = p_rec.ordr_num
124     where   bnft_vrbl_rt_id = p_rec.bnft_vrbl_rt_id
125     and     effective_start_date = p_validation_start_date
126     and     effective_end_date   = p_validation_end_date;
127     --
128     ben_bvr_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_bvr_shd.g_api_dml := false;   -- Unset the api dml status
141     ben_bvr_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_bvr_shd.g_api_dml := false;   -- Unset the api dml status
146     ben_bvr_shd.constraint_error
147       (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
148   When Others Then
149     ben_bvr_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_bvr_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_bvr_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_bvr_shd.upd_effective_end_date
266      (p_effective_date	       => p_effective_date,
267       p_base_key_value	       => p_rec.bnft_vrbl_rt_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_bvr_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_bvr_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_bvr_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_bvr_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_bvr_rku.after_update
407       (
408   p_bnft_vrbl_rt_id               =>p_rec.bnft_vrbl_rt_id
409  ,p_effective_start_date          =>p_rec.effective_start_date
410  ,p_effective_end_date            =>p_rec.effective_end_date
411  ,p_cvg_amt_calc_mthd_id          =>p_rec.cvg_amt_calc_mthd_id
412  ,p_vrbl_rt_prfl_id               =>p_rec.vrbl_rt_prfl_id
413  ,p_business_group_id             =>p_rec.business_group_id
414  ,p_bvr_attribute_category        =>p_rec.bvr_attribute_category
415  ,p_bvr_attribute1                =>p_rec.bvr_attribute1
416  ,p_bvr_attribute2                =>p_rec.bvr_attribute2
417  ,p_bvr_attribute3                =>p_rec.bvr_attribute3
418  ,p_bvr_attribute4                =>p_rec.bvr_attribute4
419  ,p_bvr_attribute5                =>p_rec.bvr_attribute5
420  ,p_bvr_attribute6                =>p_rec.bvr_attribute6
421  ,p_bvr_attribute7                =>p_rec.bvr_attribute7
422  ,p_bvr_attribute8                =>p_rec.bvr_attribute8
423  ,p_bvr_attribute9                =>p_rec.bvr_attribute9
424  ,p_bvr_attribute10               =>p_rec.bvr_attribute10
425  ,p_bvr_attribute11               =>p_rec.bvr_attribute11
426  ,p_bvr_attribute12               =>p_rec.bvr_attribute12
427  ,p_bvr_attribute13               =>p_rec.bvr_attribute13
428  ,p_bvr_attribute14               =>p_rec.bvr_attribute14
429  ,p_bvr_attribute15               =>p_rec.bvr_attribute15
430  ,p_bvr_attribute16               =>p_rec.bvr_attribute16
431  ,p_bvr_attribute17               =>p_rec.bvr_attribute17
432  ,p_bvr_attribute18               =>p_rec.bvr_attribute18
433  ,p_bvr_attribute19               =>p_rec.bvr_attribute19
434  ,p_bvr_attribute20               =>p_rec.bvr_attribute20
435  ,p_bvr_attribute21               =>p_rec.bvr_attribute21
436  ,p_bvr_attribute22               =>p_rec.bvr_attribute22
437  ,p_bvr_attribute23               =>p_rec.bvr_attribute23
438  ,p_bvr_attribute24               =>p_rec.bvr_attribute24
439  ,p_bvr_attribute25               =>p_rec.bvr_attribute25
440  ,p_bvr_attribute26               =>p_rec.bvr_attribute26
441  ,p_bvr_attribute27               =>p_rec.bvr_attribute27
442  ,p_bvr_attribute28               =>p_rec.bvr_attribute28
443  ,p_bvr_attribute29               =>p_rec.bvr_attribute29
444  ,p_bvr_attribute30               =>p_rec.bvr_attribute30
445  ,p_object_version_number         =>p_rec.object_version_number
446  ,p_ordr_num                      =>p_rec.ordr_num
447  ,p_effective_date                =>p_effective_date
448  ,p_datetrack_mode                =>p_datetrack_mode
449  ,p_validation_start_date         =>p_validation_start_date
450  ,p_validation_end_date           =>p_validation_end_date
451  ,p_effective_start_date_o        =>ben_bvr_shd.g_old_rec.effective_start_date
452  ,p_effective_end_date_o          =>ben_bvr_shd.g_old_rec.effective_end_date
453  ,p_cvg_amt_calc_mthd_id_o        =>ben_bvr_shd.g_old_rec.cvg_amt_calc_mthd_id
454  ,p_vrbl_rt_prfl_id_o             =>ben_bvr_shd.g_old_rec.vrbl_rt_prfl_id
455  ,p_business_group_id_o           =>ben_bvr_shd.g_old_rec.business_group_id
456  ,p_bvr_attribute_category_o      =>ben_bvr_shd.g_old_rec.bvr_attribute_category
457  ,p_bvr_attribute1_o              =>ben_bvr_shd.g_old_rec.bvr_attribute1
458  ,p_bvr_attribute2_o              =>ben_bvr_shd.g_old_rec.bvr_attribute2
459  ,p_bvr_attribute3_o              =>ben_bvr_shd.g_old_rec.bvr_attribute3
460  ,p_bvr_attribute4_o              =>ben_bvr_shd.g_old_rec.bvr_attribute4
461  ,p_bvr_attribute5_o              =>ben_bvr_shd.g_old_rec.bvr_attribute5
462  ,p_bvr_attribute6_o              =>ben_bvr_shd.g_old_rec.bvr_attribute6
463  ,p_bvr_attribute7_o              =>ben_bvr_shd.g_old_rec.bvr_attribute7
464  ,p_bvr_attribute8_o              =>ben_bvr_shd.g_old_rec.bvr_attribute8
465  ,p_bvr_attribute9_o              =>ben_bvr_shd.g_old_rec.bvr_attribute9
466  ,p_bvr_attribute10_o             =>ben_bvr_shd.g_old_rec.bvr_attribute10
467  ,p_bvr_attribute11_o             =>ben_bvr_shd.g_old_rec.bvr_attribute11
468  ,p_bvr_attribute12_o             =>ben_bvr_shd.g_old_rec.bvr_attribute12
469  ,p_bvr_attribute13_o             =>ben_bvr_shd.g_old_rec.bvr_attribute13
470  ,p_bvr_attribute14_o             =>ben_bvr_shd.g_old_rec.bvr_attribute14
471  ,p_bvr_attribute15_o             =>ben_bvr_shd.g_old_rec.bvr_attribute15
472  ,p_bvr_attribute16_o             =>ben_bvr_shd.g_old_rec.bvr_attribute16
473  ,p_bvr_attribute17_o             =>ben_bvr_shd.g_old_rec.bvr_attribute17
474  ,p_bvr_attribute18_o             =>ben_bvr_shd.g_old_rec.bvr_attribute18
475  ,p_bvr_attribute19_o             =>ben_bvr_shd.g_old_rec.bvr_attribute19
476  ,p_bvr_attribute20_o             =>ben_bvr_shd.g_old_rec.bvr_attribute20
477  ,p_bvr_attribute21_o             =>ben_bvr_shd.g_old_rec.bvr_attribute21
478  ,p_bvr_attribute22_o             =>ben_bvr_shd.g_old_rec.bvr_attribute22
479  ,p_bvr_attribute23_o             =>ben_bvr_shd.g_old_rec.bvr_attribute23
480  ,p_bvr_attribute24_o             =>ben_bvr_shd.g_old_rec.bvr_attribute24
481  ,p_bvr_attribute25_o             =>ben_bvr_shd.g_old_rec.bvr_attribute25
482  ,p_bvr_attribute26_o             =>ben_bvr_shd.g_old_rec.bvr_attribute26
483  ,p_bvr_attribute27_o             =>ben_bvr_shd.g_old_rec.bvr_attribute27
484  ,p_bvr_attribute28_o             =>ben_bvr_shd.g_old_rec.bvr_attribute28
485  ,p_bvr_attribute29_o             =>ben_bvr_shd.g_old_rec.bvr_attribute29
486  ,p_bvr_attribute30_o             =>ben_bvr_shd.g_old_rec.bvr_attribute30
487  ,p_object_version_number_o       =>ben_bvr_shd.g_old_rec.object_version_number
488  ,p_ordr_num_o                    =>ben_bvr_shd.g_old_rec.ordr_num
489       );
490     --
491   exception
492     --
493     when hr_api.cannot_find_prog_unit then
494       --
495       hr_api.cannot_find_prog_unit_error
496         (p_module_name => 'ben_bnft_vrbl_rt_f'
497         ,p_hook_type   => 'AU');
498       --
499   end;
500   --
501   -- End of API User Hook for post_update.
502   --
503   --
504   hr_utility.set_location(' Leaving:'||l_proc, 10);
505 End post_update;
506 --
507 -- ----------------------------------------------------------------------------
508 -- |-----------------------------< convert_defs >-----------------------------|
509 -- ----------------------------------------------------------------------------
510 -- {Start Of Comments}
511 --
512 -- Description:
513 --   The Convert_Defs procedure has one very important function:
514 --   It must return the record structure for the row with all system defaulted
515 --   values converted into its corresponding parameter value for update. When
516 --   we attempt to update a row through the Upd process , certain
517 --   parameters can be defaulted which enables flexibility in the calling of
518 --   the upd process (e.g. only attributes which need to be updated need to be
519 --   specified). For the upd process to determine which attributes
520 --   have NOT been specified we need to check if the parameter has a reserved
521 --   system default value. Therefore, for all parameters which have a
522 --   corresponding reserved system default mechanism specified we need to
523 --   check if a system default is being used. If a system default is being
524 --   used then we convert the defaulted value into its corresponding attribute
525 --   value held in the g_old_rec data structure.
526 --
527 -- Prerequisites:
528 --   This private function can only be called from the upd process.
529 --
530 -- In Parameters:
531 --   A Pl/Sql record structre.
532 --
533 -- Post Success:
534 --   The record structure will be returned with all system defaulted parameter
535 --   values converted into its current row attribute value.
536 --
537 -- Post Failure:
538 --   No direct error handling is required within this function. Any possible
539 --   errors within this procedure will be a PL/SQL value error due to conversion
540 --   of datatypes or data lengths.
541 --
542 -- Developer Implementation Notes:
543 --   None.
544 --
545 -- Access Status:
546 --   Internal Row Handler Use Only.
547 --
548 -- {End Of Comments}
549 -- ----------------------------------------------------------------------------
550 Procedure convert_defs(p_rec in out nocopy ben_bvr_shd.g_rec_type) is
551 --
552   l_proc  varchar2(72) := g_package||'convert_defs';
553 --
554 Begin
555   --
556   hr_utility.set_location('Entering:'||l_proc, 5);
557   --
558   -- We must now examine each argument value in the
559   -- p_rec plsql record structure
560   -- to see if a system default is being used. If a system default
561   -- is being used then we must set to the 'current' argument value.
562   --
563   If (p_rec.cvg_amt_calc_mthd_id = hr_api.g_number) then
564     p_rec.cvg_amt_calc_mthd_id :=
565     ben_bvr_shd.g_old_rec.cvg_amt_calc_mthd_id;
566   End If;
567   If (p_rec.vrbl_rt_prfl_id = hr_api.g_number) then
568     p_rec.vrbl_rt_prfl_id :=
569     ben_bvr_shd.g_old_rec.vrbl_rt_prfl_id;
570   End If;
571   If (p_rec.business_group_id = hr_api.g_number) then
572     p_rec.business_group_id :=
573     ben_bvr_shd.g_old_rec.business_group_id;
574   End If;
575   If (p_rec.bvr_attribute_category = hr_api.g_varchar2) then
576     p_rec.bvr_attribute_category :=
577     ben_bvr_shd.g_old_rec.bvr_attribute_category;
578   End If;
579   If (p_rec.bvr_attribute1 = hr_api.g_varchar2) then
580     p_rec.bvr_attribute1 :=
581     ben_bvr_shd.g_old_rec.bvr_attribute1;
582   End If;
583   If (p_rec.bvr_attribute2 = hr_api.g_varchar2) then
584     p_rec.bvr_attribute2 :=
585     ben_bvr_shd.g_old_rec.bvr_attribute2;
586   End If;
587   If (p_rec.bvr_attribute3 = hr_api.g_varchar2) then
588     p_rec.bvr_attribute3 :=
589     ben_bvr_shd.g_old_rec.bvr_attribute3;
590   End If;
591   If (p_rec.bvr_attribute4 = hr_api.g_varchar2) then
592     p_rec.bvr_attribute4 :=
593     ben_bvr_shd.g_old_rec.bvr_attribute4;
594   End If;
595   If (p_rec.bvr_attribute5 = hr_api.g_varchar2) then
596     p_rec.bvr_attribute5 :=
597     ben_bvr_shd.g_old_rec.bvr_attribute5;
598   End If;
599   If (p_rec.bvr_attribute6 = hr_api.g_varchar2) then
600     p_rec.bvr_attribute6 :=
601     ben_bvr_shd.g_old_rec.bvr_attribute6;
602   End If;
603   If (p_rec.bvr_attribute7 = hr_api.g_varchar2) then
604     p_rec.bvr_attribute7 :=
605     ben_bvr_shd.g_old_rec.bvr_attribute7;
606   End If;
607   If (p_rec.bvr_attribute8 = hr_api.g_varchar2) then
608     p_rec.bvr_attribute8 :=
609     ben_bvr_shd.g_old_rec.bvr_attribute8;
610   End If;
611   If (p_rec.bvr_attribute9 = hr_api.g_varchar2) then
612     p_rec.bvr_attribute9 :=
613     ben_bvr_shd.g_old_rec.bvr_attribute9;
614   End If;
615   If (p_rec.bvr_attribute10 = hr_api.g_varchar2) then
616     p_rec.bvr_attribute10 :=
617     ben_bvr_shd.g_old_rec.bvr_attribute10;
618   End If;
619   If (p_rec.bvr_attribute11 = hr_api.g_varchar2) then
620     p_rec.bvr_attribute11 :=
621     ben_bvr_shd.g_old_rec.bvr_attribute11;
622   End If;
623   If (p_rec.bvr_attribute12 = hr_api.g_varchar2) then
624     p_rec.bvr_attribute12 :=
625     ben_bvr_shd.g_old_rec.bvr_attribute12;
626   End If;
627   If (p_rec.bvr_attribute13 = hr_api.g_varchar2) then
628     p_rec.bvr_attribute13 :=
629     ben_bvr_shd.g_old_rec.bvr_attribute13;
630   End If;
631   If (p_rec.bvr_attribute14 = hr_api.g_varchar2) then
632     p_rec.bvr_attribute14 :=
633     ben_bvr_shd.g_old_rec.bvr_attribute14;
634   End If;
635   If (p_rec.bvr_attribute15 = hr_api.g_varchar2) then
636     p_rec.bvr_attribute15 :=
637     ben_bvr_shd.g_old_rec.bvr_attribute15;
638   End If;
639   If (p_rec.bvr_attribute16 = hr_api.g_varchar2) then
640     p_rec.bvr_attribute16 :=
641     ben_bvr_shd.g_old_rec.bvr_attribute16;
642   End If;
643   If (p_rec.bvr_attribute17 = hr_api.g_varchar2) then
644     p_rec.bvr_attribute17 :=
645     ben_bvr_shd.g_old_rec.bvr_attribute17;
646   End If;
647   If (p_rec.bvr_attribute18 = hr_api.g_varchar2) then
648     p_rec.bvr_attribute18 :=
649     ben_bvr_shd.g_old_rec.bvr_attribute18;
650   End If;
651   If (p_rec.bvr_attribute19 = hr_api.g_varchar2) then
652     p_rec.bvr_attribute19 :=
653     ben_bvr_shd.g_old_rec.bvr_attribute19;
654   End If;
655   If (p_rec.bvr_attribute20 = hr_api.g_varchar2) then
656     p_rec.bvr_attribute20 :=
657     ben_bvr_shd.g_old_rec.bvr_attribute20;
658   End If;
659   If (p_rec.bvr_attribute21 = hr_api.g_varchar2) then
660     p_rec.bvr_attribute21 :=
661     ben_bvr_shd.g_old_rec.bvr_attribute21;
662   End If;
663   If (p_rec.bvr_attribute22 = hr_api.g_varchar2) then
664     p_rec.bvr_attribute22 :=
665     ben_bvr_shd.g_old_rec.bvr_attribute22;
666   End If;
667   If (p_rec.bvr_attribute23 = hr_api.g_varchar2) then
668     p_rec.bvr_attribute23 :=
669     ben_bvr_shd.g_old_rec.bvr_attribute23;
670   End If;
671   If (p_rec.bvr_attribute24 = hr_api.g_varchar2) then
672     p_rec.bvr_attribute24 :=
673     ben_bvr_shd.g_old_rec.bvr_attribute24;
674   End If;
675   If (p_rec.bvr_attribute25 = hr_api.g_varchar2) then
676     p_rec.bvr_attribute25 :=
677     ben_bvr_shd.g_old_rec.bvr_attribute25;
678   End If;
679   If (p_rec.bvr_attribute26 = hr_api.g_varchar2) then
680     p_rec.bvr_attribute26 :=
681     ben_bvr_shd.g_old_rec.bvr_attribute26;
682   End If;
683   If (p_rec.bvr_attribute27 = hr_api.g_varchar2) then
684     p_rec.bvr_attribute27 :=
685     ben_bvr_shd.g_old_rec.bvr_attribute27;
686   End If;
687   If (p_rec.bvr_attribute28 = hr_api.g_varchar2) then
688     p_rec.bvr_attribute28 :=
689     ben_bvr_shd.g_old_rec.bvr_attribute28;
690   End If;
691   If (p_rec.bvr_attribute29 = hr_api.g_varchar2) then
692     p_rec.bvr_attribute29 :=
693     ben_bvr_shd.g_old_rec.bvr_attribute29;
694   End If;
695   If (p_rec.bvr_attribute30 = hr_api.g_varchar2) then
696     p_rec.bvr_attribute30 :=
697     ben_bvr_shd.g_old_rec.bvr_attribute30;
698   End If;
699   If (p_rec.ordr_num = hr_api.g_number) then
700     p_rec.ordr_num :=
701     ben_bvr_shd.g_old_rec.ordr_num;
702   End If;
703   --
704   hr_utility.set_location(' Leaving:'||l_proc, 10);
705 --
706 End convert_defs;
707 --
708 -- ----------------------------------------------------------------------------
709 -- |---------------------------------< upd >----------------------------------|
710 -- ----------------------------------------------------------------------------
711 Procedure upd
712   (
713   p_rec			in out nocopy 	ben_bvr_shd.g_rec_type,
714   p_effective_date	in 	date,
715   p_datetrack_mode	in 	varchar2
716   ) is
717 --
718   l_proc			varchar2(72) := g_package||'upd';
719   l_validation_start_date	date;
720   l_validation_end_date		date;
721 --
722 Begin
723   hr_utility.set_location('Entering:'||l_proc, 5);
724   --
725   -- Ensure that the DateTrack update mode is valid
726   --
727   dt_api.validate_dt_upd_mode(p_datetrack_mode => p_datetrack_mode);
728   --
729   -- We must lock the row which we need to update.
730   --
731   ben_bvr_shd.lck
732 	(p_effective_date	 => p_effective_date,
733       	 p_datetrack_mode	 => p_datetrack_mode,
734       	 p_bnft_vrbl_rt_id	 => p_rec.bnft_vrbl_rt_id,
735       	 p_object_version_number => p_rec.object_version_number,
736       	 p_validation_start_date => l_validation_start_date,
737       	 p_validation_end_date	 => l_validation_end_date);
738   --
739   -- 1. During an update system defaults are used to determine if
740   --    arguments have been defaulted or not. We must therefore
741   --    derive the full record structure values to be updated.
742   --
743   -- 2. Call the supporting update validate operations.
744   --
745   convert_defs(p_rec);
746   ben_bvr_bus.update_validate
747 	(p_rec			 => p_rec,
748 	 p_effective_date	 => p_effective_date,
749 	 p_datetrack_mode  	 => p_datetrack_mode,
750 	 p_validation_start_date => l_validation_start_date,
751 	 p_validation_end_date	 => l_validation_end_date);
752   --
753   -- Call the supporting pre-update operation
754   --
755   pre_update
756 	(p_rec			 => p_rec,
757 	 p_effective_date	 => p_effective_date,
758 	 p_datetrack_mode	 => p_datetrack_mode,
759 	 p_validation_start_date => l_validation_start_date,
760 	 p_validation_end_date	 => l_validation_end_date);
761   --
762   -- Update the row.
763   --
764   update_dml
765 	(p_rec			 => p_rec,
766 	 p_effective_date	 => p_effective_date,
767 	 p_datetrack_mode	 => p_datetrack_mode,
768 	 p_validation_start_date => l_validation_start_date,
769 	 p_validation_end_date	 => l_validation_end_date);
770   --
771   -- Call the supporting post-update operation
772   --
773   post_update
774 	(p_rec			 => p_rec,
775 	 p_effective_date	 => p_effective_date,
776 	 p_datetrack_mode	 => p_datetrack_mode,
777 	 p_validation_start_date => l_validation_start_date,
778 	 p_validation_end_date	 => l_validation_end_date);
779 End upd;
780 --
781 -- ----------------------------------------------------------------------------
782 -- |---------------------------------< upd >----------------------------------|
783 -- ----------------------------------------------------------------------------
784 Procedure upd
785   (
786   p_bnft_vrbl_rt_id              in number,
787   p_effective_start_date         out nocopy date,
788   p_effective_end_date           out nocopy date,
789   p_cvg_amt_calc_mthd_id         in number           default hr_api.g_number,
790   p_vrbl_rt_prfl_id              in number           default hr_api.g_number,
791   p_business_group_id            in number           default hr_api.g_number,
792   p_bvr_attribute_category       in varchar2         default hr_api.g_varchar2,
793   p_bvr_attribute1               in varchar2         default hr_api.g_varchar2,
794   p_bvr_attribute2               in varchar2         default hr_api.g_varchar2,
795   p_bvr_attribute3               in varchar2         default hr_api.g_varchar2,
796   p_bvr_attribute4               in varchar2         default hr_api.g_varchar2,
797   p_bvr_attribute5               in varchar2         default hr_api.g_varchar2,
798   p_bvr_attribute6               in varchar2         default hr_api.g_varchar2,
799   p_bvr_attribute7               in varchar2         default hr_api.g_varchar2,
800   p_bvr_attribute8               in varchar2         default hr_api.g_varchar2,
801   p_bvr_attribute9               in varchar2         default hr_api.g_varchar2,
802   p_bvr_attribute10              in varchar2         default hr_api.g_varchar2,
803   p_bvr_attribute11              in varchar2         default hr_api.g_varchar2,
804   p_bvr_attribute12              in varchar2         default hr_api.g_varchar2,
805   p_bvr_attribute13              in varchar2         default hr_api.g_varchar2,
806   p_bvr_attribute14              in varchar2         default hr_api.g_varchar2,
807   p_bvr_attribute15              in varchar2         default hr_api.g_varchar2,
808   p_bvr_attribute16              in varchar2         default hr_api.g_varchar2,
809   p_bvr_attribute17              in varchar2         default hr_api.g_varchar2,
810   p_bvr_attribute18              in varchar2         default hr_api.g_varchar2,
811   p_bvr_attribute19              in varchar2         default hr_api.g_varchar2,
812   p_bvr_attribute20              in varchar2         default hr_api.g_varchar2,
813   p_bvr_attribute21              in varchar2         default hr_api.g_varchar2,
814   p_bvr_attribute22              in varchar2         default hr_api.g_varchar2,
815   p_bvr_attribute23              in varchar2         default hr_api.g_varchar2,
816   p_bvr_attribute24              in varchar2         default hr_api.g_varchar2,
817   p_bvr_attribute25              in varchar2         default hr_api.g_varchar2,
818   p_bvr_attribute26              in varchar2         default hr_api.g_varchar2,
819   p_bvr_attribute27              in varchar2         default hr_api.g_varchar2,
820   p_bvr_attribute28              in varchar2         default hr_api.g_varchar2,
821   p_bvr_attribute29              in varchar2         default hr_api.g_varchar2,
822   p_bvr_attribute30              in varchar2         default hr_api.g_varchar2,
823   p_object_version_number        in out nocopy number,
824   p_ordr_num                     in number           default hr_api.g_number,
825   p_effective_date		 in date,
826   p_datetrack_mode		 in varchar2
827   ) is
828 --
829   l_rec		ben_bvr_shd.g_rec_type;
830   l_proc	varchar2(72) := g_package||'upd';
831 --
832 Begin
833   hr_utility.set_location('Entering:'||l_proc, 5);
834   --
835   -- Call conversion function to turn arguments into the
836   -- l_rec structure.
837   --
838   l_rec :=
839   ben_bvr_shd.convert_args
840   (
841   p_bnft_vrbl_rt_id,
842   null,
843   null,
844   p_cvg_amt_calc_mthd_id,
845   p_vrbl_rt_prfl_id,
846   p_business_group_id,
847   p_bvr_attribute_category,
848   p_bvr_attribute1,
849   p_bvr_attribute2,
850   p_bvr_attribute3,
851   p_bvr_attribute4,
852   p_bvr_attribute5,
853   p_bvr_attribute6,
854   p_bvr_attribute7,
855   p_bvr_attribute8,
856   p_bvr_attribute9,
857   p_bvr_attribute10,
858   p_bvr_attribute11,
859   p_bvr_attribute12,
860   p_bvr_attribute13,
861   p_bvr_attribute14,
862   p_bvr_attribute15,
863   p_bvr_attribute16,
864   p_bvr_attribute17,
865   p_bvr_attribute18,
866   p_bvr_attribute19,
867   p_bvr_attribute20,
868   p_bvr_attribute21,
869   p_bvr_attribute22,
870   p_bvr_attribute23,
871   p_bvr_attribute24,
872   p_bvr_attribute25,
873   p_bvr_attribute26,
874   p_bvr_attribute27,
875   p_bvr_attribute28,
876   p_bvr_attribute29,
877   p_bvr_attribute30,
878   p_object_version_number,
879   p_ordr_num
880   );
881   --
882   -- Having converted the arguments into the
883   -- plsql record structure we call the corresponding record
884   -- business process.
885   --
886   upd(l_rec, p_effective_date, p_datetrack_mode);
887   p_object_version_number       := l_rec.object_version_number;
888   p_effective_start_date        := l_rec.effective_start_date;
889   p_effective_end_date          := l_rec.effective_end_date;
890   --
891   --
892   hr_utility.set_location(' Leaving:'||l_proc, 10);
893 End upd;
894 --
895 end ben_bvr_upd;