DBA Data[Home] [Help]

PACKAGE BODY: APPS.BEN_OPT_UPD

Source


1 Package Body ben_opt_upd as
2 /* $Header: beoptrhi.pkb 120.0 2005/05/28 09:56:38 appldev noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33)	:= '  ben_opt_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_opt_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_opt_f',
78 	   p_base_key_column	=> 'opt_id',
79 	   p_base_key_value	=> p_rec.opt_id);
80     --
81     ben_opt_shd.g_api_dml := true;  -- Set the api dml status
82     --
83     -- Update the ben_opt_f Row
84     --
85     update  ben_opt_f
86     set
87         opt_id                          = p_rec.opt_id,
88     name                            = p_rec.name,
89     cmbn_ptip_opt_id                = p_rec.cmbn_ptip_opt_id,
90     business_group_id               = p_rec.business_group_id,
91     opt_attribute_category          = p_rec.opt_attribute_category,
92     opt_attribute1                  = p_rec.opt_attribute1,
93     opt_attribute2                  = p_rec.opt_attribute2,
94     opt_attribute3                  = p_rec.opt_attribute3,
95     opt_attribute4                  = p_rec.opt_attribute4,
96     opt_attribute5                  = p_rec.opt_attribute5,
97     opt_attribute6                  = p_rec.opt_attribute6,
98     opt_attribute7                  = p_rec.opt_attribute7,
99     opt_attribute8                  = p_rec.opt_attribute8,
100     opt_attribute9                  = p_rec.opt_attribute9,
101     opt_attribute10                 = p_rec.opt_attribute10,
102     opt_attribute11                 = p_rec.opt_attribute11,
103     opt_attribute12                 = p_rec.opt_attribute12,
104     opt_attribute13                 = p_rec.opt_attribute13,
105     opt_attribute14                 = p_rec.opt_attribute14,
106     opt_attribute15                 = p_rec.opt_attribute15,
107     opt_attribute16                 = p_rec.opt_attribute16,
108     opt_attribute17                 = p_rec.opt_attribute17,
109     opt_attribute18                 = p_rec.opt_attribute18,
110     opt_attribute19                 = p_rec.opt_attribute19,
111     opt_attribute20                 = p_rec.opt_attribute20,
112     opt_attribute21                 = p_rec.opt_attribute21,
113     opt_attribute22                 = p_rec.opt_attribute22,
114     opt_attribute23                 = p_rec.opt_attribute23,
115     opt_attribute24                 = p_rec.opt_attribute24,
116     opt_attribute25                 = p_rec.opt_attribute25,
117     opt_attribute26                 = p_rec.opt_attribute26,
118     opt_attribute27                 = p_rec.opt_attribute27,
119     opt_attribute28                 = p_rec.opt_attribute28,
120     opt_attribute29                 = p_rec.opt_attribute29,
121     opt_attribute30                 = p_rec.opt_attribute30,
122     object_version_number           = p_rec.object_version_number,
123     rqd_perd_enrt_nenrt_uom         = p_rec.rqd_perd_enrt_nenrt_uom,
124     rqd_perd_enrt_nenrt_val         = p_rec.rqd_perd_enrt_nenrt_val,
125     rqd_perd_enrt_nenrt_rl          = p_rec.rqd_perd_enrt_nenrt_rl,
126     invk_wv_opt_flag                = p_rec.invk_wv_opt_flag ,
127     short_name                      = p_rec.short_name,
128     short_code                      = p_rec.short_code,
129     legislation_code                = p_rec.legislation_code,
130     legislation_subgroup            = p_rec.legislation_subgroup,
131     group_opt_id                    = p_rec.group_opt_id,
132     component_reason                = p_rec.component_reason,
133     mapping_table_name              = p_rec.mapping_table_name,
134     mapping_table_pk_id             = p_rec.mapping_table_pk_id
135     where   opt_id = p_rec.opt_id
136     and     effective_start_date = p_validation_start_date
137     and     effective_end_date   = p_validation_end_date;
138     --
139     ben_opt_shd.g_api_dml := false;   -- Unset the api dml status
140     --
141     -- Set the effective start and end dates
142     --
143     p_rec.effective_start_date := p_validation_start_date;
144     p_rec.effective_end_date   := p_validation_end_date;
145   End If;
146 --
147 hr_utility.set_location(' Leaving:'||l_proc, 15);
148 Exception
149   When hr_api.check_integrity_violated Then
150     -- A check constraint has been violated
151     ben_opt_shd.g_api_dml := false;   -- Unset the api dml status
152     ben_opt_shd.constraint_error
153       (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
154   When hr_api.unique_integrity_violated Then
155     -- Unique integrity has been violated
156     ben_opt_shd.g_api_dml := false;   -- Unset the api dml status
157     ben_opt_shd.constraint_error
158       (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
159   When Others Then
160     ben_opt_shd.g_api_dml := false;   -- Unset the api dml status
161     Raise;
162 End dt_update_dml;
163 --
164 -- ----------------------------------------------------------------------------
165 -- |------------------------------< update_dml >------------------------------|
166 -- ----------------------------------------------------------------------------
167 -- {Start Of Comments}
168 --
169 -- Description:
170 --   This procedure calls the dt_update_dml control logic which handles
171 --   the actual datetrack dml.
172 --
173 -- Prerequisites:
174 --   This is an internal private procedure which must be called from the upd
175 --   procedure.
176 --
177 -- In Parameters:
178 --   A Pl/Sql record structre.
179 --
180 -- Post Success:
181 --   Processing contines.
182 --
183 -- Post Failure:
184 --   No specific error handling is required within this procedure.
185 --
186 -- Developer Implementation Notes:
187 --   The update 'set' arguments list should be modified if any of your
188 --   attributes are not updateable.
189 --
190 -- Access Status:
191 --   Internal Row Handler Use Only.
192 --
193 -- {End Of Comments}
194 -- ----------------------------------------------------------------------------
195 Procedure update_dml
196 	(p_rec 			 in out nocopy ben_opt_shd.g_rec_type,
197 	 p_effective_date	 in	date,
198 	 p_datetrack_mode	 in	varchar2,
199 	 p_validation_start_date in	date,
200 	 p_validation_end_date	 in	date) is
201 --
202   l_proc	varchar2(72) := g_package||'update_dml';
203 --
204 Begin
205   hr_utility.set_location('Entering:'||l_proc, 5);
206   --
207   dt_update_dml(p_rec			=> p_rec,
208 		p_effective_date	=> p_effective_date,
209 		p_datetrack_mode	=> p_datetrack_mode,
210        		p_validation_start_date	=> p_validation_start_date,
211 		p_validation_end_date	=> p_validation_end_date);
212   --
213   hr_utility.set_location(' Leaving:'||l_proc, 10);
214 End update_dml;
215 --
216 -- ----------------------------------------------------------------------------
217 -- |----------------------------< dt_pre_update >-----------------------------|
218 -- ----------------------------------------------------------------------------
219 -- {Start Of Comments}
220 --
221 -- Description:
222 --   The dt_pre_update procedure controls the execution
223 --   of dml for the datetrack modes of: UPDATE, UPDATE_OVERRIDE
224 --   and UPDATE_CHANGE_INSERT only. The execution required is as
225 --   follows:
226 --
227 --   1) Providing the datetrack update mode is not 'CORRECTION'
228 --      then set the effective end date of the current row (this
229 --      will be the validation_start_date - 1).
230 --   2) If the datetrack mode is 'UPDATE_OVERRIDE' then call the
231 --      corresponding delete_dml process to delete any future rows
232 --      where the effective_start_date is greater than or equal to
233 --	the validation_start_date.
234 --   3) Call the insert_dml process to insert the new updated row
235 --      details..
236 --
237 -- Prerequisites:
238 --   This is an internal procedure which is called from the
239 --   pre_update procedure.
240 --
241 -- In Parameters:
242 --
243 -- Post Success:
244 --   Processing continues.
245 --
246 -- Post Failure:
247 --   If an error has occurred, an error message and exception will be raised
248 --   but not handled.
249 --
250 -- Developer Implementation Notes:
251 --   This is an internal procedure which is required by Datetrack. Don't
252 --   remove or modify.
253 --
254 -- Access Status:
255 --   Internal Row Handler Use Only.
256 --
257 -- {End Of Comments}
258 -- ----------------------------------------------------------------------------
259 Procedure dt_pre_update
260 	(p_rec 			 in out nocopy ben_opt_shd.g_rec_type,
261 	 p_effective_date	 in	date,
262 	 p_datetrack_mode	 in	varchar2,
263 	 p_validation_start_date in	date,
264 	 p_validation_end_date	 in	date) is
265 --
266   l_proc	         varchar2(72) := g_package||'dt_pre_update';
267   l_dummy_version_number number;
268 --
269 Begin
270   hr_utility.set_location('Entering:'||l_proc, 5);
271   If (p_datetrack_mode <> 'CORRECTION') then
272     hr_utility.set_location(l_proc, 10);
273     --
274     -- Update the current effective end date
275     --
276     ben_opt_shd.upd_effective_end_date
277      (p_effective_date	       => p_effective_date,
278       p_base_key_value	       => p_rec.opt_id,
279       p_new_effective_end_date => (p_validation_start_date - 1),
280       p_validation_start_date  => p_validation_start_date,
281       p_validation_end_date    => p_validation_end_date,
282       p_object_version_number  => l_dummy_version_number);
283     --
284     If (p_datetrack_mode = 'UPDATE_OVERRIDE') then
285       hr_utility.set_location(l_proc, 15);
286       --
287       -- As the datetrack mode is 'UPDATE_OVERRIDE' then we must
288       -- delete any future rows
289       --
290       ben_opt_del.delete_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(l_proc, 20);
298     --
299     -- We must now insert the updated row
300     --
301     ben_opt_ins.insert_dml
302       (p_rec			=> p_rec,
303        p_effective_date		=> p_effective_date,
304        p_datetrack_mode		=> p_datetrack_mode,
305        p_validation_start_date	=> p_validation_start_date,
306        p_validation_end_date	=> p_validation_end_date);
307   End If;
308   hr_utility.set_location(' Leaving:'||l_proc, 20);
309 End dt_pre_update;
310 --
311 -- ----------------------------------------------------------------------------
312 -- |------------------------------< pre_update >------------------------------|
313 -- ----------------------------------------------------------------------------
314 -- {Start Of Comments}
315 --
316 -- Description:
317 --   This private procedure contains any processing which is required before
318 --   the update dml.
319 --
320 -- Prerequisites:
321 --   This is an internal procedure which is called from the upd procedure.
322 --
323 -- In Parameters:
324 --   A Pl/Sql record structre.
325 --
326 -- Post Success:
327 --   Processing continues.
328 --
329 -- Post Failure:
330 --   If an error has occurred, an error message and exception will be raised
331 --   but not handled.
332 --
333 -- Developer Implementation Notes:
334 --   Any pre-processing required before the update dml is issued should be
335 --   coded within this procedure. It is important to note that any 3rd party
336 --   maintenance should be reviewed before placing in this procedure. The call
337 --   to the dt_update_dml procedure should NOT be removed.
338 --
339 -- Access Status:
340 --   Internal Row Handler Use Only.
341 --
342 -- {End Of Comments}
343 -- ----------------------------------------------------------------------------
344 Procedure pre_update
345 	(p_rec 			 in out nocopy ben_opt_shd.g_rec_type,
346 	 p_effective_date	 in	date,
347 	 p_datetrack_mode	 in	varchar2,
348 	 p_validation_start_date in	date,
349 	 p_validation_end_date	 in	date) is
350 --
351   l_proc	varchar2(72) := g_package||'pre_update';
352 --
353 Begin
354   hr_utility.set_location('Entering:'||l_proc, 5);
355   --
356   --
357   --
358   dt_pre_update
359     (p_rec 		     => p_rec,
360      p_effective_date	     => p_effective_date,
361      p_datetrack_mode	     => p_datetrack_mode,
362      p_validation_start_date => p_validation_start_date,
363      p_validation_end_date   => p_validation_end_date);
364   --
365   hr_utility.set_location(' Leaving:'||l_proc, 10);
366 End pre_update;
367 --
368 -- ----------------------------------------------------------------------------
369 -- |-----------------------------< post_update >------------------------------|
370 -- ----------------------------------------------------------------------------
371 -- {Start Of Comments}
372 --
373 -- Description:
374 --   This private procedure contains any processing which is required after the
375 --   update dml.
376 --
377 -- Prerequisites:
378 --   This is an internal procedure which is called from the upd procedure.
379 --
380 -- In Parameters:
381 --   A Pl/Sql record structre.
382 --
383 -- Post Success:
384 --   Processing continues.
385 --
386 -- Post Failure:
387 --   If an error has occurred, an error message and exception will be raised
388 --   but not handled.
389 --
390 -- Developer Implementation Notes:
391 --   Any post-processing required after the update dml is issued should be
392 --   coded within this procedure. It is important to note that any 3rd party
393 --   maintenance should be reviewed before placing in this procedure.
394 --
395 -- Access Status:
396 --   Internal Row Handler Use Only.
397 --
398 -- {End Of Comments}
399 -- ----------------------------------------------------------------------------
400 Procedure post_update
401 	(p_rec 			 in ben_opt_shd.g_rec_type,
402 	 p_effective_date	 in date,
403 	 p_datetrack_mode	 in varchar2,
404 	 p_validation_start_date in date,
405 	 p_validation_end_date	 in date) is
406 --
407   l_proc	varchar2(72) := g_package||'post_update';
408 --
409 Begin
410   hr_utility.set_location('Entering:'||l_proc, 5);
411 --
412 -- Added for GSP validations
413 pqh_gsp_ben_validations.opt_validations
414   	(  p_opt_id			=> p_rec.opt_id
415   	 , p_effective_date 		=> p_effective_date
416   	 , p_dml_operation 		=> 'U'
417   	 , p_business_group_id  	=> p_rec.business_group_id
418   	 , p_mapping_table_pk_id	=> p_rec.mapping_table_pk_id
419   	 );
420 
421   --
422   -- Start of API User Hook for post_update.
423   --
424   begin
425     --
426     ben_opt_rku.after_update
427       (
428   p_opt_id                        =>p_rec.opt_id
429  ,p_effective_start_date          =>p_rec.effective_start_date
430  ,p_effective_end_date            =>p_rec.effective_end_date
431  ,p_name                          =>p_rec.name
432  ,p_cmbn_ptip_opt_id              =>p_rec.cmbn_ptip_opt_id
433  ,p_business_group_id             =>p_rec.business_group_id
434  ,p_opt_attribute_category        =>p_rec.opt_attribute_category
435  ,p_opt_attribute1                =>p_rec.opt_attribute1
436  ,p_opt_attribute2                =>p_rec.opt_attribute2
437  ,p_opt_attribute3                =>p_rec.opt_attribute3
438  ,p_opt_attribute4                =>p_rec.opt_attribute4
439  ,p_opt_attribute5                =>p_rec.opt_attribute5
440  ,p_opt_attribute6                =>p_rec.opt_attribute6
441  ,p_opt_attribute7                =>p_rec.opt_attribute7
442  ,p_opt_attribute8                =>p_rec.opt_attribute8
443  ,p_opt_attribute9                =>p_rec.opt_attribute9
444  ,p_opt_attribute10               =>p_rec.opt_attribute10
445  ,p_opt_attribute11               =>p_rec.opt_attribute11
446  ,p_opt_attribute12               =>p_rec.opt_attribute12
447  ,p_opt_attribute13               =>p_rec.opt_attribute13
448  ,p_opt_attribute14               =>p_rec.opt_attribute14
449  ,p_opt_attribute15               =>p_rec.opt_attribute15
450  ,p_opt_attribute16               =>p_rec.opt_attribute16
451  ,p_opt_attribute17               =>p_rec.opt_attribute17
452  ,p_opt_attribute18               =>p_rec.opt_attribute18
453  ,p_opt_attribute19               =>p_rec.opt_attribute19
454  ,p_opt_attribute20               =>p_rec.opt_attribute20
455  ,p_opt_attribute21               =>p_rec.opt_attribute21
456  ,p_opt_attribute22               =>p_rec.opt_attribute22
457  ,p_opt_attribute23               =>p_rec.opt_attribute23
458  ,p_opt_attribute24               =>p_rec.opt_attribute24
459  ,p_opt_attribute25               =>p_rec.opt_attribute25
460  ,p_opt_attribute26               =>p_rec.opt_attribute26
461  ,p_opt_attribute27               =>p_rec.opt_attribute27
462  ,p_opt_attribute28               =>p_rec.opt_attribute28
463  ,p_opt_attribute29               =>p_rec.opt_attribute29
464  ,p_opt_attribute30               =>p_rec.opt_attribute30
465  ,p_object_version_number         =>p_rec.object_version_number
466  ,p_rqd_perd_enrt_nenrt_uom       =>p_rec.rqd_perd_enrt_nenrt_uom
467  ,p_rqd_perd_enrt_nenrt_val       =>p_rec.rqd_perd_enrt_nenrt_val
468  ,p_rqd_perd_enrt_nenrt_rl        =>p_rec.rqd_perd_enrt_nenrt_rl
469  ,p_invk_wv_opt_flag              =>p_rec.invk_wv_opt_flag
470  ,p_short_name                    =>p_rec.short_name
471  ,p_short_code                    =>p_rec.short_code
472  ,p_legislation_code              =>p_rec.legislation_code
473  ,p_legislation_subgroup          =>p_rec.legislation_subgroup
474  ,p_group_opt_id                  =>p_rec.group_opt_id
475  ,p_component_reason              =>p_rec.component_reason
476  ,p_mapping_table_name            =>p_rec.mapping_table_name
477  ,p_mapping_table_pk_id           =>p_rec.mapping_table_pk_id
478  ,p_effective_date                =>p_effective_date
479  ,p_datetrack_mode                =>p_datetrack_mode
480  ,p_validation_start_date         =>p_validation_start_date
481  ,p_validation_end_date           =>p_validation_end_date
482  ,p_effective_start_date_o        =>ben_opt_shd.g_old_rec.effective_start_date
483  ,p_effective_end_date_o          =>ben_opt_shd.g_old_rec.effective_end_date
484  ,p_name_o                        =>ben_opt_shd.g_old_rec.name
485  ,p_cmbn_ptip_opt_id_o            =>ben_opt_shd.g_old_rec.cmbn_ptip_opt_id
486  ,p_business_group_id_o           =>ben_opt_shd.g_old_rec.business_group_id
487  ,p_opt_attribute_category_o      =>ben_opt_shd.g_old_rec.opt_attribute_category
488  ,p_opt_attribute1_o              =>ben_opt_shd.g_old_rec.opt_attribute1
489  ,p_opt_attribute2_o              =>ben_opt_shd.g_old_rec.opt_attribute2
490  ,p_opt_attribute3_o              =>ben_opt_shd.g_old_rec.opt_attribute3
491  ,p_opt_attribute4_o              =>ben_opt_shd.g_old_rec.opt_attribute4
492  ,p_opt_attribute5_o              =>ben_opt_shd.g_old_rec.opt_attribute5
493  ,p_opt_attribute6_o              =>ben_opt_shd.g_old_rec.opt_attribute6
494  ,p_opt_attribute7_o              =>ben_opt_shd.g_old_rec.opt_attribute7
495  ,p_opt_attribute8_o              =>ben_opt_shd.g_old_rec.opt_attribute8
496  ,p_opt_attribute9_o              =>ben_opt_shd.g_old_rec.opt_attribute9
497  ,p_opt_attribute10_o             =>ben_opt_shd.g_old_rec.opt_attribute10
498  ,p_opt_attribute11_o             =>ben_opt_shd.g_old_rec.opt_attribute11
499  ,p_opt_attribute12_o             =>ben_opt_shd.g_old_rec.opt_attribute12
500  ,p_opt_attribute13_o             =>ben_opt_shd.g_old_rec.opt_attribute13
501  ,p_opt_attribute14_o             =>ben_opt_shd.g_old_rec.opt_attribute14
502  ,p_opt_attribute15_o             =>ben_opt_shd.g_old_rec.opt_attribute15
503  ,p_opt_attribute16_o             =>ben_opt_shd.g_old_rec.opt_attribute16
504  ,p_opt_attribute17_o             =>ben_opt_shd.g_old_rec.opt_attribute17
505  ,p_opt_attribute18_o             =>ben_opt_shd.g_old_rec.opt_attribute18
506  ,p_opt_attribute19_o             =>ben_opt_shd.g_old_rec.opt_attribute19
507  ,p_opt_attribute20_o             =>ben_opt_shd.g_old_rec.opt_attribute20
508  ,p_opt_attribute21_o             =>ben_opt_shd.g_old_rec.opt_attribute21
509  ,p_opt_attribute22_o             =>ben_opt_shd.g_old_rec.opt_attribute22
510  ,p_opt_attribute23_o             =>ben_opt_shd.g_old_rec.opt_attribute23
511  ,p_opt_attribute24_o             =>ben_opt_shd.g_old_rec.opt_attribute24
512  ,p_opt_attribute25_o             =>ben_opt_shd.g_old_rec.opt_attribute25
513  ,p_opt_attribute26_o             =>ben_opt_shd.g_old_rec.opt_attribute26
514  ,p_opt_attribute27_o             =>ben_opt_shd.g_old_rec.opt_attribute27
515  ,p_opt_attribute28_o             =>ben_opt_shd.g_old_rec.opt_attribute28
516  ,p_opt_attribute29_o             =>ben_opt_shd.g_old_rec.opt_attribute29
517  ,p_opt_attribute30_o             =>ben_opt_shd.g_old_rec.opt_attribute30
518  ,p_object_version_number_o       =>ben_opt_shd.g_old_rec.object_version_number
519  ,p_rqd_perd_enrt_nenrt_uom_o     =>ben_opt_shd.g_old_rec.rqd_perd_enrt_nenrt_uom
520  ,p_rqd_perd_enrt_nenrt_val_o     =>ben_opt_shd.g_old_rec.rqd_perd_enrt_nenrt_val
521  ,p_rqd_perd_enrt_nenrt_rl_o      =>ben_opt_shd.g_old_rec.rqd_perd_enrt_nenrt_rl
522  ,p_invk_wv_opt_flag_o            =>ben_opt_shd.g_old_rec.invk_wv_opt_flag
523  ,p_short_name_o                  =>ben_opt_shd.g_old_rec.short_name
524  ,p_short_code_o                  =>ben_opt_shd.g_old_rec.short_code
525  ,p_legislation_code_o            =>ben_opt_shd.g_old_rec.legislation_code
526  ,p_legislation_subgroup_o        =>ben_opt_shd.g_old_rec.legislation_subgroup
527  ,p_group_opt_id_o                =>ben_opt_shd.g_old_rec.group_opt_id
528  ,p_component_reason_o            =>ben_opt_shd.g_old_rec.component_reason
529  ,p_mapping_table_name_o          =>ben_opt_shd.g_old_rec.mapping_table_name
530  ,p_mapping_table_pk_id_o         =>ben_opt_shd.g_old_rec.mapping_table_pk_id
531  );
532 --
533   exception
534     --
535     when hr_api.cannot_find_prog_unit then
536       --
537       hr_api.cannot_find_prog_unit_error
538         (p_module_name => 'ben_opt_f'
539         ,p_hook_type   => 'AU');
540       --
541   end;
542   --
543   -- End of API User Hook for post_update.
544   --
545   --
546   hr_utility.set_location(' Leaving:'||l_proc, 10);
547 End post_update;
548 --
549 -- ----------------------------------------------------------------------------
550 -- |-----------------------------< convert_defs >-----------------------------|
551 -- ----------------------------------------------------------------------------
552 -- {Start Of Comments}
553 --
554 -- Description:
555 --   The Convert_Defs procedure has one very important function:
556 --   It must return the record structure for the row with all system defaulted
557 --   values converted into its corresponding parameter value for update. When
558 --   we attempt to update a row through the Upd process , certain
559 --   parameters can be defaulted which enables flexibility in the calling of
560 --   the upd process (e.g. only attributes which need to be updated need to be
561 --   specified). For the upd process to determine which attributes
562 --   have NOT been specified we need to check if the parameter has a reserved
563 --   system default value. Therefore, for all parameters which have a
564 --   corresponding reserved system default mechanism specified we need to
565 --   check if a system default is being used. If a system default is being
566 --   used then we convert the defaulted value into its corresponding attribute
567 --   value held in the g_old_rec data structure.
568 --
569 -- Prerequisites:
570 --   This private function can only be called from the upd process.
571 --
572 -- In Parameters:
573 --   A Pl/Sql record structre.
574 --
575 -- Post Success:
576 --   The record structure will be returned with all system defaulted parameter
577 --   values converted into its current row attribute value.
578 --
579 -- Post Failure:
580 --   No direct error handling is required within this function. Any possible
581 --   errors within this procedure will be a PL/SQL value error due to conversion
582 --   of datatypes or data lengths.
583 --
584 -- Developer Implementation Notes:
585 --   None.
586 --
587 -- Access Status:
588 --   Internal Row Handler Use Only.
589 --
590 -- {End Of Comments}
591 -- ----------------------------------------------------------------------------
592 Procedure convert_defs(p_rec in out nocopy ben_opt_shd.g_rec_type) is
593 --
594   l_proc  varchar2(72) := g_package||'convert_defs';
595 --
596 Begin
597   --
598   hr_utility.set_location('Entering:'||l_proc, 5);
599   --
600   -- We must now examine each argument value in the
601   -- p_rec plsql record structure
602   -- to see if a system default is being used. If a system default
603   -- is being used then we must set to the 'current' argument value.
604   --
605   If (p_rec.name = hr_api.g_varchar2) then
606     p_rec.name :=
607     ben_opt_shd.g_old_rec.name;
608   End If;
609   If (p_rec.cmbn_ptip_opt_id = hr_api.g_number) then
610     p_rec.cmbn_ptip_opt_id :=
611     ben_opt_shd.g_old_rec.cmbn_ptip_opt_id;
612   End If;
613   If (p_rec.business_group_id = hr_api.g_number) then
614     p_rec.business_group_id :=
615     ben_opt_shd.g_old_rec.business_group_id;
616   End If;
617   If (p_rec.opt_attribute_category = hr_api.g_varchar2) then
618     p_rec.opt_attribute_category :=
619     ben_opt_shd.g_old_rec.opt_attribute_category;
620   End If;
621   If (p_rec.opt_attribute1 = hr_api.g_varchar2) then
622     p_rec.opt_attribute1 :=
623     ben_opt_shd.g_old_rec.opt_attribute1;
624   End If;
625   If (p_rec.opt_attribute2 = hr_api.g_varchar2) then
626     p_rec.opt_attribute2 :=
627     ben_opt_shd.g_old_rec.opt_attribute2;
628   End If;
629   If (p_rec.opt_attribute3 = hr_api.g_varchar2) then
630     p_rec.opt_attribute3 :=
631     ben_opt_shd.g_old_rec.opt_attribute3;
632   End If;
633   If (p_rec.opt_attribute4 = hr_api.g_varchar2) then
634     p_rec.opt_attribute4 :=
635     ben_opt_shd.g_old_rec.opt_attribute4;
636   End If;
637   If (p_rec.opt_attribute5 = hr_api.g_varchar2) then
638     p_rec.opt_attribute5 :=
639     ben_opt_shd.g_old_rec.opt_attribute5;
640   End If;
641   If (p_rec.opt_attribute6 = hr_api.g_varchar2) then
642     p_rec.opt_attribute6 :=
643     ben_opt_shd.g_old_rec.opt_attribute6;
644   End If;
645   If (p_rec.opt_attribute7 = hr_api.g_varchar2) then
646     p_rec.opt_attribute7 :=
647     ben_opt_shd.g_old_rec.opt_attribute7;
648   End If;
649   If (p_rec.opt_attribute8 = hr_api.g_varchar2) then
650     p_rec.opt_attribute8 :=
651     ben_opt_shd.g_old_rec.opt_attribute8;
652   End If;
653   If (p_rec.opt_attribute9 = hr_api.g_varchar2) then
654     p_rec.opt_attribute9 :=
655     ben_opt_shd.g_old_rec.opt_attribute9;
656   End If;
657   If (p_rec.opt_attribute10 = hr_api.g_varchar2) then
658     p_rec.opt_attribute10 :=
659     ben_opt_shd.g_old_rec.opt_attribute10;
660   End If;
661   If (p_rec.opt_attribute11 = hr_api.g_varchar2) then
662     p_rec.opt_attribute11 :=
663     ben_opt_shd.g_old_rec.opt_attribute11;
664   End If;
665   If (p_rec.opt_attribute12 = hr_api.g_varchar2) then
666     p_rec.opt_attribute12 :=
667     ben_opt_shd.g_old_rec.opt_attribute12;
668   End If;
669   If (p_rec.opt_attribute13 = hr_api.g_varchar2) then
670     p_rec.opt_attribute13 :=
671     ben_opt_shd.g_old_rec.opt_attribute13;
672   End If;
673   If (p_rec.opt_attribute14 = hr_api.g_varchar2) then
674     p_rec.opt_attribute14 :=
675     ben_opt_shd.g_old_rec.opt_attribute14;
676   End If;
677   If (p_rec.opt_attribute15 = hr_api.g_varchar2) then
678     p_rec.opt_attribute15 :=
679     ben_opt_shd.g_old_rec.opt_attribute15;
680   End If;
681   If (p_rec.opt_attribute16 = hr_api.g_varchar2) then
682     p_rec.opt_attribute16 :=
683     ben_opt_shd.g_old_rec.opt_attribute16;
684   End If;
685   If (p_rec.opt_attribute17 = hr_api.g_varchar2) then
686     p_rec.opt_attribute17 :=
687     ben_opt_shd.g_old_rec.opt_attribute17;
688   End If;
689   If (p_rec.opt_attribute18 = hr_api.g_varchar2) then
690     p_rec.opt_attribute18 :=
691     ben_opt_shd.g_old_rec.opt_attribute18;
692   End If;
693   If (p_rec.opt_attribute19 = hr_api.g_varchar2) then
694     p_rec.opt_attribute19 :=
695     ben_opt_shd.g_old_rec.opt_attribute19;
696   End If;
697   If (p_rec.opt_attribute20 = hr_api.g_varchar2) then
698     p_rec.opt_attribute20 :=
699     ben_opt_shd.g_old_rec.opt_attribute20;
700   End If;
701   If (p_rec.opt_attribute21 = hr_api.g_varchar2) then
702     p_rec.opt_attribute21 :=
703     ben_opt_shd.g_old_rec.opt_attribute21;
704   End If;
705   If (p_rec.opt_attribute22 = hr_api.g_varchar2) then
706     p_rec.opt_attribute22 :=
707     ben_opt_shd.g_old_rec.opt_attribute22;
708   End If;
709   If (p_rec.opt_attribute23 = hr_api.g_varchar2) then
710     p_rec.opt_attribute23 :=
711     ben_opt_shd.g_old_rec.opt_attribute23;
712   End If;
713   If (p_rec.opt_attribute24 = hr_api.g_varchar2) then
714     p_rec.opt_attribute24 :=
715     ben_opt_shd.g_old_rec.opt_attribute24;
716   End If;
717   If (p_rec.opt_attribute25 = hr_api.g_varchar2) then
718     p_rec.opt_attribute25 :=
719     ben_opt_shd.g_old_rec.opt_attribute25;
720   End If;
721   If (p_rec.opt_attribute26 = hr_api.g_varchar2) then
722     p_rec.opt_attribute26 :=
723     ben_opt_shd.g_old_rec.opt_attribute26;
724   End If;
725   If (p_rec.opt_attribute27 = hr_api.g_varchar2) then
726     p_rec.opt_attribute27 :=
727     ben_opt_shd.g_old_rec.opt_attribute27;
728   End If;
729   If (p_rec.opt_attribute28 = hr_api.g_varchar2) then
730     p_rec.opt_attribute28 :=
731     ben_opt_shd.g_old_rec.opt_attribute28;
732   End If;
733   If (p_rec.opt_attribute29 = hr_api.g_varchar2) then
734     p_rec.opt_attribute29 :=
735     ben_opt_shd.g_old_rec.opt_attribute29;
736   End If;
737   If (p_rec.opt_attribute30 = hr_api.g_varchar2) then
738     p_rec.opt_attribute30 :=
739     ben_opt_shd.g_old_rec.opt_attribute30;
740   End If;
741   If (p_rec.rqd_perd_enrt_nenrt_uom = hr_api.g_varchar2) then
742     p_rec.rqd_perd_enrt_nenrt_uom :=
743     ben_opt_shd.g_old_rec.rqd_perd_enrt_nenrt_uom;
744   End If;
745   If (p_rec.rqd_perd_enrt_nenrt_val = hr_api.g_number) then
746     p_rec.rqd_perd_enrt_nenrt_val :=
747     ben_opt_shd.g_old_rec.rqd_perd_enrt_nenrt_val;
748   End If;
749   If (p_rec.rqd_perd_enrt_nenrt_rl = hr_api.g_number) then
750     p_rec.rqd_perd_enrt_nenrt_rl :=
751     ben_opt_shd.g_old_rec.rqd_perd_enrt_nenrt_rl;
752   End If;
753   If (p_rec.invk_wv_opt_flag = hr_api.g_varchar2) then
754     p_rec.invk_wv_opt_flag :=
755     ben_opt_shd.g_old_rec.invk_wv_opt_flag;
756   End If;
757   If (p_rec.short_name = hr_api.g_varchar2) then
758       p_rec.short_name :=
759       ben_opt_shd.g_old_rec.short_name;
760   End If;
761   If (p_rec.short_code = hr_api.g_varchar2) then
762       p_rec.short_code :=
763       ben_opt_shd.g_old_rec.short_code;
764   End If;
765 
766   If (p_rec.legislation_code = hr_api.g_varchar2) then
767       p_rec.legislation_code :=
768           ben_opt_shd.g_old_rec.legislation_code;
769   End If;
770   If (p_rec.legislation_subgroup = hr_api.g_varchar2) then
771       p_rec.legislation_subgroup :=
772           ben_opt_shd.g_old_rec.legislation_subgroup;
773   End If;
774 
775   If (p_rec.group_opt_id  = hr_api.g_number) then
776       p_rec.group_opt_id :=
777           ben_opt_shd.g_old_rec.group_opt_id;
778   End If;
779 
780   If (p_rec.component_reason = hr_api.g_varchar2) then
781       p_rec.component_reason :=
782       ben_opt_shd.g_old_rec.component_reason;
783   End If;
784   If (p_rec.mapping_table_name = hr_api.g_varchar2) then
785       p_rec.mapping_table_name :=
786       ben_opt_shd.g_old_rec.mapping_table_name;
787   End If;
788   If (p_rec.mapping_table_pk_id = hr_api.g_number) then
789       p_rec.mapping_table_pk_id :=
790       ben_opt_shd.g_old_rec.mapping_table_pk_id;
791   End If;
792 
793   --
794   hr_utility.set_location(' Leaving:'||l_proc, 10);
795 --
796 End convert_defs;
797 --
798 -- ----------------------------------------------------------------------------
799 -- |---------------------------------< upd >----------------------------------|
800 -- ----------------------------------------------------------------------------
801 Procedure upd
802   (
803   p_rec			in out nocopy 	ben_opt_shd.g_rec_type,
804   p_effective_date	in 	date,
805   p_datetrack_mode	in 	varchar2
806   ) is
807 --
808   l_proc			varchar2(72) := g_package||'upd';
809   l_validation_start_date	date;
810   l_validation_end_date		date;
811 --
812 Begin
813   hr_utility.set_location('Entering:'||l_proc, 5);
814   --
815   -- Ensure that the DateTrack update mode is valid
816   --
817   dt_api.validate_dt_upd_mode(p_datetrack_mode => p_datetrack_mode);
818   --
819   -- We must lock the row which we need to update.
820   --
821   ben_opt_shd.lck
822 	(p_effective_date	 => p_effective_date,
823       	 p_datetrack_mode	 => p_datetrack_mode,
824       	 p_opt_id	 => p_rec.opt_id,
825       	 p_object_version_number => p_rec.object_version_number,
826       	 p_validation_start_date => l_validation_start_date,
827       	 p_validation_end_date	 => l_validation_end_date);
828   --
829   -- 1. During an update system defaults are used to determine if
830   --    arguments have been defaulted or not. We must therefore
831   --    derive the full record structure values to be updated.
832   --
833   -- 2. Call the supporting update validate operations.
834   --
835   convert_defs(p_rec);
836   ben_opt_bus.update_validate
837 	(p_rec			 => p_rec,
838 	 p_effective_date	 => p_effective_date,
839 	 p_datetrack_mode  	 => p_datetrack_mode,
840 	 p_validation_start_date => l_validation_start_date,
841 	 p_validation_end_date	 => l_validation_end_date);
842   --
843   -- Call the supporting pre-update operation
844   --
845   pre_update
846 	(p_rec			 => p_rec,
847 	 p_effective_date	 => p_effective_date,
848 	 p_datetrack_mode	 => p_datetrack_mode,
849 	 p_validation_start_date => l_validation_start_date,
850 	 p_validation_end_date	 => l_validation_end_date);
851   --
852   -- Update the row.
853   --
854   update_dml
855 	(p_rec			 => p_rec,
856 	 p_effective_date	 => p_effective_date,
857 	 p_datetrack_mode	 => p_datetrack_mode,
858 	 p_validation_start_date => l_validation_start_date,
859 	 p_validation_end_date	 => l_validation_end_date);
860   --
861   -- Call the supporting post-update operation
862   --
863   post_update
864 	(p_rec			 => p_rec,
865 	 p_effective_date	 => p_effective_date,
866 	 p_datetrack_mode	 => p_datetrack_mode,
867 	 p_validation_start_date => l_validation_start_date,
868 	 p_validation_end_date	 => l_validation_end_date);
869 End upd;
870 --
871 -- ----------------------------------------------------------------------------
872 -- |---------------------------------< upd >----------------------------------|
873 -- ----------------------------------------------------------------------------
874 Procedure upd
875   (
876   p_opt_id                       in number,
877   p_effective_start_date         out nocopy date,
878   p_effective_end_date           out nocopy date,
879   p_name                         in varchar2         default hr_api.g_varchar2,
880   p_cmbn_ptip_opt_id             in number           default hr_api.g_number,
881   p_business_group_id            in number           default hr_api.g_number,
882   p_opt_attribute_category       in varchar2         default hr_api.g_varchar2,
883   p_opt_attribute1               in varchar2         default hr_api.g_varchar2,
884   p_opt_attribute2               in varchar2         default hr_api.g_varchar2,
885   p_opt_attribute3               in varchar2         default hr_api.g_varchar2,
886   p_opt_attribute4               in varchar2         default hr_api.g_varchar2,
887   p_opt_attribute5               in varchar2         default hr_api.g_varchar2,
888   p_opt_attribute6               in varchar2         default hr_api.g_varchar2,
889   p_opt_attribute7               in varchar2         default hr_api.g_varchar2,
890   p_opt_attribute8               in varchar2         default hr_api.g_varchar2,
891   p_opt_attribute9               in varchar2         default hr_api.g_varchar2,
892   p_opt_attribute10              in varchar2         default hr_api.g_varchar2,
893   p_opt_attribute11              in varchar2         default hr_api.g_varchar2,
894   p_opt_attribute12              in varchar2         default hr_api.g_varchar2,
895   p_opt_attribute13              in varchar2         default hr_api.g_varchar2,
896   p_opt_attribute14              in varchar2         default hr_api.g_varchar2,
897   p_opt_attribute15              in varchar2         default hr_api.g_varchar2,
898   p_opt_attribute16              in varchar2         default hr_api.g_varchar2,
899   p_opt_attribute17              in varchar2         default hr_api.g_varchar2,
900   p_opt_attribute18              in varchar2         default hr_api.g_varchar2,
901   p_opt_attribute19              in varchar2         default hr_api.g_varchar2,
902   p_opt_attribute20              in varchar2         default hr_api.g_varchar2,
903   p_opt_attribute21              in varchar2         default hr_api.g_varchar2,
904   p_opt_attribute22              in varchar2         default hr_api.g_varchar2,
905   p_opt_attribute23              in varchar2         default hr_api.g_varchar2,
906   p_opt_attribute24              in varchar2         default hr_api.g_varchar2,
907   p_opt_attribute25              in varchar2         default hr_api.g_varchar2,
908   p_opt_attribute26              in varchar2         default hr_api.g_varchar2,
909   p_opt_attribute27              in varchar2         default hr_api.g_varchar2,
910   p_opt_attribute28              in varchar2         default hr_api.g_varchar2,
911   p_opt_attribute29              in varchar2         default hr_api.g_varchar2,
912   p_opt_attribute30              in varchar2         default hr_api.g_varchar2,
913   p_object_version_number        in out nocopy number,
914   p_rqd_perd_enrt_nenrt_uom      in varchar2         default hr_api.g_varchar2,
915   p_rqd_perd_enrt_nenrt_val      in number           default hr_api.g_number,
916   p_rqd_perd_enrt_nenrt_rl       in number           default hr_api.g_number,
917   p_invk_wv_opt_flag             in varchar2         default hr_api.g_varchar2,
918   p_short_name                   in varchar2         default hr_api.g_varchar2,
919   p_short_code                   in varchar2 	     default hr_api.g_varchar2,
920   p_legislation_code             in varchar2 	     default hr_api.g_varchar2,
921   p_legislation_subgroup         in varchar2 	     default hr_api.g_varchar2,
922   p_group_opt_id                 in number   	     default hr_api.g_number ,
923   p_component_reason             in varchar2         default hr_api.g_varchar2,
924   p_mapping_table_name           in varchar2         default hr_api.g_varchar2,
925   p_mapping_table_pk_id          in number           default hr_api.g_number,
926   p_effective_date		 in date,
927   p_datetrack_mode		 in varchar2
928   ) is
929 --
930   l_rec		ben_opt_shd.g_rec_type;
931   l_proc	varchar2(72) := g_package||'upd';
932 --
933 Begin
934   hr_utility.set_location('Entering:'||l_proc, 5);
935   --
936   -- Call conversion function to turn arguments into the
937   -- l_rec structure.
938   --
939   l_rec :=
940   ben_opt_shd.convert_args
941   (
942   p_opt_id,
943   null,
944   null,
945   p_name,
946   p_cmbn_ptip_opt_id,
947   p_business_group_id,
948   p_opt_attribute_category,
949   p_opt_attribute1,
950   p_opt_attribute2,
951   p_opt_attribute3,
952   p_opt_attribute4,
953   p_opt_attribute5,
954   p_opt_attribute6,
955   p_opt_attribute7,
956   p_opt_attribute8,
957   p_opt_attribute9,
958   p_opt_attribute10,
959   p_opt_attribute11,
960   p_opt_attribute12,
961   p_opt_attribute13,
962   p_opt_attribute14,
963   p_opt_attribute15,
964   p_opt_attribute16,
965   p_opt_attribute17,
966   p_opt_attribute18,
967   p_opt_attribute19,
968   p_opt_attribute20,
969   p_opt_attribute21,
970   p_opt_attribute22,
971   p_opt_attribute23,
972   p_opt_attribute24,
973   p_opt_attribute25,
974   p_opt_attribute26,
975   p_opt_attribute27,
976   p_opt_attribute28,
977   p_opt_attribute29,
978   p_opt_attribute30,
979   p_object_version_number,
980   p_rqd_perd_enrt_nenrt_uom,
981   p_rqd_perd_enrt_nenrt_val,
982   p_rqd_perd_enrt_nenrt_rl,
983   p_invk_wv_opt_flag,
984   p_short_name,
985   p_short_code,
986   p_legislation_code,
987   p_legislation_subgroup,
988   p_group_opt_id ,
989   p_component_reason,
990   p_mapping_table_name,
991   p_mapping_table_pk_id
992   );
993   --
994   -- Having converted the arguments into the
995   -- plsql record structure we call the corresponding record
996   -- business process.
997   --
998   upd(l_rec, p_effective_date, p_datetrack_mode);
999   p_object_version_number       := l_rec.object_version_number;
1000   p_effective_start_date        := l_rec.effective_start_date;
1001   p_effective_end_date          := l_rec.effective_end_date;
1002   --
1003   --
1004   hr_utility.set_location(' Leaving:'||l_proc, 10);
1005 End upd;
1006 --
1007 end ben_opt_upd;