DBA Data[Home] [Help]

PACKAGE BODY: APPS.BEN_DCO_UPD

Source


1 Package Body ben_dco_upd as
2 /* $Header: bedcorhi.pkb 120.2 2006/03/30 23:58:46 gsehgal noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33)	:= '  ben_dco_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_dco_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_dpnt_cvrd_othr_ptip_rt_f',
78 	   p_base_key_column	=> 'dpnt_cvrd_othr_ptip_rt_id',
79 	   p_base_key_value	=> p_rec.dpnt_cvrd_othr_ptip_rt_id);
80     --
81     ben_dco_shd.g_api_dml := true;  -- Set the api dml status
82     --
83     -- Update the ben_dpnt_cvrd_othr_ptip_rt_f Row
84     --
85     update  ben_dpnt_cvrd_othr_ptip_rt_f
86     set
87         dpnt_cvrd_othr_ptip_rt_id     = p_rec.dpnt_cvrd_othr_ptip_rt_id,
88     excld_flag                      = p_rec.excld_flag,
89     ordr_num                        = p_rec.ordr_num,
90     enrl_det_dt_cd                  = p_rec.enrl_det_dt_cd,
91     only_pls_subj_cobra_flag        = p_rec.only_pls_subj_cobra_flag,
92     ptip_id                         = p_rec.ptip_id,
93     vrbl_rt_prfl_id                   = p_rec.vrbl_rt_prfl_id,
94     business_group_id               = p_rec.business_group_id,
95     dco_attribute_category          = p_rec.dco_attribute_category,
96     dco_attribute1                  = p_rec.dco_attribute1,
97     dco_attribute2                  = p_rec.dco_attribute2,
98     dco_attribute3                  = p_rec.dco_attribute3,
99     dco_attribute4                  = p_rec.dco_attribute4,
100     dco_attribute5                  = p_rec.dco_attribute5,
101     dco_attribute6                  = p_rec.dco_attribute6,
102     dco_attribute7                  = p_rec.dco_attribute7,
103     dco_attribute8                  = p_rec.dco_attribute8,
104     dco_attribute9                  = p_rec.dco_attribute9,
105     dco_attribute10                 = p_rec.dco_attribute10,
106     dco_attribute11                 = p_rec.dco_attribute11,
107     dco_attribute12                 = p_rec.dco_attribute12,
108     dco_attribute13                 = p_rec.dco_attribute13,
109     dco_attribute14                 = p_rec.dco_attribute14,
110     dco_attribute15                 = p_rec.dco_attribute15,
111     dco_attribute16                 = p_rec.dco_attribute16,
112     dco_attribute17                 = p_rec.dco_attribute17,
113     dco_attribute18                 = p_rec.dco_attribute18,
114     dco_attribute19                 = p_rec.dco_attribute19,
115     dco_attribute20                 = p_rec.dco_attribute20,
116     dco_attribute21                 = p_rec.dco_attribute21,
117     dco_attribute22                 = p_rec.dco_attribute22,
118     dco_attribute23                 = p_rec.dco_attribute23,
119     dco_attribute24                 = p_rec.dco_attribute24,
120     dco_attribute25                 = p_rec.dco_attribute25,
121     dco_attribute26                 = p_rec.dco_attribute26,
122     dco_attribute27                 = p_rec.dco_attribute27,
123     dco_attribute28                 = p_rec.dco_attribute28,
124     dco_attribute29                 = p_rec.dco_attribute29,
125     dco_attribute30                 = p_rec.dco_attribute30,
126     object_version_number           = p_rec.object_version_number
127     where   dpnt_cvrd_othr_ptip_rt_id = p_rec.dpnt_cvrd_othr_ptip_rt_id
128     and     effective_start_date = p_validation_start_date
129     and     effective_end_date   = p_validation_end_date;
130     --
131     ben_dco_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_dco_shd.g_api_dml := false;   -- Unset the api dml status
144     ben_dco_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_dco_shd.g_api_dml := false;   -- Unset the api dml status
149     ben_dco_shd.constraint_error
150       (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
151   When Others Then
152     ben_dco_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_dco_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_dco_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_dco_shd.upd_effective_end_date
269      (p_effective_date	       => p_effective_date,
270       p_base_key_value	       => p_rec.dpnt_cvrd_othr_ptip_rt_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_dco_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_dco_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_dco_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_dco_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_dco_rku.after_update
410       (
411   p_dpnt_cvrd_othr_ptip_rt_id   =>p_rec.dpnt_cvrd_othr_ptip_rt_id
412  ,p_effective_start_date          =>p_rec.effective_start_date
413  ,p_effective_end_date            =>p_rec.effective_end_date
414  ,p_excld_flag                    =>p_rec.excld_flag
415  ,p_ordr_num                      =>p_rec.ordr_num
416  ,p_enrl_det_dt_cd                =>p_rec.enrl_det_dt_cd
417  ,p_only_pls_subj_cobra_flag      =>p_rec.only_pls_subj_cobra_flag
418  ,p_ptip_id                       =>p_rec.ptip_id
419  ,p_vrbl_rt_prfl_id                 =>p_rec.vrbl_rt_prfl_id
420  ,p_business_group_id             =>p_rec.business_group_id
421  ,p_dco_attribute_category        =>p_rec.dco_attribute_category
422  ,p_dco_attribute1                =>p_rec.dco_attribute1
423  ,p_dco_attribute2                =>p_rec.dco_attribute2
424  ,p_dco_attribute3                =>p_rec.dco_attribute3
425  ,p_dco_attribute4                =>p_rec.dco_attribute4
426  ,p_dco_attribute5                =>p_rec.dco_attribute5
427  ,p_dco_attribute6                =>p_rec.dco_attribute6
428  ,p_dco_attribute7                =>p_rec.dco_attribute7
429  ,p_dco_attribute8                =>p_rec.dco_attribute8
430  ,p_dco_attribute9                =>p_rec.dco_attribute9
431  ,p_dco_attribute10               =>p_rec.dco_attribute10
432  ,p_dco_attribute11               =>p_rec.dco_attribute11
433  ,p_dco_attribute12               =>p_rec.dco_attribute12
434  ,p_dco_attribute13               =>p_rec.dco_attribute13
435  ,p_dco_attribute14               =>p_rec.dco_attribute14
436  ,p_dco_attribute15               =>p_rec.dco_attribute15
437  ,p_dco_attribute16               =>p_rec.dco_attribute16
438  ,p_dco_attribute17               =>p_rec.dco_attribute17
439  ,p_dco_attribute18               =>p_rec.dco_attribute18
440  ,p_dco_attribute19               =>p_rec.dco_attribute19
441  ,p_dco_attribute20               =>p_rec.dco_attribute20
442  ,p_dco_attribute21               =>p_rec.dco_attribute21
443  ,p_dco_attribute22               =>p_rec.dco_attribute22
444  ,p_dco_attribute23               =>p_rec.dco_attribute23
445  ,p_dco_attribute24               =>p_rec.dco_attribute24
446  ,p_dco_attribute25               =>p_rec.dco_attribute25
447  ,p_dco_attribute26               =>p_rec.dco_attribute26
448  ,p_dco_attribute27               =>p_rec.dco_attribute27
449  ,p_dco_attribute28               =>p_rec.dco_attribute28
450  ,p_dco_attribute29               =>p_rec.dco_attribute29
451  ,p_dco_attribute30               =>p_rec.dco_attribute30
452  ,p_object_version_number         =>p_rec.object_version_number
453  ,p_effective_date                =>p_effective_date
454  ,p_datetrack_mode                =>p_datetrack_mode
455  ,p_validation_start_date         =>p_validation_start_date
456  ,p_validation_end_date           =>p_validation_end_date
457  ,p_effective_start_date_o        =>ben_dco_shd.g_old_rec.effective_start_date
458  ,p_effective_end_date_o          =>ben_dco_shd.g_old_rec.effective_end_date
459  ,p_excld_flag_o                  =>ben_dco_shd.g_old_rec.excld_flag
460  ,p_ordr_num_o                    =>ben_dco_shd.g_old_rec.ordr_num
461  ,p_enrl_det_dt_cd_o              =>ben_dco_shd.g_old_rec.enrl_det_dt_cd
462  ,p_only_pls_subj_cobra_flag_o    =>ben_dco_shd.g_old_rec.only_pls_subj_cobra_flag
463  ,p_ptip_id_o                     =>ben_dco_shd.g_old_rec.ptip_id
464  ,p_vrbl_rt_prfl_id_o               =>ben_dco_shd.g_old_rec.vrbl_rt_prfl_id
465  ,p_business_group_id_o           =>ben_dco_shd.g_old_rec.business_group_id
466  ,p_dco_attribute_category_o      =>ben_dco_shd.g_old_rec.dco_attribute_category
467  ,p_dco_attribute1_o              =>ben_dco_shd.g_old_rec.dco_attribute1
468  ,p_dco_attribute2_o              =>ben_dco_shd.g_old_rec.dco_attribute2
469  ,p_dco_attribute3_o              =>ben_dco_shd.g_old_rec.dco_attribute3
470  ,p_dco_attribute4_o              =>ben_dco_shd.g_old_rec.dco_attribute4
471  ,p_dco_attribute5_o              =>ben_dco_shd.g_old_rec.dco_attribute5
472  ,p_dco_attribute6_o              =>ben_dco_shd.g_old_rec.dco_attribute6
473  ,p_dco_attribute7_o              =>ben_dco_shd.g_old_rec.dco_attribute7
474  ,p_dco_attribute8_o              =>ben_dco_shd.g_old_rec.dco_attribute8
475  ,p_dco_attribute9_o              =>ben_dco_shd.g_old_rec.dco_attribute9
476  ,p_dco_attribute10_o             =>ben_dco_shd.g_old_rec.dco_attribute10
477  ,p_dco_attribute11_o             =>ben_dco_shd.g_old_rec.dco_attribute11
478  ,p_dco_attribute12_o             =>ben_dco_shd.g_old_rec.dco_attribute12
479  ,p_dco_attribute13_o             =>ben_dco_shd.g_old_rec.dco_attribute13
480  ,p_dco_attribute14_o             =>ben_dco_shd.g_old_rec.dco_attribute14
481  ,p_dco_attribute15_o             =>ben_dco_shd.g_old_rec.dco_attribute15
482  ,p_dco_attribute16_o             =>ben_dco_shd.g_old_rec.dco_attribute16
483  ,p_dco_attribute17_o             =>ben_dco_shd.g_old_rec.dco_attribute17
484  ,p_dco_attribute18_o             =>ben_dco_shd.g_old_rec.dco_attribute18
485  ,p_dco_attribute19_o             =>ben_dco_shd.g_old_rec.dco_attribute19
486  ,p_dco_attribute20_o             =>ben_dco_shd.g_old_rec.dco_attribute20
487  ,p_dco_attribute21_o             =>ben_dco_shd.g_old_rec.dco_attribute21
488  ,p_dco_attribute22_o             =>ben_dco_shd.g_old_rec.dco_attribute22
489  ,p_dco_attribute23_o             =>ben_dco_shd.g_old_rec.dco_attribute23
490  ,p_dco_attribute24_o             =>ben_dco_shd.g_old_rec.dco_attribute24
491  ,p_dco_attribute25_o             =>ben_dco_shd.g_old_rec.dco_attribute25
492  ,p_dco_attribute26_o             =>ben_dco_shd.g_old_rec.dco_attribute26
493  ,p_dco_attribute27_o             =>ben_dco_shd.g_old_rec.dco_attribute27
494  ,p_dco_attribute28_o             =>ben_dco_shd.g_old_rec.dco_attribute28
495  ,p_dco_attribute29_o             =>ben_dco_shd.g_old_rec.dco_attribute29
496  ,p_dco_attribute30_o             =>ben_dco_shd.g_old_rec.dco_attribute30
497  ,p_object_version_number_o       =>ben_dco_shd.g_old_rec.object_version_number
498       );
499     --
500   exception
501     --
502     when hr_api.cannot_find_prog_unit then
503       --
504       hr_api.cannot_find_prog_unit_error
505         (p_module_name => 'ben_dpnt_cvrd_othr_ptip_rt_f'
506         ,p_hook_type   => 'AU');
507       --
508   end;
509   --
510   -- End of API User Hook for post_update.
511   --
512   --
513   hr_utility.set_location(' Leaving:'||l_proc, 10);
514 End post_update;
515 --
516 -- ----------------------------------------------------------------------------
517 -- |-----------------------------< convert_defs >-----------------------------|
518 -- ----------------------------------------------------------------------------
519 -- {Start Of Comments}
520 --
521 -- Description:
522 --   The Convert_Defs procedure has one very important function:
523 --   It must return the record structure for the row with all system defaulted
524 --   values converted into its corresponding parameter value for update. When
525 --   we attempt to update a row through the Upd process , certain
526 --   parameters can be defaulted which enables flexibility in the calling of
527 --   the upd process (e.g. only attributes which need to be updated need to be
528 --   specified). For the upd process to determine which attributes
529 --   have NOT been specified we need to check if the parameter has a reserved
530 --   system default value. Therefore, for all parameters which have a
531 --   corresponding reserved system default mechanism specified we need to
532 --   check if a system default is being used. If a system default is being
533 --   used then we convert the defaulted value into its corresponding attribute
534 --   value held in the g_old_rec data structure.
535 --
536 -- Prerequisites:
537 --   This private function can only be called from the upd process.
538 --
539 -- In Parameters:
540 --   A Pl/Sql record structre.
541 --
542 -- Post Success:
543 --   The record structure will be returned with all system defaulted parameter
544 --   values converted into its current row attribute value.
545 --
546 -- Post Failure:
547 --   No direct error handling is required within this function. Any possible
548 --   errors within this procedure will be a PL/SQL value error due to conversion
549 --   of datatypes or data lengths.
550 --
551 -- Developer Implementation Notes:
552 --   None.
553 --
554 -- Access Status:
555 --   Internal Row Handler Use Only.
556 --
557 -- {End Of Comments}
558 -- ----------------------------------------------------------------------------
559 Procedure convert_defs(p_rec in out nocopy ben_dco_shd.g_rec_type) is
560 --
561   l_proc  varchar2(72) := g_package||'convert_defs';
562 --
563 Begin
564   --
565   hr_utility.set_location('Entering:'||l_proc, 5);
566   --
567   -- We must now examine each argument value in the
568   -- p_rec plsql record structure
569   -- to see if a system default is being used. If a system default
570   -- is being used then we must set to the 'current' argument value.
571   --
572   If (p_rec.excld_flag = hr_api.g_varchar2) then
573     p_rec.excld_flag :=
574     ben_dco_shd.g_old_rec.excld_flag;
575   End If;
576   If (p_rec.ordr_num = hr_api.g_number) then
577     p_rec.ordr_num :=
578     ben_dco_shd.g_old_rec.ordr_num;
579   End If;
580   If (p_rec.enrl_det_dt_cd = hr_api.g_varchar2) then
581     p_rec.enrl_det_dt_cd :=
582     ben_dco_shd.g_old_rec.enrl_det_dt_cd;
583   End If;
584   If (p_rec.only_pls_subj_cobra_flag = hr_api.g_varchar2) then
585     p_rec.only_pls_subj_cobra_flag :=
586     ben_dco_shd.g_old_rec.only_pls_subj_cobra_flag;
587   End If;
588   If (p_rec.ptip_id = hr_api.g_number) then
589     p_rec.ptip_id :=
590     ben_dco_shd.g_old_rec.ptip_id;
591   End If;
592   If (p_rec.vrbl_rt_prfl_id = hr_api.g_number) then
593     p_rec.vrbl_rt_prfl_id :=
594     ben_dco_shd.g_old_rec.vrbl_rt_prfl_id;
595   End If;
596   If (p_rec.business_group_id = hr_api.g_number) then
597     p_rec.business_group_id :=
598     ben_dco_shd.g_old_rec.business_group_id;
599   End If;
600   If (p_rec.dco_attribute_category = hr_api.g_varchar2) then
601     p_rec.dco_attribute_category :=
602     ben_dco_shd.g_old_rec.dco_attribute_category;
603   End If;
604   If (p_rec.dco_attribute1 = hr_api.g_varchar2) then
605     p_rec.dco_attribute1 :=
606     ben_dco_shd.g_old_rec.dco_attribute1;
607   End If;
608   If (p_rec.dco_attribute2 = hr_api.g_varchar2) then
609     p_rec.dco_attribute2 :=
610     ben_dco_shd.g_old_rec.dco_attribute2;
611   End If;
612   If (p_rec.dco_attribute3 = hr_api.g_varchar2) then
613     p_rec.dco_attribute3 :=
614     ben_dco_shd.g_old_rec.dco_attribute3;
615   End If;
616   If (p_rec.dco_attribute4 = hr_api.g_varchar2) then
617     p_rec.dco_attribute4 :=
618     ben_dco_shd.g_old_rec.dco_attribute4;
619   End If;
620   If (p_rec.dco_attribute5 = hr_api.g_varchar2) then
621     p_rec.dco_attribute5 :=
622     ben_dco_shd.g_old_rec.dco_attribute5;
623   End If;
624   If (p_rec.dco_attribute6 = hr_api.g_varchar2) then
625     p_rec.dco_attribute6 :=
626     ben_dco_shd.g_old_rec.dco_attribute6;
627   End If;
628   If (p_rec.dco_attribute7 = hr_api.g_varchar2) then
629     p_rec.dco_attribute7 :=
630     ben_dco_shd.g_old_rec.dco_attribute7;
631   End If;
632   If (p_rec.dco_attribute8 = hr_api.g_varchar2) then
633     p_rec.dco_attribute8 :=
634     ben_dco_shd.g_old_rec.dco_attribute8;
635   End If;
636   If (p_rec.dco_attribute9 = hr_api.g_varchar2) then
637     p_rec.dco_attribute9 :=
638     ben_dco_shd.g_old_rec.dco_attribute9;
639   End If;
640   If (p_rec.dco_attribute10 = hr_api.g_varchar2) then
641     p_rec.dco_attribute10 :=
642     ben_dco_shd.g_old_rec.dco_attribute10;
643   End If;
644   If (p_rec.dco_attribute11 = hr_api.g_varchar2) then
645     p_rec.dco_attribute11 :=
646     ben_dco_shd.g_old_rec.dco_attribute11;
647   End If;
648   If (p_rec.dco_attribute12 = hr_api.g_varchar2) then
649     p_rec.dco_attribute12 :=
650     ben_dco_shd.g_old_rec.dco_attribute12;
651   End If;
652   If (p_rec.dco_attribute13 = hr_api.g_varchar2) then
653     p_rec.dco_attribute13 :=
654     ben_dco_shd.g_old_rec.dco_attribute13;
655   End If;
656   If (p_rec.dco_attribute14 = hr_api.g_varchar2) then
657     p_rec.dco_attribute14 :=
658     ben_dco_shd.g_old_rec.dco_attribute14;
659   End If;
660   If (p_rec.dco_attribute15 = hr_api.g_varchar2) then
661     p_rec.dco_attribute15 :=
662     ben_dco_shd.g_old_rec.dco_attribute15;
663   End If;
664   If (p_rec.dco_attribute16 = hr_api.g_varchar2) then
665     p_rec.dco_attribute16 :=
666     ben_dco_shd.g_old_rec.dco_attribute16;
667   End If;
668   If (p_rec.dco_attribute17 = hr_api.g_varchar2) then
669     p_rec.dco_attribute17 :=
670     ben_dco_shd.g_old_rec.dco_attribute17;
671   End If;
672   If (p_rec.dco_attribute18 = hr_api.g_varchar2) then
673     p_rec.dco_attribute18 :=
674     ben_dco_shd.g_old_rec.dco_attribute18;
675   End If;
676   If (p_rec.dco_attribute19 = hr_api.g_varchar2) then
677     p_rec.dco_attribute19 :=
678     ben_dco_shd.g_old_rec.dco_attribute19;
679   End If;
680   If (p_rec.dco_attribute20 = hr_api.g_varchar2) then
681     p_rec.dco_attribute20 :=
682     ben_dco_shd.g_old_rec.dco_attribute20;
683   End If;
684   If (p_rec.dco_attribute21 = hr_api.g_varchar2) then
685     p_rec.dco_attribute21 :=
686     ben_dco_shd.g_old_rec.dco_attribute21;
687   End If;
688   If (p_rec.dco_attribute22 = hr_api.g_varchar2) then
689     p_rec.dco_attribute22 :=
690     ben_dco_shd.g_old_rec.dco_attribute22;
691   End If;
692   If (p_rec.dco_attribute23 = hr_api.g_varchar2) then
693     p_rec.dco_attribute23 :=
694     ben_dco_shd.g_old_rec.dco_attribute23;
695   End If;
696   If (p_rec.dco_attribute24 = hr_api.g_varchar2) then
697     p_rec.dco_attribute24 :=
698     ben_dco_shd.g_old_rec.dco_attribute24;
699   End If;
700   If (p_rec.dco_attribute25 = hr_api.g_varchar2) then
701     p_rec.dco_attribute25 :=
702     ben_dco_shd.g_old_rec.dco_attribute25;
703   End If;
704   If (p_rec.dco_attribute26 = hr_api.g_varchar2) then
705     p_rec.dco_attribute26 :=
706     ben_dco_shd.g_old_rec.dco_attribute26;
707   End If;
708   If (p_rec.dco_attribute27 = hr_api.g_varchar2) then
709     p_rec.dco_attribute27 :=
710     ben_dco_shd.g_old_rec.dco_attribute27;
711   End If;
712   If (p_rec.dco_attribute28 = hr_api.g_varchar2) then
713     p_rec.dco_attribute28 :=
714     ben_dco_shd.g_old_rec.dco_attribute28;
715   End If;
716   If (p_rec.dco_attribute29 = hr_api.g_varchar2) then
717     p_rec.dco_attribute29 :=
718     ben_dco_shd.g_old_rec.dco_attribute29;
719   End If;
720   If (p_rec.dco_attribute30 = hr_api.g_varchar2) then
721     p_rec.dco_attribute30 :=
722     ben_dco_shd.g_old_rec.dco_attribute30;
723   End If;
724 
725   --
726   hr_utility.set_location(' Leaving:'||l_proc, 10);
727 --
728 End convert_defs;
729 --
730 -- ----------------------------------------------------------------------------
731 -- |---------------------------------< upd >----------------------------------|
732 -- ----------------------------------------------------------------------------
733 Procedure upd
734   (
735   p_rec			in out nocopy 	ben_dco_shd.g_rec_type,
736   p_effective_date	in 	date,
737   p_datetrack_mode	in 	varchar2
738   ) is
739 --
740   l_proc			varchar2(72) := g_package||'upd';
741   l_validation_start_date	date;
742   l_validation_end_date		date;
743 --
744 Begin
745   hr_utility.set_location('Entering:'||l_proc, 5);
746   --
747   -- Ensure that the DateTrack update mode is valid
748   --
749   dt_api.validate_dt_upd_mode(p_datetrack_mode => p_datetrack_mode);
750   --
751   -- We must lock the row which we need to update.
752   --
753   ben_dco_shd.lck
754 	(p_effective_date	 => p_effective_date,
755       	 p_datetrack_mode	 => p_datetrack_mode,
756       	 p_dpnt_cvrd_othr_ptip_rt_id	 => p_rec.dpnt_cvrd_othr_ptip_rt_id,
757       	 p_object_version_number => p_rec.object_version_number,
758       	 p_validation_start_date => l_validation_start_date,
759       	 p_validation_end_date	 => l_validation_end_date);
760   --
761   -- 1. During an update system defaults are used to determine if
762   --    arguments have been defaulted or not. We must therefore
763   --    derive the full record structure values to be updated.
764   --
765   -- 2. Call the supporting update validate operations.
766   --
767   convert_defs(p_rec);
768   ben_dco_bus.update_validate
769 	(p_rec			 => p_rec,
770 	 p_effective_date	 => p_effective_date,
771 	 p_datetrack_mode  	 => p_datetrack_mode,
772 	 p_validation_start_date => l_validation_start_date,
773 	 p_validation_end_date	 => l_validation_end_date);
774   --
775   -- Call the supporting pre-update operation
776   --
777   pre_update
778 	(p_rec			 => p_rec,
779 	 p_effective_date	 => p_effective_date,
780 	 p_datetrack_mode	 => p_datetrack_mode,
781 	 p_validation_start_date => l_validation_start_date,
782 	 p_validation_end_date	 => l_validation_end_date);
783   --
784   -- Update the row.
785   --
786   update_dml
787 	(p_rec			 => p_rec,
788 	 p_effective_date	 => p_effective_date,
789 	 p_datetrack_mode	 => p_datetrack_mode,
790 	 p_validation_start_date => l_validation_start_date,
791 	 p_validation_end_date	 => l_validation_end_date);
792   --
793   -- Call the supporting post-update operation
794   --
795   post_update
796 	(p_rec			 => p_rec,
797 	 p_effective_date	 => p_effective_date,
798 	 p_datetrack_mode	 => p_datetrack_mode,
799 	 p_validation_start_date => l_validation_start_date,
800 	 p_validation_end_date	 => l_validation_end_date);
801 End upd;
802 --
803 -- ----------------------------------------------------------------------------
804 -- |---------------------------------< upd >----------------------------------|
805 -- ----------------------------------------------------------------------------
806 Procedure upd
807   (
808   p_dpnt_cvrd_othr_ptip_rt_id  in number,
809   p_effective_start_date         out nocopy date,
810   p_effective_end_date           out nocopy date,
811   p_excld_flag                   in varchar2         default hr_api.g_varchar2,
812   p_ordr_num                     in number           default hr_api.g_number,
813   p_enrl_det_dt_cd               in varchar2         default hr_api.g_varchar2,
814   p_only_pls_subj_cobra_flag     in varchar2         default hr_api.g_varchar2,
815   p_ptip_id                      in number           default hr_api.g_number,
816   p_vrbl_rt_prfl_id                in number           default hr_api.g_number,
817   p_business_group_id            in number           default hr_api.g_number,
818   p_dco_attribute_category       in varchar2         default hr_api.g_varchar2,
819   p_dco_attribute1               in varchar2         default hr_api.g_varchar2,
820   p_dco_attribute2               in varchar2         default hr_api.g_varchar2,
821   p_dco_attribute3               in varchar2         default hr_api.g_varchar2,
822   p_dco_attribute4               in varchar2         default hr_api.g_varchar2,
823   p_dco_attribute5               in varchar2         default hr_api.g_varchar2,
824   p_dco_attribute6               in varchar2         default hr_api.g_varchar2,
825   p_dco_attribute7               in varchar2         default hr_api.g_varchar2,
826   p_dco_attribute8               in varchar2         default hr_api.g_varchar2,
827   p_dco_attribute9               in varchar2         default hr_api.g_varchar2,
828   p_dco_attribute10              in varchar2         default hr_api.g_varchar2,
829   p_dco_attribute11              in varchar2         default hr_api.g_varchar2,
830   p_dco_attribute12              in varchar2         default hr_api.g_varchar2,
831   p_dco_attribute13              in varchar2         default hr_api.g_varchar2,
832   p_dco_attribute14              in varchar2         default hr_api.g_varchar2,
833   p_dco_attribute15              in varchar2         default hr_api.g_varchar2,
834   p_dco_attribute16              in varchar2         default hr_api.g_varchar2,
835   p_dco_attribute17              in varchar2         default hr_api.g_varchar2,
836   p_dco_attribute18              in varchar2         default hr_api.g_varchar2,
837   p_dco_attribute19              in varchar2         default hr_api.g_varchar2,
838   p_dco_attribute20              in varchar2         default hr_api.g_varchar2,
839   p_dco_attribute21              in varchar2         default hr_api.g_varchar2,
840   p_dco_attribute22              in varchar2         default hr_api.g_varchar2,
841   p_dco_attribute23              in varchar2         default hr_api.g_varchar2,
842   p_dco_attribute24              in varchar2         default hr_api.g_varchar2,
843   p_dco_attribute25              in varchar2         default hr_api.g_varchar2,
844   p_dco_attribute26              in varchar2         default hr_api.g_varchar2,
845   p_dco_attribute27              in varchar2         default hr_api.g_varchar2,
846   p_dco_attribute28              in varchar2         default hr_api.g_varchar2,
847   p_dco_attribute29              in varchar2         default hr_api.g_varchar2,
848   p_dco_attribute30              in varchar2         default hr_api.g_varchar2,
849   p_object_version_number        in out nocopy number,
850   p_effective_date		 in date,
851   p_datetrack_mode		 in varchar2
852   ) is
853 --
854   l_rec		ben_dco_shd.g_rec_type;
855   l_proc	varchar2(72) := g_package||'upd';
856 --
857 Begin
858   hr_utility.set_location('Entering:'||l_proc, 5);
859   --
860   -- Call conversion function to turn arguments into the
861   -- l_rec structure.
862   --
863   l_rec :=
864   ben_dco_shd.convert_args
865   (
866   p_dpnt_cvrd_othr_ptip_rt_id,
867   null,
868   null,
869   p_excld_flag,
870   p_ordr_num,
871   p_enrl_det_dt_cd,
872   p_only_pls_subj_cobra_flag,
873   p_ptip_id,
874   p_vrbl_rt_prfl_id,
875   p_business_group_id,
876   p_dco_attribute_category,
877   p_dco_attribute1,
878   p_dco_attribute2,
879   p_dco_attribute3,
880   p_dco_attribute4,
881   p_dco_attribute5,
882   p_dco_attribute6,
883   p_dco_attribute7,
884   p_dco_attribute8,
885   p_dco_attribute9,
886   p_dco_attribute10,
887   p_dco_attribute11,
888   p_dco_attribute12,
889   p_dco_attribute13,
890   p_dco_attribute14,
891   p_dco_attribute15,
892   p_dco_attribute16,
893   p_dco_attribute17,
894   p_dco_attribute18,
895   p_dco_attribute19,
896   p_dco_attribute20,
897   p_dco_attribute21,
898   p_dco_attribute22,
899   p_dco_attribute23,
900   p_dco_attribute24,
901   p_dco_attribute25,
902   p_dco_attribute26,
903   p_dco_attribute27,
904   p_dco_attribute28,
905   p_dco_attribute29,
906   p_dco_attribute30,
907   p_object_version_number
908   );
909   --
910   -- Having converted the arguments into the
911   -- plsql record structure we call the corresponding record
912   -- business process.
913   --
914   upd(l_rec, p_effective_date, p_datetrack_mode);
915   p_object_version_number       := l_rec.object_version_number;
916   p_effective_start_date        := l_rec.effective_start_date;
917   p_effective_end_date          := l_rec.effective_end_date;
918   --
919   --
920   hr_utility.set_location(' Leaving:'||l_proc, 10);
921 End upd;
922 --
923 end ben_dco_upd;