DBA Data[Home] [Help]

PACKAGE BODY: APPS.BEN_ELU_UPD

Source


1 Package Body ben_elu_upd as
2 /* $Header: beelurhi.pkb 120.1 2006/02/27 00:37:05 rtagarra noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33)	:= '  ben_elu_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_elu_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_elig_lbr_mmbr_prte_f',
78 	   p_base_key_column	=> 'elig_lbr_mmbr_prte_id',
79 	   p_base_key_value	=> p_rec.elig_lbr_mmbr_prte_id);
80     --
81     ben_elu_shd.g_api_dml := true;  -- Set the api dml status
82     --
83     -- Update the ben_elig_lbr_mmbr_prte_f Row
84     --
85     update  ben_elig_lbr_mmbr_prte_f
86     set
87         elig_lbr_mmbr_prte_id           = p_rec.elig_lbr_mmbr_prte_id,
88     eligy_prfl_id                   = p_rec.eligy_prfl_id,
89     excld_flag                      = p_rec.excld_flag,
90     lbr_mmbr_flag                   = p_rec.lbr_mmbr_flag,
91     ordr_num                        = p_rec.ordr_num,
92     business_group_id               = p_rec.business_group_id,
93     elu_attribute_category          = p_rec.elu_attribute_category,
94     elu_attribute1                  = p_rec.elu_attribute1,
95     elu_attribute2                  = p_rec.elu_attribute2,
96     elu_attribute3                  = p_rec.elu_attribute3,
97     elu_attribute4                  = p_rec.elu_attribute4,
98     elu_attribute5                  = p_rec.elu_attribute5,
99     elu_attribute6                  = p_rec.elu_attribute6,
100     elu_attribute7                  = p_rec.elu_attribute7,
101     elu_attribute8                  = p_rec.elu_attribute8,
102     elu_attribute9                  = p_rec.elu_attribute9,
103     elu_attribute10                 = p_rec.elu_attribute10,
104     elu_attribute11                 = p_rec.elu_attribute11,
105     elu_attribute12                 = p_rec.elu_attribute12,
106     elu_attribute13                 = p_rec.elu_attribute13,
107     elu_attribute14                 = p_rec.elu_attribute14,
108     elu_attribute15                 = p_rec.elu_attribute15,
109     elu_attribute16                 = p_rec.elu_attribute16,
110     elu_attribute17                 = p_rec.elu_attribute17,
111     elu_attribute18                 = p_rec.elu_attribute18,
112     elu_attribute19                 = p_rec.elu_attribute19,
113     elu_attribute20                 = p_rec.elu_attribute20,
114     elu_attribute21                 = p_rec.elu_attribute21,
115     elu_attribute22                 = p_rec.elu_attribute22,
116     elu_attribute23                 = p_rec.elu_attribute23,
117     elu_attribute24                 = p_rec.elu_attribute24,
118     elu_attribute25                 = p_rec.elu_attribute25,
119     elu_attribute26                 = p_rec.elu_attribute26,
120     elu_attribute27                 = p_rec.elu_attribute27,
121     elu_attribute28                 = p_rec.elu_attribute28,
122     elu_attribute29                 = p_rec.elu_attribute29,
123     elu_attribute30                 = p_rec.elu_attribute30,
124     object_version_number           = p_rec.object_version_number ,
125     criteria_score					= p_rec.criteria_score,
126     criteria_weight					= p_rec.criteria_weight
127     where   elig_lbr_mmbr_prte_id = p_rec.elig_lbr_mmbr_prte_id
128     and     effective_start_date = p_validation_start_date
129     and     effective_end_date   = p_validation_end_date;
130     --
131     ben_elu_shd.g_api_dml := false;   -- Unset the api dml status
132     --
133     -- Set the effective start and end dates
134     --
135     p_rec.effective_start_date := p_validation_start_date;
136     p_rec.effective_end_date   := p_validation_end_date;
137   End If;
138 --
139 hr_utility.set_location(' Leaving:'||l_proc, 15);
140 Exception
141   When hr_api.check_integrity_violated Then
142     -- A check constraint has been violated
143     ben_elu_shd.g_api_dml := false;   -- Unset the api dml status
144     ben_elu_shd.constraint_error
145       (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
146   When hr_api.unique_integrity_violated Then
147     -- Unique integrity has been violated
148     ben_elu_shd.g_api_dml := false;   -- Unset the api dml status
149     ben_elu_shd.constraint_error
150       (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
151   When Others Then
152     ben_elu_shd.g_api_dml := false;   -- Unset the api dml status
153     Raise;
154 End dt_update_dml;
155 --
156 -- ----------------------------------------------------------------------------
157 -- |------------------------------< update_dml >------------------------------|
158 -- ----------------------------------------------------------------------------
159 -- {Start Of Comments}
160 --
161 -- Description:
162 --   This procedure calls the dt_update_dml control logic which handles
163 --   the actual datetrack dml.
164 --
165 -- Prerequisites:
166 --   This is an internal private procedure which must be called from the upd
167 --   procedure.
168 --
169 -- In Parameters:
170 --   A Pl/Sql record structre.
171 --
172 -- Post Success:
173 --   Processing contines.
174 --
175 -- Post Failure:
176 --   No specific error handling is required within this procedure.
177 --
178 -- Developer Implementation Notes:
179 --   The update 'set' arguments list should be modified if any of your
180 --   attributes are not updateable.
181 --
182 -- Access Status:
183 --   Internal Row Handler Use Only.
184 --
185 -- {End Of Comments}
186 -- ----------------------------------------------------------------------------
187 Procedure update_dml
188 	(p_rec 			 in out nocopy ben_elu_shd.g_rec_type,
189 	 p_effective_date	 in	date,
190 	 p_datetrack_mode	 in	varchar2,
191 	 p_validation_start_date in	date,
192 	 p_validation_end_date	 in	date) is
193 --
194   l_proc	varchar2(72) := g_package||'update_dml';
195 --
196 Begin
197   hr_utility.set_location('Entering:'||l_proc, 5);
198   --
199   dt_update_dml(p_rec			=> p_rec,
200 		p_effective_date	=> p_effective_date,
201 		p_datetrack_mode	=> p_datetrack_mode,
202        		p_validation_start_date	=> p_validation_start_date,
203 		p_validation_end_date	=> p_validation_end_date);
204   --
205   hr_utility.set_location(' Leaving:'||l_proc, 10);
206 End update_dml;
207 --
208 -- ----------------------------------------------------------------------------
209 -- |----------------------------< dt_pre_update >-----------------------------|
210 -- ----------------------------------------------------------------------------
211 -- {Start Of Comments}
212 --
213 -- Description:
214 --   The dt_pre_update procedure controls the execution
215 --   of dml for the datetrack modes of: UPDATE, UPDATE_OVERRIDE
216 --   and UPDATE_CHANGE_INSERT only. The execution required is as
217 --   follows:
218 --
219 --   1) Providing the datetrack update mode is not 'CORRECTION'
220 --      then set the effective end date of the current row (this
221 --      will be the validation_start_date - 1).
222 --   2) If the datetrack mode is 'UPDATE_OVERRIDE' then call the
223 --      corresponding delete_dml process to delete any future rows
224 --      where the effective_start_date is greater than or equal to
225 --	the validation_start_date.
226 --   3) Call the insert_dml process to insert the new updated row
227 --      details..
228 --
229 -- Prerequisites:
230 --   This is an internal procedure which is called from the
231 --   pre_update procedure.
232 --
233 -- In Parameters:
234 --
235 -- Post Success:
236 --   Processing continues.
237 --
238 -- Post Failure:
239 --   If an error has occurred, an error message and exception will be raised
240 --   but not handled.
241 --
242 -- Developer Implementation Notes:
243 --   This is an internal procedure which is required by Datetrack. Don't
244 --   remove or modify.
245 --
246 -- Access Status:
247 --   Internal Row Handler Use Only.
248 --
249 -- {End Of Comments}
250 -- ----------------------------------------------------------------------------
251 Procedure dt_pre_update
252 	(p_rec 			 in out nocopy ben_elu_shd.g_rec_type,
253 	 p_effective_date	 in	date,
254 	 p_datetrack_mode	 in	varchar2,
255 	 p_validation_start_date in	date,
256 	 p_validation_end_date	 in	date) is
257 --
258   l_proc	         varchar2(72) := g_package||'dt_pre_update';
259   l_dummy_version_number number;
260 --
261 Begin
262   hr_utility.set_location('Entering:'||l_proc, 5);
263   If (p_datetrack_mode <> 'CORRECTION') then
264     hr_utility.set_location(l_proc, 10);
265     --
266     -- Update the current effective end date
267     --
268     ben_elu_shd.upd_effective_end_date
269      (p_effective_date	       => p_effective_date,
270       p_base_key_value	       => p_rec.elig_lbr_mmbr_prte_id,
271       p_new_effective_end_date => (p_validation_start_date - 1),
272       p_validation_start_date  => p_validation_start_date,
273       p_validation_end_date    => p_validation_end_date,
274       p_object_version_number  => l_dummy_version_number);
275     --
276     If (p_datetrack_mode = 'UPDATE_OVERRIDE') then
277       hr_utility.set_location(l_proc, 15);
278       --
279       -- As the datetrack mode is 'UPDATE_OVERRIDE' then we must
280       -- delete any future rows
281       --
282       ben_elu_del.delete_dml
283         (p_rec			 => p_rec,
284 	 p_effective_date	 => p_effective_date,
285 	 p_datetrack_mode	 => p_datetrack_mode,
286 	 p_validation_start_date => p_validation_start_date,
287 	 p_validation_end_date   => p_validation_end_date);
288     End If;
289     hr_utility.set_location(l_proc, 20);
290     --
291     -- We must now insert the updated row
292     --
293     ben_elu_ins.insert_dml
294       (p_rec			=> p_rec,
295        p_effective_date		=> p_effective_date,
296        p_datetrack_mode		=> p_datetrack_mode,
297        p_validation_start_date	=> p_validation_start_date,
298        p_validation_end_date	=> p_validation_end_date);
299   End If;
300   hr_utility.set_location(' Leaving:'||l_proc, 20);
301 End dt_pre_update;
302 --
303 -- ----------------------------------------------------------------------------
304 -- |------------------------------< pre_update >------------------------------|
305 -- ----------------------------------------------------------------------------
306 -- {Start Of Comments}
307 --
308 -- Description:
309 --   This private procedure contains any processing which is required before
310 --   the update dml.
311 --
312 -- Prerequisites:
313 --   This is an internal procedure which is called from the upd procedure.
314 --
315 -- In Parameters:
316 --   A Pl/Sql record structre.
317 --
318 -- Post Success:
319 --   Processing continues.
320 --
321 -- Post Failure:
322 --   If an error has occurred, an error message and exception will be raised
323 --   but not handled.
324 --
325 -- Developer Implementation Notes:
326 --   Any pre-processing required before the update dml is issued should be
327 --   coded within this procedure. It is important to note that any 3rd party
328 --   maintenance should be reviewed before placing in this procedure. The call
329 --   to the dt_update_dml procedure should NOT be removed.
330 --
331 -- Access Status:
332 --   Internal Row Handler Use Only.
333 --
334 -- {End Of Comments}
335 -- ----------------------------------------------------------------------------
336 Procedure pre_update
337 	(p_rec 			 in out nocopy ben_elu_shd.g_rec_type,
338 	 p_effective_date	 in	date,
339 	 p_datetrack_mode	 in	varchar2,
340 	 p_validation_start_date in	date,
341 	 p_validation_end_date	 in	date) is
342 --
343   l_proc	varchar2(72) := g_package||'pre_update';
344 --
345 Begin
346   hr_utility.set_location('Entering:'||l_proc, 5);
347   --
348   --
349   --
350   dt_pre_update
351     (p_rec 		     => p_rec,
352      p_effective_date	     => p_effective_date,
353      p_datetrack_mode	     => p_datetrack_mode,
354      p_validation_start_date => p_validation_start_date,
355      p_validation_end_date   => p_validation_end_date);
356   --
357   hr_utility.set_location(' Leaving:'||l_proc, 10);
358 End pre_update;
359 --
360 -- ----------------------------------------------------------------------------
361 -- |-----------------------------< post_update >------------------------------|
362 -- ----------------------------------------------------------------------------
363 -- {Start Of Comments}
364 --
365 -- Description:
366 --   This private procedure contains any processing which is required after the
367 --   update dml.
368 --
369 -- Prerequisites:
370 --   This is an internal procedure which is called from the upd procedure.
371 --
372 -- In Parameters:
373 --   A Pl/Sql record structre.
374 --
375 -- Post Success:
376 --   Processing continues.
377 --
378 -- Post Failure:
379 --   If an error has occurred, an error message and exception will be raised
380 --   but not handled.
381 --
382 -- Developer Implementation Notes:
383 --   Any post-processing required after the update dml is issued should be
384 --   coded within this procedure. It is important to note that any 3rd party
385 --   maintenance should be reviewed before placing in this procedure.
386 --
387 -- Access Status:
388 --   Internal Row Handler Use Only.
389 --
390 -- {End Of Comments}
391 -- ----------------------------------------------------------------------------
392 Procedure post_update
393 	(p_rec 			 in ben_elu_shd.g_rec_type,
394 	 p_effective_date	 in date,
395 	 p_datetrack_mode	 in varchar2,
396 	 p_validation_start_date in date,
397 	 p_validation_end_date	 in date) is
398 --
399   l_proc	varchar2(72) := g_package||'post_update';
400 --
401 Begin
402   hr_utility.set_location('Entering:'||l_proc, 5);
403 --
404   --
405   -- Start of API User Hook for post_update.
406   --
407   begin
408     --
409     ben_elu_rku.after_update
410       (
411   p_elig_lbr_mmbr_prte_id         =>p_rec.elig_lbr_mmbr_prte_id
412  ,p_effective_start_date          =>p_rec.effective_start_date
413  ,p_effective_end_date            =>p_rec.effective_end_date
414  ,p_eligy_prfl_id                 =>p_rec.eligy_prfl_id
415  ,p_excld_flag                    =>p_rec.excld_flag
416  ,p_lbr_mmbr_flag                 =>p_rec.lbr_mmbr_flag
417  ,p_ordr_num                      =>p_rec.ordr_num
418  ,p_business_group_id             =>p_rec.business_group_id
419  ,p_elu_attribute_category        =>p_rec.elu_attribute_category
420  ,p_elu_attribute1                =>p_rec.elu_attribute1
421  ,p_elu_attribute2                =>p_rec.elu_attribute2
422  ,p_elu_attribute3                =>p_rec.elu_attribute3
423  ,p_elu_attribute4                =>p_rec.elu_attribute4
424  ,p_elu_attribute5                =>p_rec.elu_attribute5
425  ,p_elu_attribute6                =>p_rec.elu_attribute6
426  ,p_elu_attribute7                =>p_rec.elu_attribute7
427  ,p_elu_attribute8                =>p_rec.elu_attribute8
428  ,p_elu_attribute9                =>p_rec.elu_attribute9
429  ,p_elu_attribute10               =>p_rec.elu_attribute10
430  ,p_elu_attribute11               =>p_rec.elu_attribute11
431  ,p_elu_attribute12               =>p_rec.elu_attribute12
432  ,p_elu_attribute13               =>p_rec.elu_attribute13
433  ,p_elu_attribute14               =>p_rec.elu_attribute14
434  ,p_elu_attribute15               =>p_rec.elu_attribute15
435  ,p_elu_attribute16               =>p_rec.elu_attribute16
436  ,p_elu_attribute17               =>p_rec.elu_attribute17
437  ,p_elu_attribute18               =>p_rec.elu_attribute18
438  ,p_elu_attribute19               =>p_rec.elu_attribute19
439  ,p_elu_attribute20               =>p_rec.elu_attribute20
440  ,p_elu_attribute21               =>p_rec.elu_attribute21
441  ,p_elu_attribute22               =>p_rec.elu_attribute22
442  ,p_elu_attribute23               =>p_rec.elu_attribute23
443  ,p_elu_attribute24               =>p_rec.elu_attribute24
444  ,p_elu_attribute25               =>p_rec.elu_attribute25
445  ,p_elu_attribute26               =>p_rec.elu_attribute26
446  ,p_elu_attribute27               =>p_rec.elu_attribute27
447  ,p_elu_attribute28               =>p_rec.elu_attribute28
448  ,p_elu_attribute29               =>p_rec.elu_attribute29
449  ,p_elu_attribute30               =>p_rec.elu_attribute30
450  ,p_object_version_number         =>p_rec.object_version_number
451  ,p_effective_date                =>p_effective_date
452  ,p_datetrack_mode                =>p_datetrack_mode
453  ,p_validation_start_date         =>p_validation_start_date
454  ,p_validation_end_date           =>p_validation_end_date
455  ,p_effective_start_date_o        =>ben_elu_shd.g_old_rec.effective_start_date
456  ,p_effective_end_date_o          =>ben_elu_shd.g_old_rec.effective_end_date
457  ,p_eligy_prfl_id_o               =>ben_elu_shd.g_old_rec.eligy_prfl_id
458  ,p_excld_flag_o                  =>ben_elu_shd.g_old_rec.excld_flag
459  ,p_lbr_mmbr_flag_o               =>ben_elu_shd.g_old_rec.lbr_mmbr_flag
460  ,p_ordr_num_o                    =>ben_elu_shd.g_old_rec.ordr_num
461  ,p_business_group_id_o           =>ben_elu_shd.g_old_rec.business_group_id
462  ,p_elu_attribute_category_o      =>ben_elu_shd.g_old_rec.elu_attribute_category
463  ,p_elu_attribute1_o              =>ben_elu_shd.g_old_rec.elu_attribute1
464  ,p_elu_attribute2_o              =>ben_elu_shd.g_old_rec.elu_attribute2
465  ,p_elu_attribute3_o              =>ben_elu_shd.g_old_rec.elu_attribute3
466  ,p_elu_attribute4_o              =>ben_elu_shd.g_old_rec.elu_attribute4
467  ,p_elu_attribute5_o              =>ben_elu_shd.g_old_rec.elu_attribute5
468  ,p_elu_attribute6_o              =>ben_elu_shd.g_old_rec.elu_attribute6
469  ,p_elu_attribute7_o              =>ben_elu_shd.g_old_rec.elu_attribute7
470  ,p_elu_attribute8_o              =>ben_elu_shd.g_old_rec.elu_attribute8
471  ,p_elu_attribute9_o              =>ben_elu_shd.g_old_rec.elu_attribute9
472  ,p_elu_attribute10_o             =>ben_elu_shd.g_old_rec.elu_attribute10
473  ,p_elu_attribute11_o             =>ben_elu_shd.g_old_rec.elu_attribute11
474  ,p_elu_attribute12_o             =>ben_elu_shd.g_old_rec.elu_attribute12
475  ,p_elu_attribute13_o             =>ben_elu_shd.g_old_rec.elu_attribute13
476  ,p_elu_attribute14_o             =>ben_elu_shd.g_old_rec.elu_attribute14
477  ,p_elu_attribute15_o             =>ben_elu_shd.g_old_rec.elu_attribute15
478  ,p_elu_attribute16_o             =>ben_elu_shd.g_old_rec.elu_attribute16
479  ,p_elu_attribute17_o             =>ben_elu_shd.g_old_rec.elu_attribute17
480  ,p_elu_attribute18_o             =>ben_elu_shd.g_old_rec.elu_attribute18
481  ,p_elu_attribute19_o             =>ben_elu_shd.g_old_rec.elu_attribute19
482  ,p_elu_attribute20_o             =>ben_elu_shd.g_old_rec.elu_attribute20
483  ,p_elu_attribute21_o             =>ben_elu_shd.g_old_rec.elu_attribute21
484  ,p_elu_attribute22_o             =>ben_elu_shd.g_old_rec.elu_attribute22
485  ,p_elu_attribute23_o             =>ben_elu_shd.g_old_rec.elu_attribute23
486  ,p_elu_attribute24_o             =>ben_elu_shd.g_old_rec.elu_attribute24
487  ,p_elu_attribute25_o             =>ben_elu_shd.g_old_rec.elu_attribute25
488  ,p_elu_attribute26_o             =>ben_elu_shd.g_old_rec.elu_attribute26
489  ,p_elu_attribute27_o             =>ben_elu_shd.g_old_rec.elu_attribute27
490  ,p_elu_attribute28_o             =>ben_elu_shd.g_old_rec.elu_attribute28
491  ,p_elu_attribute29_o             =>ben_elu_shd.g_old_rec.elu_attribute29
492  ,p_elu_attribute30_o             =>ben_elu_shd.g_old_rec.elu_attribute30
493  ,p_object_version_number_o       =>ben_elu_shd.g_old_rec.object_version_number
494  ,p_criteria_score				=> p_rec.criteria_score
495  ,p_criteria_weight				=> p_rec.criteria_weight
496 
497   ,p_criteria_score_o				=> ben_elu_shd.g_old_rec.criteria_score
498  ,p_criteria_weight_o				=> ben_elu_shd.g_old_rec.criteria_weight
499 
500       );
501     --
502   exception
503     --
504     when hr_api.cannot_find_prog_unit then
505       --
506       hr_api.cannot_find_prog_unit_error
507         (p_module_name => 'ben_elig_lbr_mmbr_prte_f'
508         ,p_hook_type   => 'AU');
509       --
510   end;
511   --
512   -- End of API User Hook for post_update.
513   --
514   --
515   hr_utility.set_location(' Leaving:'||l_proc, 10);
516 End post_update;
517 --
518 -- ----------------------------------------------------------------------------
519 -- |-----------------------------< convert_defs >-----------------------------|
520 -- ----------------------------------------------------------------------------
521 -- {Start Of Comments}
522 --
523 -- Description:
524 --   The Convert_Defs procedure has one very important function:
525 --   It must return the record structure for the row with all system defaulted
526 --   values converted into its corresponding parameter value for update. When
527 --   we attempt to update a row through the Upd process , certain
528 --   parameters can be defaulted which enables flexibility in the calling of
529 --   the upd process (e.g. only attributes which need to be updated need to be
530 --   specified). For the upd process to determine which attributes
531 --   have NOT been specified we need to check if the parameter has a reserved
532 --   system default value. Therefore, for all parameters which have a
533 --   corresponding reserved system default mechanism specified we need to
534 --   check if a system default is being used. If a system default is being
535 --   used then we convert the defaulted value into its corresponding attribute
536 --   value held in the g_old_rec data structure.
537 --
538 -- Prerequisites:
539 --   This private function can only be called from the upd process.
540 --
541 -- In Parameters:
542 --   A Pl/Sql record structre.
543 --
544 -- Post Success:
545 --   The record structure will be returned with all system defaulted parameter
546 --   values converted into its current row attribute value.
547 --
548 -- Post Failure:
549 --   No direct error handling is required within this function. Any possible
550 --   errors within this procedure will be a PL/SQL value error due to conversion
551 --   of datatypes or data lengths.
552 --
553 -- Developer Implementation Notes:
554 --   None.
555 --
556 -- Access Status:
557 --   Internal Row Handler Use Only.
558 --
559 -- {End Of Comments}
560 -- ----------------------------------------------------------------------------
561 Procedure convert_defs(p_rec in out nocopy ben_elu_shd.g_rec_type) is
562 --
563   l_proc  varchar2(72) := g_package||'convert_defs';
564 --
565 Begin
566   --
567   hr_utility.set_location('Entering:'||l_proc, 5);
568   --
569   -- We must now examine each argument value in the
570   -- p_rec plsql record structure
571   -- to see if a system default is being used. If a system default
572   -- is being used then we must set to the 'current' argument value.
573   --
574   If (p_rec.eligy_prfl_id = hr_api.g_number) then
575     p_rec.eligy_prfl_id :=
576     ben_elu_shd.g_old_rec.eligy_prfl_id;
577   End If;
578   If (p_rec.excld_flag = hr_api.g_varchar2) then
579     p_rec.excld_flag :=
580     ben_elu_shd.g_old_rec.excld_flag;
581   End If;
582   If (p_rec.lbr_mmbr_flag = hr_api.g_varchar2) then
583     p_rec.lbr_mmbr_flag :=
584     ben_elu_shd.g_old_rec.lbr_mmbr_flag;
585   End If;
586   If (p_rec.ordr_num = hr_api.g_number) then
587     p_rec.ordr_num :=
588     ben_elu_shd.g_old_rec.ordr_num;
589   End If;
590   If (p_rec.business_group_id = hr_api.g_number) then
591     p_rec.business_group_id :=
592     ben_elu_shd.g_old_rec.business_group_id;
593   End If;
594   If (p_rec.elu_attribute_category = hr_api.g_varchar2) then
595     p_rec.elu_attribute_category :=
596     ben_elu_shd.g_old_rec.elu_attribute_category;
597   End If;
598   If (p_rec.elu_attribute1 = hr_api.g_varchar2) then
599     p_rec.elu_attribute1 :=
600     ben_elu_shd.g_old_rec.elu_attribute1;
601   End If;
602   If (p_rec.elu_attribute2 = hr_api.g_varchar2) then
603     p_rec.elu_attribute2 :=
604     ben_elu_shd.g_old_rec.elu_attribute2;
605   End If;
606   If (p_rec.elu_attribute3 = hr_api.g_varchar2) then
607     p_rec.elu_attribute3 :=
608     ben_elu_shd.g_old_rec.elu_attribute3;
609   End If;
610   If (p_rec.elu_attribute4 = hr_api.g_varchar2) then
611     p_rec.elu_attribute4 :=
612     ben_elu_shd.g_old_rec.elu_attribute4;
613   End If;
614   If (p_rec.elu_attribute5 = hr_api.g_varchar2) then
615     p_rec.elu_attribute5 :=
616     ben_elu_shd.g_old_rec.elu_attribute5;
617   End If;
618   If (p_rec.elu_attribute6 = hr_api.g_varchar2) then
619     p_rec.elu_attribute6 :=
620     ben_elu_shd.g_old_rec.elu_attribute6;
621   End If;
622   If (p_rec.elu_attribute7 = hr_api.g_varchar2) then
623     p_rec.elu_attribute7 :=
624     ben_elu_shd.g_old_rec.elu_attribute7;
625   End If;
626   If (p_rec.elu_attribute8 = hr_api.g_varchar2) then
627     p_rec.elu_attribute8 :=
628     ben_elu_shd.g_old_rec.elu_attribute8;
629   End If;
630   If (p_rec.elu_attribute9 = hr_api.g_varchar2) then
631     p_rec.elu_attribute9 :=
632     ben_elu_shd.g_old_rec.elu_attribute9;
633   End If;
634   If (p_rec.elu_attribute10 = hr_api.g_varchar2) then
635     p_rec.elu_attribute10 :=
636     ben_elu_shd.g_old_rec.elu_attribute10;
637   End If;
638   If (p_rec.elu_attribute11 = hr_api.g_varchar2) then
639     p_rec.elu_attribute11 :=
640     ben_elu_shd.g_old_rec.elu_attribute11;
641   End If;
642   If (p_rec.elu_attribute12 = hr_api.g_varchar2) then
643     p_rec.elu_attribute12 :=
644     ben_elu_shd.g_old_rec.elu_attribute12;
645   End If;
646   If (p_rec.elu_attribute13 = hr_api.g_varchar2) then
647     p_rec.elu_attribute13 :=
648     ben_elu_shd.g_old_rec.elu_attribute13;
649   End If;
650   If (p_rec.elu_attribute14 = hr_api.g_varchar2) then
651     p_rec.elu_attribute14 :=
652     ben_elu_shd.g_old_rec.elu_attribute14;
653   End If;
654   If (p_rec.elu_attribute15 = hr_api.g_varchar2) then
655     p_rec.elu_attribute15 :=
656     ben_elu_shd.g_old_rec.elu_attribute15;
657   End If;
658   If (p_rec.elu_attribute16 = hr_api.g_varchar2) then
659     p_rec.elu_attribute16 :=
660     ben_elu_shd.g_old_rec.elu_attribute16;
661   End If;
662   If (p_rec.elu_attribute17 = hr_api.g_varchar2) then
663     p_rec.elu_attribute17 :=
664     ben_elu_shd.g_old_rec.elu_attribute17;
665   End If;
666   If (p_rec.elu_attribute18 = hr_api.g_varchar2) then
667     p_rec.elu_attribute18 :=
668     ben_elu_shd.g_old_rec.elu_attribute18;
669   End If;
670   If (p_rec.elu_attribute19 = hr_api.g_varchar2) then
671     p_rec.elu_attribute19 :=
672     ben_elu_shd.g_old_rec.elu_attribute19;
673   End If;
674   If (p_rec.elu_attribute20 = hr_api.g_varchar2) then
675     p_rec.elu_attribute20 :=
676     ben_elu_shd.g_old_rec.elu_attribute20;
677   End If;
678   If (p_rec.elu_attribute21 = hr_api.g_varchar2) then
679     p_rec.elu_attribute21 :=
680     ben_elu_shd.g_old_rec.elu_attribute21;
681   End If;
682   If (p_rec.elu_attribute22 = hr_api.g_varchar2) then
683     p_rec.elu_attribute22 :=
684     ben_elu_shd.g_old_rec.elu_attribute22;
685   End If;
686   If (p_rec.elu_attribute23 = hr_api.g_varchar2) then
687     p_rec.elu_attribute23 :=
688     ben_elu_shd.g_old_rec.elu_attribute23;
689   End If;
690   If (p_rec.elu_attribute24 = hr_api.g_varchar2) then
691     p_rec.elu_attribute24 :=
692     ben_elu_shd.g_old_rec.elu_attribute24;
693   End If;
694   If (p_rec.elu_attribute25 = hr_api.g_varchar2) then
695     p_rec.elu_attribute25 :=
696     ben_elu_shd.g_old_rec.elu_attribute25;
697   End If;
698   If (p_rec.elu_attribute26 = hr_api.g_varchar2) then
699     p_rec.elu_attribute26 :=
700     ben_elu_shd.g_old_rec.elu_attribute26;
701   End If;
702   If (p_rec.elu_attribute27 = hr_api.g_varchar2) then
703     p_rec.elu_attribute27 :=
704     ben_elu_shd.g_old_rec.elu_attribute27;
705   End If;
706   If (p_rec.elu_attribute28 = hr_api.g_varchar2) then
707     p_rec.elu_attribute28 :=
708     ben_elu_shd.g_old_rec.elu_attribute28;
709   End If;
710   If (p_rec.elu_attribute29 = hr_api.g_varchar2) then
711     p_rec.elu_attribute29 :=
712     ben_elu_shd.g_old_rec.elu_attribute29;
713   End If;
714   If (p_rec.elu_attribute30 = hr_api.g_varchar2) then
715     p_rec.elu_attribute30 :=
716     ben_elu_shd.g_old_rec.elu_attribute30;
717   End If;
718 
719   If (p_rec.criteria_score = hr_api.g_number) then
720     p_rec.criteria_score :=
721     ben_elu_shd.g_old_rec.criteria_score;
722   End If;
723 
724 
725  If (p_rec.criteria_weight = hr_api.g_number) then
726     p_rec.criteria_weight :=
727     ben_elu_shd.g_old_rec.criteria_weight;
728   End If;
729 
730   --
731   hr_utility.set_location(' Leaving:'||l_proc, 10);
732 --
733 End convert_defs;
734 --
735 -- ----------------------------------------------------------------------------
736 -- |---------------------------------< upd >----------------------------------|
737 -- ----------------------------------------------------------------------------
738 Procedure upd
739   (
740   p_rec			in out nocopy 	ben_elu_shd.g_rec_type,
741   p_effective_date	in 	date,
742   p_datetrack_mode	in 	varchar2
743   ) is
744 --
745   l_proc			varchar2(72) := g_package||'upd';
746   l_validation_start_date	date;
747   l_validation_end_date		date;
748 --
749 Begin
750   hr_utility.set_location('Entering:'||l_proc, 5);
751   --
752   -- Ensure that the DateTrack update mode is valid
753   --
754   dt_api.validate_dt_upd_mode(p_datetrack_mode => p_datetrack_mode);
755   --
756   -- We must lock the row which we need to update.
757   --
758   ben_elu_shd.lck
759 	(p_effective_date	 => p_effective_date,
760       	 p_datetrack_mode	 => p_datetrack_mode,
761       	 p_elig_lbr_mmbr_prte_id	 => p_rec.elig_lbr_mmbr_prte_id,
762       	 p_object_version_number => p_rec.object_version_number,
763       	 p_validation_start_date => l_validation_start_date,
764       	 p_validation_end_date	 => l_validation_end_date);
765   --
766   -- 1. During an update system defaults are used to determine if
767   --    arguments have been defaulted or not. We must therefore
768   --    derive the full record structure values to be updated.
769   --
770   -- 2. Call the supporting update validate operations.
771   --
772   convert_defs(p_rec);
773   ben_elu_bus.update_validate
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   --
780   -- Call the supporting pre-update operation
781   --
782   pre_update
783 	(p_rec			 => p_rec,
784 	 p_effective_date	 => p_effective_date,
785 	 p_datetrack_mode	 => p_datetrack_mode,
786 	 p_validation_start_date => l_validation_start_date,
787 	 p_validation_end_date	 => l_validation_end_date);
788   --
789   -- Update the row.
790   --
791   update_dml
792 	(p_rec			 => p_rec,
793 	 p_effective_date	 => p_effective_date,
794 	 p_datetrack_mode	 => p_datetrack_mode,
795 	 p_validation_start_date => l_validation_start_date,
796 	 p_validation_end_date	 => l_validation_end_date);
797   --
798   -- Call the supporting post-update operation
799   --
800   post_update
801 	(p_rec			 => p_rec,
802 	 p_effective_date	 => p_effective_date,
803 	 p_datetrack_mode	 => p_datetrack_mode,
804 	 p_validation_start_date => l_validation_start_date,
805 	 p_validation_end_date	 => l_validation_end_date);
806 End upd;
807 --
808 -- ----------------------------------------------------------------------------
809 -- |---------------------------------< upd >----------------------------------|
810 -- ----------------------------------------------------------------------------
811 Procedure upd
812   (
813   p_elig_lbr_mmbr_prte_id        in number,
814   p_effective_start_date         out nocopy date,
815   p_effective_end_date           out nocopy date,
816   p_eligy_prfl_id                in number           default hr_api.g_number,
817   p_excld_flag                   in varchar2         default hr_api.g_varchar2,
818   p_lbr_mmbr_flag                in varchar2         default hr_api.g_varchar2,
819   p_ordr_num                     in number           default hr_api.g_number,
820   p_business_group_id            in number           default hr_api.g_number,
821   p_elu_attribute_category       in varchar2         default hr_api.g_varchar2,
822   p_elu_attribute1               in varchar2         default hr_api.g_varchar2,
823   p_elu_attribute2               in varchar2         default hr_api.g_varchar2,
824   p_elu_attribute3               in varchar2         default hr_api.g_varchar2,
825   p_elu_attribute4               in varchar2         default hr_api.g_varchar2,
826   p_elu_attribute5               in varchar2         default hr_api.g_varchar2,
827   p_elu_attribute6               in varchar2         default hr_api.g_varchar2,
828   p_elu_attribute7               in varchar2         default hr_api.g_varchar2,
829   p_elu_attribute8               in varchar2         default hr_api.g_varchar2,
830   p_elu_attribute9               in varchar2         default hr_api.g_varchar2,
831   p_elu_attribute10              in varchar2         default hr_api.g_varchar2,
832   p_elu_attribute11              in varchar2         default hr_api.g_varchar2,
833   p_elu_attribute12              in varchar2         default hr_api.g_varchar2,
834   p_elu_attribute13              in varchar2         default hr_api.g_varchar2,
835   p_elu_attribute14              in varchar2         default hr_api.g_varchar2,
836   p_elu_attribute15              in varchar2         default hr_api.g_varchar2,
837   p_elu_attribute16              in varchar2         default hr_api.g_varchar2,
838   p_elu_attribute17              in varchar2         default hr_api.g_varchar2,
839   p_elu_attribute18              in varchar2         default hr_api.g_varchar2,
840   p_elu_attribute19              in varchar2         default hr_api.g_varchar2,
841   p_elu_attribute20              in varchar2         default hr_api.g_varchar2,
842   p_elu_attribute21              in varchar2         default hr_api.g_varchar2,
843   p_elu_attribute22              in varchar2         default hr_api.g_varchar2,
844   p_elu_attribute23              in varchar2         default hr_api.g_varchar2,
845   p_elu_attribute24              in varchar2         default hr_api.g_varchar2,
846   p_elu_attribute25              in varchar2         default hr_api.g_varchar2,
847   p_elu_attribute26              in varchar2         default hr_api.g_varchar2,
848   p_elu_attribute27              in varchar2         default hr_api.g_varchar2,
849   p_elu_attribute28              in varchar2         default hr_api.g_varchar2,
850   p_elu_attribute29              in varchar2         default hr_api.g_varchar2,
851   p_elu_attribute30              in varchar2         default hr_api.g_varchar2,
852   p_object_version_number        in out nocopy number,
853   p_effective_date		 in date,
854   p_datetrack_mode		 in varchar2 ,
855   p_criteria_score		in number			default hr_api.g_number,
856     p_criteria_weight		in number			default hr_api.g_number
857   ) is
858 --
859   l_rec		ben_elu_shd.g_rec_type;
860   l_proc	varchar2(72) := g_package||'upd';
861 --
862 Begin
863   hr_utility.set_location('Entering:'||l_proc, 5);
864   --
865   -- Call conversion function to turn arguments into the
866   -- l_rec structure.
867   --
868   l_rec :=
869   ben_elu_shd.convert_args
870   (
871   p_elig_lbr_mmbr_prte_id,
872   null,
873   null,
874   p_eligy_prfl_id,
875   p_excld_flag,
876   p_lbr_mmbr_flag,
877   p_ordr_num,
878   p_business_group_id,
879   p_elu_attribute_category,
880   p_elu_attribute1,
881   p_elu_attribute2,
882   p_elu_attribute3,
883   p_elu_attribute4,
884   p_elu_attribute5,
885   p_elu_attribute6,
886   p_elu_attribute7,
887   p_elu_attribute8,
888   p_elu_attribute9,
889   p_elu_attribute10,
890   p_elu_attribute11,
891   p_elu_attribute12,
892   p_elu_attribute13,
893   p_elu_attribute14,
894   p_elu_attribute15,
895   p_elu_attribute16,
896   p_elu_attribute17,
897   p_elu_attribute18,
898   p_elu_attribute19,
899   p_elu_attribute20,
900   p_elu_attribute21,
901   p_elu_attribute22,
902   p_elu_attribute23,
903   p_elu_attribute24,
904   p_elu_attribute25,
905   p_elu_attribute26,
906   p_elu_attribute27,
907   p_elu_attribute28,
908   p_elu_attribute29,
909   p_elu_attribute30,
910   p_object_version_number ,
911   p_criteria_score,
912     p_criteria_weight
913   );
914   --
915   -- Having converted the arguments into the
916   -- plsql record structure we call the corresponding record
917   -- business process.
918   --
919   upd(l_rec, p_effective_date, p_datetrack_mode);
920   p_object_version_number       := l_rec.object_version_number;
921   p_effective_start_date        := l_rec.effective_start_date;
922   p_effective_end_date          := l_rec.effective_end_date;
923   --
924   --
925   hr_utility.set_location(' Leaving:'||l_proc, 10);
926 End upd;
927 --
928 end ben_elu_upd;