DBA Data[Home] [Help]

PACKAGE BODY: APPS.BEN_PPV_UPD

Source


1 Package Body ben_ppv_upd as
2 /* $Header: beppvrhi.pkb 120.6 2008/02/05 09:48:37 rtagarra noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33)	:= '  ben_ppv_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_ppv_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_prtl_mo_rt_prtn_val_f',
78 	   p_base_key_column	=> 'prtl_mo_rt_prtn_val_id',
79 	   p_base_key_value	=> p_rec.prtl_mo_rt_prtn_val_id);
80     --
81     ben_ppv_shd.g_api_dml := true;  -- Set the api dml status
82     --
83     -- Update the ben_prtl_mo_rt_prtn_val_f Row
84     --
85     update  ben_prtl_mo_rt_prtn_val_f
86     set
87         prtl_mo_rt_prtn_val_id          = p_rec.prtl_mo_rt_prtn_val_id,
88     business_group_id               = p_rec.business_group_id,
89     rndg_cd                         = p_rec.rndg_cd,
90     to_dy_mo_num                    = p_rec.to_dy_mo_num,
91     from_dy_mo_num                  = p_rec.from_dy_mo_num,
92     pct_val                         = p_rec.pct_val,
93     acty_base_rt_id                 = p_rec.acty_base_rt_id,
94     strt_r_stp_cvg_cd               = p_rec.strt_r_stp_cvg_cd,
95     rndg_rl                         = p_rec.rndg_rl,
96     prtl_mo_prortn_rl               = p_rec.prtl_mo_prortn_rl,
97     actl_prem_id                    = p_rec.actl_prem_id,
98     cvg_amt_calc_mthd_id            = p_rec.cvg_amt_calc_mthd_id,
99     num_days_month                  = p_rec.num_days_month,
100     prorate_by_day_to_mon_flag      = p_rec.prorate_by_day_to_mon_flag,
101     pmrpv_attribute_category        = p_rec.pmrpv_attribute_category,
102     pmrpv_attribute1                = p_rec.pmrpv_attribute1,
103     pmrpv_attribute2                = p_rec.pmrpv_attribute2,
104     pmrpv_attribute3                = p_rec.pmrpv_attribute3,
105     pmrpv_attribute4                = p_rec.pmrpv_attribute4,
106     pmrpv_attribute5                = p_rec.pmrpv_attribute5,
107     pmrpv_attribute6                = p_rec.pmrpv_attribute6,
108     pmrpv_attribute7                = p_rec.pmrpv_attribute7,
109     pmrpv_attribute8                = p_rec.pmrpv_attribute8,
110     pmrpv_attribute9                = p_rec.pmrpv_attribute9,
111     pmrpv_attribute10               = p_rec.pmrpv_attribute10,
112     pmrpv_attribute11               = p_rec.pmrpv_attribute11,
113     pmrpv_attribute12               = p_rec.pmrpv_attribute12,
114     pmrpv_attribute13               = p_rec.pmrpv_attribute13,
115     pmrpv_attribute14               = p_rec.pmrpv_attribute14,
116     pmrpv_attribute15               = p_rec.pmrpv_attribute15,
117     pmrpv_attribute16               = p_rec.pmrpv_attribute16,
118     pmrpv_attribute17               = p_rec.pmrpv_attribute17,
119     pmrpv_attribute18               = p_rec.pmrpv_attribute18,
120     pmrpv_attribute19               = p_rec.pmrpv_attribute19,
121     pmrpv_attribute20               = p_rec.pmrpv_attribute20,
122     pmrpv_attribute21               = p_rec.pmrpv_attribute21,
123     pmrpv_attribute22               = p_rec.pmrpv_attribute22,
124     pmrpv_attribute23               = p_rec.pmrpv_attribute23,
125     pmrpv_attribute24               = p_rec.pmrpv_attribute24,
126     pmrpv_attribute25               = p_rec.pmrpv_attribute25,
127     pmrpv_attribute26               = p_rec.pmrpv_attribute26,
128     pmrpv_attribute27               = p_rec.pmrpv_attribute27,
129     pmrpv_attribute28               = p_rec.pmrpv_attribute28,
130     pmrpv_attribute29               = p_rec.pmrpv_attribute29,
131     pmrpv_attribute30               = p_rec.pmrpv_attribute30,
132     object_version_number           = p_rec.object_version_number
133     where   prtl_mo_rt_prtn_val_id = p_rec.prtl_mo_rt_prtn_val_id
134     and     effective_start_date = p_validation_start_date
135     and     effective_end_date   = p_validation_end_date;
136     --
137     ben_ppv_shd.g_api_dml := false;   -- Unset the api dml status
138     --
139     -- Set the effective start and end dates
140     --
141     p_rec.effective_start_date := p_validation_start_date;
142     p_rec.effective_end_date   := p_validation_end_date;
143   End If;
144 --
145 hr_utility.set_location(' Leaving:'||l_proc, 15);
146 Exception
147   When hr_api.check_integrity_violated Then
148     -- A check constraint has been violated
149     ben_ppv_shd.g_api_dml := false;   -- Unset the api dml status
150     ben_ppv_shd.constraint_error
151       (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
152   When hr_api.unique_integrity_violated Then
153     -- Unique integrity has been violated
154     ben_ppv_shd.g_api_dml := false;   -- Unset the api dml status
155     ben_ppv_shd.constraint_error
156       (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
157   When Others Then
158     ben_ppv_shd.g_api_dml := false;   -- Unset the api dml status
159     Raise;
160 End dt_update_dml;
161 --
162 -- ----------------------------------------------------------------------------
163 -- |------------------------------< update_dml >------------------------------|
164 -- ----------------------------------------------------------------------------
165 -- {Start Of Comments}
166 --
167 -- Description:
168 --   This procedure calls the dt_update_dml control logic which handles
169 --   the actual datetrack dml.
170 --
171 -- Prerequisites:
172 --   This is an internal private procedure which must be called from the upd
173 --   procedure.
174 --
175 -- In Parameters:
176 --   A Pl/Sql record structre.
177 --
178 -- Post Success:
179 --   Processing contines.
180 --
181 -- Post Failure:
182 --   No specific error handling is required within this procedure.
183 --
184 -- Developer Implementation Notes:
185 --   The update 'set' arguments list should be modified if any of your
186 --   attributes are not updateable.
187 --
188 -- Access Status:
189 --   Internal Row Handler Use Only.
190 --
191 -- {End Of Comments}
192 -- ----------------------------------------------------------------------------
193 Procedure update_dml
194 	(p_rec 			 in out nocopy ben_ppv_shd.g_rec_type,
195 	 p_effective_date	 in	date,
196 	 p_datetrack_mode	 in	varchar2,
197 	 p_validation_start_date in	date,
198 	 p_validation_end_date	 in	date) is
199 --
200   l_proc	varchar2(72) := g_package||'update_dml';
201 --
202 Begin
203   hr_utility.set_location('Entering:'||l_proc, 5);
204   --
205   dt_update_dml(p_rec			=> p_rec,
206 		p_effective_date	=> p_effective_date,
207 		p_datetrack_mode	=> p_datetrack_mode,
208        		p_validation_start_date	=> p_validation_start_date,
209 		p_validation_end_date	=> p_validation_end_date);
210   --
211   hr_utility.set_location(' Leaving:'||l_proc, 10);
212 End update_dml;
213 --
214 -- ----------------------------------------------------------------------------
215 -- |----------------------------< dt_pre_update >-----------------------------|
216 -- ----------------------------------------------------------------------------
217 -- {Start Of Comments}
218 --
219 -- Description:
220 --   The dt_pre_update procedure controls the execution
221 --   of dml for the datetrack modes of: UPDATE, UPDATE_OVERRIDE
222 --   and UPDATE_CHANGE_INSERT only. The execution required is as
223 --   follows:
224 --
225 --   1) Providing the datetrack update mode is not 'CORRECTION'
226 --      then set the effective end date of the current row (this
227 --      will be the validation_start_date - 1).
228 --   2) If the datetrack mode is 'UPDATE_OVERRIDE' then call the
229 --      corresponding delete_dml process to delete any future rows
230 --      where the effective_start_date is greater than or equal to
231 --	the validation_start_date.
232 --   3) Call the insert_dml process to insert the new updated row
233 --      details..
234 --
235 -- Prerequisites:
236 --   This is an internal procedure which is called from the
237 --   pre_update procedure.
238 --
239 -- In Parameters:
240 --
241 -- Post Success:
242 --   Processing continues.
243 --
244 -- Post Failure:
245 --   If an error has occurred, an error message and exception will be raised
246 --   but not handled.
247 --
248 -- Developer Implementation Notes:
249 --   This is an internal procedure which is required by Datetrack. Don't
250 --   remove or modify.
251 --
252 -- Access Status:
253 --   Internal Row Handler Use Only.
254 --
255 -- {End Of Comments}
256 -- ----------------------------------------------------------------------------
257 Procedure dt_pre_update
258 	(p_rec 			 in out nocopy ben_ppv_shd.g_rec_type,
259 	 p_effective_date	 in	date,
260 	 p_datetrack_mode	 in	varchar2,
261 	 p_validation_start_date in	date,
262 	 p_validation_end_date	 in	date) is
263 --
264   l_proc	         varchar2(72) := g_package||'dt_pre_update';
265   l_dummy_version_number number;
266 --
267 Begin
268   hr_utility.set_location('Entering:'||l_proc, 5);
269   If (p_datetrack_mode <> 'CORRECTION') then
270     hr_utility.set_location(l_proc, 10);
271     --
272     -- Update the current effective end date
273     --
274     ben_ppv_shd.upd_effective_end_date
275      (p_effective_date	       => p_effective_date,
276       p_base_key_value	       => p_rec.prtl_mo_rt_prtn_val_id,
277       p_new_effective_end_date => (p_validation_start_date - 1),
278       p_validation_start_date  => p_validation_start_date,
279       p_validation_end_date    => p_validation_end_date,
280       p_object_version_number  => l_dummy_version_number);
281     --
282     If (p_datetrack_mode = 'UPDATE_OVERRIDE') then
283       hr_utility.set_location(l_proc, 15);
284       --
285       -- As the datetrack mode is 'UPDATE_OVERRIDE' then we must
286       -- delete any future rows
287       --
288       ben_ppv_del.delete_dml
289         (p_rec			 => p_rec,
290 	 p_effective_date	 => p_effective_date,
291 	 p_datetrack_mode	 => p_datetrack_mode,
292 	 p_validation_start_date => p_validation_start_date,
293 	 p_validation_end_date   => p_validation_end_date);
294     End If;
295     hr_utility.set_location(l_proc, 20);
296     --
297     -- We must now insert the updated row
298     --
299     ben_ppv_ins.insert_dml
300       (p_rec			=> p_rec,
301        p_effective_date		=> p_effective_date,
302        p_datetrack_mode		=> p_datetrack_mode,
303        p_validation_start_date	=> p_validation_start_date,
304        p_validation_end_date	=> p_validation_end_date);
305   End If;
306   hr_utility.set_location(' Leaving:'||l_proc, 20);
307 End dt_pre_update;
308 --
309 -- ----------------------------------------------------------------------------
310 -- |------------------------------< pre_update >------------------------------|
311 -- ----------------------------------------------------------------------------
312 -- {Start Of Comments}
313 --
314 -- Description:
315 --   This private procedure contains any processing which is required before
316 --   the update dml.
317 --
318 -- Prerequisites:
319 --   This is an internal procedure which is called from the upd procedure.
320 --
321 -- In Parameters:
322 --   A Pl/Sql record structre.
323 --
324 -- Post Success:
325 --   Processing continues.
326 --
327 -- Post Failure:
328 --   If an error has occurred, an error message and exception will be raised
329 --   but not handled.
330 --
331 -- Developer Implementation Notes:
332 --   Any pre-processing required before the update dml is issued should be
333 --   coded within this procedure. It is important to note that any 3rd party
334 --   maintenance should be reviewed before placing in this procedure. The call
335 --   to the dt_update_dml procedure should NOT be removed.
336 --
337 -- Access Status:
338 --   Internal Row Handler Use Only.
339 --
340 -- {End Of Comments}
341 -- ----------------------------------------------------------------------------
342 Procedure pre_update
343 	(p_rec 			 in out nocopy ben_ppv_shd.g_rec_type,
344 	 p_effective_date	 in	date,
345 	 p_datetrack_mode	 in	varchar2,
346 	 p_validation_start_date in	date,
347 	 p_validation_end_date	 in	date) is
348 --
349   l_proc	varchar2(72) := g_package||'pre_update';
350 --
351 Begin
352   hr_utility.set_location('Entering:'||l_proc, 5);
353   --
354   --
355   --
356   dt_pre_update
357     (p_rec 		     => p_rec,
358      p_effective_date	     => p_effective_date,
359      p_datetrack_mode	     => p_datetrack_mode,
360      p_validation_start_date => p_validation_start_date,
361      p_validation_end_date   => p_validation_end_date);
362   --
363   hr_utility.set_location(' Leaving:'||l_proc, 10);
364 End pre_update;
365 --
366 -- ----------------------------------------------------------------------------
367 -- |-----------------------------< post_update >------------------------------|
368 -- ----------------------------------------------------------------------------
369 -- {Start Of Comments}
370 --
371 -- Description:
372 --   This private procedure contains any processing which is required after the
373 --   update dml.
374 --
375 -- Prerequisites:
376 --   This is an internal procedure which is called from the upd procedure.
377 --
378 -- In Parameters:
379 --   A Pl/Sql record structre.
380 --
381 -- Post Success:
382 --   Processing continues.
383 --
384 -- Post Failure:
385 --   If an error has occurred, an error message and exception will be raised
386 --   but not handled.
387 --
388 -- Developer Implementation Notes:
389 --   Any post-processing required after the update dml is issued should be
390 --   coded within this procedure. It is important to note that any 3rd party
391 --   maintenance should be reviewed before placing in this procedure.
392 --
393 -- Access Status:
394 --   Internal Row Handler Use Only.
395 --
396 -- {End Of Comments}
397 -- ----------------------------------------------------------------------------
398 Procedure post_update
399 	(p_rec 			 in ben_ppv_shd.g_rec_type,
400 	 p_effective_date	 in date,
401 	 p_datetrack_mode	 in varchar2,
402 	 p_validation_start_date in date,
403 	 p_validation_end_date	 in date) is
404 --
405   l_proc	varchar2(72) := g_package||'post_update';
406 --
407 Begin
408   hr_utility.set_location('Entering:'||l_proc, 5);
409 --
410   --
411   -- Start of API User Hook for post_update.
412   --
413   begin
414     --
415     ben_ppv_rku.after_update
416       (
417   p_prtl_mo_rt_prtn_val_id        =>p_rec.prtl_mo_rt_prtn_val_id
418  ,p_effective_end_date            =>p_rec.effective_end_date
419  ,p_effective_start_date          =>p_rec.effective_start_date
420  ,p_business_group_id             =>p_rec.business_group_id
421  ,p_rndg_cd                       =>p_rec.rndg_cd
422  ,p_to_dy_mo_num                  =>p_rec.to_dy_mo_num
423  ,p_from_dy_mo_num                =>p_rec.from_dy_mo_num
424  ,p_pct_val                       =>p_rec.pct_val
425  ,p_acty_base_rt_id               =>p_rec.acty_base_rt_id
426  ,p_strt_r_stp_cvg_cd             =>p_rec.strt_r_stp_cvg_cd
427  ,p_rndg_rl                       =>p_rec.rndg_rl
428  ,p_prtl_mo_prortn_rl             =>p_rec.prtl_mo_prortn_rl
429  ,p_actl_prem_id                  =>p_rec.actl_prem_id
430  ,p_cvg_amt_calc_mthd_id          =>p_rec.cvg_amt_calc_mthd_id
431  ,p_num_days_month                =>p_rec.num_days_month
432  ,p_prorate_by_day_to_mon_flag    =>p_rec.prorate_by_day_to_mon_flag
433  ,p_pmrpv_attribute_category      =>p_rec.pmrpv_attribute_category
434  ,p_pmrpv_attribute1              =>p_rec.pmrpv_attribute1
435  ,p_pmrpv_attribute2              =>p_rec.pmrpv_attribute2
436  ,p_pmrpv_attribute3              =>p_rec.pmrpv_attribute3
437  ,p_pmrpv_attribute4              =>p_rec.pmrpv_attribute4
438  ,p_pmrpv_attribute5              =>p_rec.pmrpv_attribute5
439  ,p_pmrpv_attribute6              =>p_rec.pmrpv_attribute6
440  ,p_pmrpv_attribute7              =>p_rec.pmrpv_attribute7
441  ,p_pmrpv_attribute8              =>p_rec.pmrpv_attribute8
442  ,p_pmrpv_attribute9              =>p_rec.pmrpv_attribute9
443  ,p_pmrpv_attribute10             =>p_rec.pmrpv_attribute10
444  ,p_pmrpv_attribute11             =>p_rec.pmrpv_attribute11
445  ,p_pmrpv_attribute12             =>p_rec.pmrpv_attribute12
446  ,p_pmrpv_attribute13             =>p_rec.pmrpv_attribute13
447  ,p_pmrpv_attribute14             =>p_rec.pmrpv_attribute14
448  ,p_pmrpv_attribute15             =>p_rec.pmrpv_attribute15
449  ,p_pmrpv_attribute16             =>p_rec.pmrpv_attribute16
450  ,p_pmrpv_attribute17             =>p_rec.pmrpv_attribute17
451  ,p_pmrpv_attribute18             =>p_rec.pmrpv_attribute18
452  ,p_pmrpv_attribute19             =>p_rec.pmrpv_attribute19
453  ,p_pmrpv_attribute20             =>p_rec.pmrpv_attribute20
454  ,p_pmrpv_attribute21             =>p_rec.pmrpv_attribute21
455  ,p_pmrpv_attribute22             =>p_rec.pmrpv_attribute22
456  ,p_pmrpv_attribute23             =>p_rec.pmrpv_attribute23
457  ,p_pmrpv_attribute24             =>p_rec.pmrpv_attribute24
458  ,p_pmrpv_attribute25             =>p_rec.pmrpv_attribute25
459  ,p_pmrpv_attribute26             =>p_rec.pmrpv_attribute26
460  ,p_pmrpv_attribute27             =>p_rec.pmrpv_attribute27
461  ,p_pmrpv_attribute28             =>p_rec.pmrpv_attribute28
462  ,p_pmrpv_attribute29             =>p_rec.pmrpv_attribute29
463  ,p_pmrpv_attribute30             =>p_rec.pmrpv_attribute30
464  ,p_object_version_number         =>p_rec.object_version_number
465  ,p_effective_date                =>p_effective_date
466  ,p_datetrack_mode                =>p_datetrack_mode
467  ,p_validation_start_date         =>p_validation_start_date
468  ,p_validation_end_date           =>p_validation_end_date
469  ,p_effective_end_date_o          =>ben_ppv_shd.g_old_rec.effective_end_date
470  ,p_effective_start_date_o        =>ben_ppv_shd.g_old_rec.effective_start_date
471  ,p_business_group_id_o           =>ben_ppv_shd.g_old_rec.business_group_id
472  ,p_rndg_cd_o                     =>ben_ppv_shd.g_old_rec.rndg_cd
473  ,p_to_dy_mo_num_o                =>ben_ppv_shd.g_old_rec.to_dy_mo_num
474  ,p_from_dy_mo_num_o              =>ben_ppv_shd.g_old_rec.from_dy_mo_num
475  ,p_pct_val_o                     =>ben_ppv_shd.g_old_rec.pct_val
476  ,p_acty_base_rt_id_o             =>ben_ppv_shd.g_old_rec.acty_base_rt_id
477  ,p_strt_r_stp_cvg_cd_o           =>ben_ppv_shd.g_old_rec.strt_r_stp_cvg_cd
478  ,p_rndg_rl_o                     =>ben_ppv_shd.g_old_rec.rndg_rl
479  ,p_prtl_mo_prortn_rl_o           =>ben_ppv_shd.g_old_rec.prtl_mo_prortn_rl
480  ,p_actl_prem_id_o                =>ben_ppv_shd.g_old_rec.actl_prem_id
481  ,p_cvg_amt_calc_mthd_id_o        =>ben_ppv_shd.g_old_rec.cvg_amt_calc_mthd_id
482  ,p_num_days_month_o              =>ben_ppv_shd.g_old_rec.num_days_month
483  ,p_prorate_by_day_to_mon_flag_o  =>ben_ppv_shd.g_old_rec.prorate_by_day_to_mon_flag
484  ,p_pmrpv_attribute_category_o    =>ben_ppv_shd.g_old_rec.pmrpv_attribute_category
485  ,p_pmrpv_attribute1_o            =>ben_ppv_shd.g_old_rec.pmrpv_attribute1
486  ,p_pmrpv_attribute2_o            =>ben_ppv_shd.g_old_rec.pmrpv_attribute2
487  ,p_pmrpv_attribute3_o            =>ben_ppv_shd.g_old_rec.pmrpv_attribute3
488  ,p_pmrpv_attribute4_o            =>ben_ppv_shd.g_old_rec.pmrpv_attribute4
489  ,p_pmrpv_attribute5_o            =>ben_ppv_shd.g_old_rec.pmrpv_attribute5
490  ,p_pmrpv_attribute6_o            =>ben_ppv_shd.g_old_rec.pmrpv_attribute6
491  ,p_pmrpv_attribute7_o            =>ben_ppv_shd.g_old_rec.pmrpv_attribute7
492  ,p_pmrpv_attribute8_o            =>ben_ppv_shd.g_old_rec.pmrpv_attribute8
493  ,p_pmrpv_attribute9_o            =>ben_ppv_shd.g_old_rec.pmrpv_attribute9
494  ,p_pmrpv_attribute10_o           =>ben_ppv_shd.g_old_rec.pmrpv_attribute10
495  ,p_pmrpv_attribute11_o           =>ben_ppv_shd.g_old_rec.pmrpv_attribute11
496  ,p_pmrpv_attribute12_o           =>ben_ppv_shd.g_old_rec.pmrpv_attribute12
497  ,p_pmrpv_attribute13_o           =>ben_ppv_shd.g_old_rec.pmrpv_attribute13
498  ,p_pmrpv_attribute14_o           =>ben_ppv_shd.g_old_rec.pmrpv_attribute14
499  ,p_pmrpv_attribute15_o           =>ben_ppv_shd.g_old_rec.pmrpv_attribute15
500  ,p_pmrpv_attribute16_o           =>ben_ppv_shd.g_old_rec.pmrpv_attribute16
501  ,p_pmrpv_attribute17_o           =>ben_ppv_shd.g_old_rec.pmrpv_attribute17
502  ,p_pmrpv_attribute18_o           =>ben_ppv_shd.g_old_rec.pmrpv_attribute18
503  ,p_pmrpv_attribute19_o           =>ben_ppv_shd.g_old_rec.pmrpv_attribute19
504  ,p_pmrpv_attribute20_o           =>ben_ppv_shd.g_old_rec.pmrpv_attribute20
505  ,p_pmrpv_attribute21_o           =>ben_ppv_shd.g_old_rec.pmrpv_attribute21
506  ,p_pmrpv_attribute22_o           =>ben_ppv_shd.g_old_rec.pmrpv_attribute22
507  ,p_pmrpv_attribute23_o           =>ben_ppv_shd.g_old_rec.pmrpv_attribute23
508  ,p_pmrpv_attribute24_o           =>ben_ppv_shd.g_old_rec.pmrpv_attribute24
509  ,p_pmrpv_attribute25_o           =>ben_ppv_shd.g_old_rec.pmrpv_attribute25
510  ,p_pmrpv_attribute26_o           =>ben_ppv_shd.g_old_rec.pmrpv_attribute26
511  ,p_pmrpv_attribute27_o           =>ben_ppv_shd.g_old_rec.pmrpv_attribute27
512  ,p_pmrpv_attribute28_o           =>ben_ppv_shd.g_old_rec.pmrpv_attribute28
513  ,p_pmrpv_attribute29_o           =>ben_ppv_shd.g_old_rec.pmrpv_attribute29
514  ,p_pmrpv_attribute30_o           =>ben_ppv_shd.g_old_rec.pmrpv_attribute30
515  ,p_object_version_number_o       =>ben_ppv_shd.g_old_rec.object_version_number
516       );
517     --
518   exception
519     --
520     when hr_api.cannot_find_prog_unit then
521       --
522       hr_api.cannot_find_prog_unit_error
523         (p_module_name => 'ben_prtl_mo_rt_prtn_val_f'
524         ,p_hook_type   => 'AU');
525       --
526   end;
527   --
528   -- End of API User Hook for post_update.
529   --
530   --
531   hr_utility.set_location(' Leaving:'||l_proc, 10);
532 End post_update;
533 --
534 -- ----------------------------------------------------------------------------
535 -- |-----------------------------< convert_defs >-----------------------------|
536 -- ----------------------------------------------------------------------------
537 -- {Start Of Comments}
538 --
539 -- Description:
540 --   The Convert_Defs procedure has one very important function:
541 --   It must return the record structure for the row with all system defaulted
542 --   values converted into its corresponding parameter value for update. When
543 --   we attempt to update a row through the Upd process , certain
544 --   parameters can be defaulted which enables flexibility in the calling of
545 --   the upd process (e.g. only attributes which need to be updated need to be
546 --   specified). For the upd process to determine which attributes
547 --   have NOT been specified we need to check if the parameter has a reserved
548 --   system default value. Therefore, for all parameters which have a
549 --   corresponding reserved system default mechanism specified we need to
550 --   check if a system default is being used. If a system default is being
551 --   used then we convert the defaulted value into its corresponding attribute
552 --   value held in the g_old_rec data structure.
553 --
554 -- Prerequisites:
555 --   This private function can only be called from the upd process.
556 --
557 -- In Parameters:
558 --   A Pl/Sql record structre.
559 --
560 -- Post Success:
561 --   The record structure will be returned with all system defaulted parameter
562 --   values converted into its current row attribute value.
563 --
564 -- Post Failure:
565 --   No direct error handling is required within this function. Any possible
566 --   errors within this procedure will be a PL/SQL value error due to conversion
567 --   of datatypes or data lengths.
568 --
569 -- Developer Implementation Notes:
570 --   None.
571 --
572 -- Access Status:
573 --   Internal Row Handler Use Only.
574 --
575 -- {End Of Comments}
576 -- ----------------------------------------------------------------------------
577 Procedure convert_defs(p_rec in out nocopy ben_ppv_shd.g_rec_type) is
578 --
579   l_proc  varchar2(72) := g_package||'convert_defs';
580 --
581 Begin
582   --
583   hr_utility.set_location('Entering:'||l_proc, 5);
584   --
585   -- We must now examine each argument value in the
586   -- p_rec plsql record structure
587   -- to see if a system default is being used. If a system default
588   -- is being used then we must set to the 'current' argument value.
589   --
590   If (p_rec.business_group_id = hr_api.g_number) then
591     p_rec.business_group_id :=
592     ben_ppv_shd.g_old_rec.business_group_id;
593   End If;
594   If (p_rec.rndg_cd = hr_api.g_varchar2) then
595     p_rec.rndg_cd :=
596     ben_ppv_shd.g_old_rec.rndg_cd;
597   End If;
598   If (p_rec.to_dy_mo_num = hr_api.g_number) then
599     p_rec.to_dy_mo_num :=
600     ben_ppv_shd.g_old_rec.to_dy_mo_num;
601   End If;
602   If (p_rec.from_dy_mo_num = hr_api.g_number) then
603     p_rec.from_dy_mo_num :=
604     ben_ppv_shd.g_old_rec.from_dy_mo_num;
605   End If;
606   If (p_rec.pct_val = hr_api.g_number) then
607     p_rec.pct_val :=
608     ben_ppv_shd.g_old_rec.pct_val;
609   End If;
610   If (p_rec.acty_base_rt_id = hr_api.g_number) then
611     p_rec.acty_base_rt_id :=
612     ben_ppv_shd.g_old_rec.acty_base_rt_id;
613   End If;
614   If (p_rec.strt_r_stp_cvg_cd = hr_api.g_varchar2) then
615     p_rec.strt_r_stp_cvg_cd :=
616     ben_ppv_shd.g_old_rec.strt_r_stp_cvg_cd;
617   End If;
618   If (p_rec.rndg_rl = hr_api.g_number) then
619     p_rec.rndg_rl :=
620     ben_ppv_shd.g_old_rec.rndg_rl;
621   End If;
622   If (p_rec.prtl_mo_prortn_rl = hr_api.g_number) then
623     p_rec.prtl_mo_prortn_rl :=
624     ben_ppv_shd.g_old_rec.prtl_mo_prortn_rl;
625   End If;
626   If (p_rec.actl_prem_id = hr_api.g_number) then
627     p_rec.actl_prem_id :=
628     ben_ppv_shd.g_old_rec.actl_prem_id;
629   End If;
630   If (p_rec.cvg_amt_calc_mthd_id = hr_api.g_number) then
631     p_rec.cvg_amt_calc_mthd_id :=
632     ben_ppv_shd.g_old_rec.cvg_amt_calc_mthd_id;
633   End If;
634   If (p_rec.num_days_month = hr_api.g_number) then
635     p_rec.num_days_month :=
636     ben_ppv_shd.g_old_rec.num_days_month;
637   End If;
638   If (p_rec.prorate_by_day_to_mon_flag = hr_api.g_varchar2) then
639     p_rec.prorate_by_day_to_mon_flag :=
640     ben_ppv_shd.g_old_rec.prorate_by_day_to_mon_flag;
641   End If;
642   If (p_rec.pmrpv_attribute_category = hr_api.g_varchar2) then
643     p_rec.pmrpv_attribute_category :=
644     ben_ppv_shd.g_old_rec.pmrpv_attribute_category;
645   End If;
646   If (p_rec.pmrpv_attribute1 = hr_api.g_varchar2) then
647     p_rec.pmrpv_attribute1 :=
648     ben_ppv_shd.g_old_rec.pmrpv_attribute1;
649   End If;
650   If (p_rec.pmrpv_attribute2 = hr_api.g_varchar2) then
651     p_rec.pmrpv_attribute2 :=
652     ben_ppv_shd.g_old_rec.pmrpv_attribute2;
653   End If;
654   If (p_rec.pmrpv_attribute3 = hr_api.g_varchar2) then
655     p_rec.pmrpv_attribute3 :=
656     ben_ppv_shd.g_old_rec.pmrpv_attribute3;
657   End If;
658   If (p_rec.pmrpv_attribute4 = hr_api.g_varchar2) then
659     p_rec.pmrpv_attribute4 :=
660     ben_ppv_shd.g_old_rec.pmrpv_attribute4;
661   End If;
662   If (p_rec.pmrpv_attribute5 = hr_api.g_varchar2) then
663     p_rec.pmrpv_attribute5 :=
664     ben_ppv_shd.g_old_rec.pmrpv_attribute5;
665   End If;
666   If (p_rec.pmrpv_attribute6 = hr_api.g_varchar2) then
667     p_rec.pmrpv_attribute6 :=
668     ben_ppv_shd.g_old_rec.pmrpv_attribute6;
669   End If;
670   If (p_rec.pmrpv_attribute7 = hr_api.g_varchar2) then
671     p_rec.pmrpv_attribute7 :=
672     ben_ppv_shd.g_old_rec.pmrpv_attribute7;
673   End If;
674   If (p_rec.pmrpv_attribute8 = hr_api.g_varchar2) then
675     p_rec.pmrpv_attribute8 :=
676     ben_ppv_shd.g_old_rec.pmrpv_attribute8;
677   End If;
678   If (p_rec.pmrpv_attribute9 = hr_api.g_varchar2) then
679     p_rec.pmrpv_attribute9 :=
680     ben_ppv_shd.g_old_rec.pmrpv_attribute9;
681   End If;
682   If (p_rec.pmrpv_attribute10 = hr_api.g_varchar2) then
683     p_rec.pmrpv_attribute10 :=
684     ben_ppv_shd.g_old_rec.pmrpv_attribute10;
685   End If;
686   If (p_rec.pmrpv_attribute11 = hr_api.g_varchar2) then
687     p_rec.pmrpv_attribute11 :=
688     ben_ppv_shd.g_old_rec.pmrpv_attribute11;
689   End If;
690   If (p_rec.pmrpv_attribute12 = hr_api.g_varchar2) then
691     p_rec.pmrpv_attribute12 :=
692     ben_ppv_shd.g_old_rec.pmrpv_attribute12;
693   End If;
694   If (p_rec.pmrpv_attribute13 = hr_api.g_varchar2) then
695     p_rec.pmrpv_attribute13 :=
696     ben_ppv_shd.g_old_rec.pmrpv_attribute13;
697   End If;
698   If (p_rec.pmrpv_attribute14 = hr_api.g_varchar2) then
699     p_rec.pmrpv_attribute14 :=
700     ben_ppv_shd.g_old_rec.pmrpv_attribute14;
701   End If;
702   If (p_rec.pmrpv_attribute15 = hr_api.g_varchar2) then
703     p_rec.pmrpv_attribute15 :=
704     ben_ppv_shd.g_old_rec.pmrpv_attribute15;
705   End If;
706   If (p_rec.pmrpv_attribute16 = hr_api.g_varchar2) then
707     p_rec.pmrpv_attribute16 :=
708     ben_ppv_shd.g_old_rec.pmrpv_attribute16;
709   End If;
710   If (p_rec.pmrpv_attribute17 = hr_api.g_varchar2) then
711     p_rec.pmrpv_attribute17 :=
712     ben_ppv_shd.g_old_rec.pmrpv_attribute17;
713   End If;
714   If (p_rec.pmrpv_attribute18 = hr_api.g_varchar2) then
715     p_rec.pmrpv_attribute18 :=
716     ben_ppv_shd.g_old_rec.pmrpv_attribute18;
717   End If;
718   If (p_rec.pmrpv_attribute19 = hr_api.g_varchar2) then
719     p_rec.pmrpv_attribute19 :=
720     ben_ppv_shd.g_old_rec.pmrpv_attribute19;
721   End If;
722   If (p_rec.pmrpv_attribute20 = hr_api.g_varchar2) then
723     p_rec.pmrpv_attribute20 :=
724     ben_ppv_shd.g_old_rec.pmrpv_attribute20;
725   End If;
726   If (p_rec.pmrpv_attribute21 = hr_api.g_varchar2) then
727     p_rec.pmrpv_attribute21 :=
728     ben_ppv_shd.g_old_rec.pmrpv_attribute21;
729   End If;
730   If (p_rec.pmrpv_attribute22 = hr_api.g_varchar2) then
731     p_rec.pmrpv_attribute22 :=
732     ben_ppv_shd.g_old_rec.pmrpv_attribute22;
733   End If;
734   If (p_rec.pmrpv_attribute23 = hr_api.g_varchar2) then
735     p_rec.pmrpv_attribute23 :=
736     ben_ppv_shd.g_old_rec.pmrpv_attribute23;
737   End If;
738   If (p_rec.pmrpv_attribute24 = hr_api.g_varchar2) then
739     p_rec.pmrpv_attribute24 :=
740     ben_ppv_shd.g_old_rec.pmrpv_attribute24;
741   End If;
742   If (p_rec.pmrpv_attribute25 = hr_api.g_varchar2) then
743     p_rec.pmrpv_attribute25 :=
744     ben_ppv_shd.g_old_rec.pmrpv_attribute25;
745   End If;
746   If (p_rec.pmrpv_attribute26 = hr_api.g_varchar2) then
747     p_rec.pmrpv_attribute26 :=
748     ben_ppv_shd.g_old_rec.pmrpv_attribute26;
749   End If;
750   If (p_rec.pmrpv_attribute27 = hr_api.g_varchar2) then
751     p_rec.pmrpv_attribute27 :=
752     ben_ppv_shd.g_old_rec.pmrpv_attribute27;
753   End If;
754   If (p_rec.pmrpv_attribute28 = hr_api.g_varchar2) then
755     p_rec.pmrpv_attribute28 :=
756     ben_ppv_shd.g_old_rec.pmrpv_attribute28;
757   End If;
758   If (p_rec.pmrpv_attribute29 = hr_api.g_varchar2) then
759     p_rec.pmrpv_attribute29 :=
760     ben_ppv_shd.g_old_rec.pmrpv_attribute29;
761   End If;
762   If (p_rec.pmrpv_attribute30 = hr_api.g_varchar2) then
763     p_rec.pmrpv_attribute30 :=
764     ben_ppv_shd.g_old_rec.pmrpv_attribute30;
765   End If;
766 
767   --
768   hr_utility.set_location(' Leaving:'||l_proc, 10);
769 --
770 End convert_defs;
771 --
772 -- ----------------------------------------------------------------------------
773 -- |---------------------------------< upd >----------------------------------|
774 -- ----------------------------------------------------------------------------
775 Procedure upd
776   (
777   p_rec			in out nocopy 	ben_ppv_shd.g_rec_type,
778   p_effective_date	in 	date,
779   p_datetrack_mode	in 	varchar2
780   ) is
781 --
782   l_proc			varchar2(72) := g_package||'upd';
783   l_validation_start_date	date;
784   l_validation_end_date		date;
785 --
786 Begin
787   hr_utility.set_location('Entering:'||l_proc, 5);
788   --
789   -- Ensure that the DateTrack update mode is valid
790   --
791   dt_api.validate_dt_upd_mode(p_datetrack_mode => p_datetrack_mode);
792   --
793   -- We must lock the row which we need to update.
794   --
795   ben_ppv_shd.lck
796 	(p_effective_date	 => p_effective_date,
797       	 p_datetrack_mode	 => p_datetrack_mode,
798       	 p_prtl_mo_rt_prtn_val_id	 => p_rec.prtl_mo_rt_prtn_val_id,
799       	 p_object_version_number => p_rec.object_version_number,
800       	 p_validation_start_date => l_validation_start_date,
801       	 p_validation_end_date	 => l_validation_end_date);
802   --
803   -- 1. During an update system defaults are used to determine if
804   --    arguments have been defaulted or not. We must therefore
805   --    derive the full record structure values to be updated.
806   --
807   -- 2. Call the supporting update validate operations.
808   --
809   convert_defs(p_rec);
810   ben_ppv_bus.update_validate
811 	(p_rec			 => p_rec,
812 	 p_effective_date	 => p_effective_date,
813 	 p_datetrack_mode  	 => p_datetrack_mode,
814 	 p_validation_start_date => l_validation_start_date,
815 	 p_validation_end_date	 => l_validation_end_date);
816   --
817   -- Call the supporting pre-update operation
818   --
819   pre_update
820 	(p_rec			 => p_rec,
821 	 p_effective_date	 => p_effective_date,
822 	 p_datetrack_mode	 => p_datetrack_mode,
823 	 p_validation_start_date => l_validation_start_date,
824 	 p_validation_end_date	 => l_validation_end_date);
825   --
826   -- Update the row.
827   --
828   update_dml
829 	(p_rec			 => p_rec,
830 	 p_effective_date	 => p_effective_date,
831 	 p_datetrack_mode	 => p_datetrack_mode,
832 	 p_validation_start_date => l_validation_start_date,
833 	 p_validation_end_date	 => l_validation_end_date);
834   --
835   -- Call the supporting post-update operation
836   --
837   post_update
838 	(p_rec			 => p_rec,
839 	 p_effective_date	 => p_effective_date,
840 	 p_datetrack_mode	 => p_datetrack_mode,
841 	 p_validation_start_date => l_validation_start_date,
842 	 p_validation_end_date	 => l_validation_end_date);
843 End upd;
844 --
845 -- ----------------------------------------------------------------------------
846 -- |---------------------------------< upd >----------------------------------|
847 -- ----------------------------------------------------------------------------
848 Procedure upd
849   (
850   p_prtl_mo_rt_prtn_val_id       in number,
851   p_effective_end_date           out nocopy date,
852   p_effective_start_date         out nocopy date,
853   p_business_group_id            in number           default hr_api.g_number,
854   p_rndg_cd                      in varchar2         default hr_api.g_varchar2,
855   p_to_dy_mo_num                 in number           default hr_api.g_number,
856   p_from_dy_mo_num               in number           default hr_api.g_number,
857   p_pct_val                      in number           default hr_api.g_number,
858   p_acty_base_rt_id              in number           default hr_api.g_number,
859   p_strt_r_stp_cvg_cd            in varchar2         default hr_api.g_varchar2,
860   p_rndg_rl                      in number           default hr_api.g_number,
861   p_prtl_mo_prortn_rl            in number           default hr_api.g_number,
862   p_actl_prem_id                 in number           default hr_api.g_number,
863   p_cvg_amt_calc_mthd_id         in number           default hr_api.g_number,
864   p_num_days_month               in number,
865   p_prorate_by_day_to_mon_flag   in varchar2,
866   p_pmrpv_attribute_category     in varchar2         default hr_api.g_varchar2,
867   p_pmrpv_attribute1             in varchar2         default hr_api.g_varchar2,
868   p_pmrpv_attribute2             in varchar2         default hr_api.g_varchar2,
869   p_pmrpv_attribute3             in varchar2         default hr_api.g_varchar2,
870   p_pmrpv_attribute4             in varchar2         default hr_api.g_varchar2,
871   p_pmrpv_attribute5             in varchar2         default hr_api.g_varchar2,
872   p_pmrpv_attribute6             in varchar2         default hr_api.g_varchar2,
873   p_pmrpv_attribute7             in varchar2         default hr_api.g_varchar2,
874   p_pmrpv_attribute8             in varchar2         default hr_api.g_varchar2,
875   p_pmrpv_attribute9             in varchar2         default hr_api.g_varchar2,
876   p_pmrpv_attribute10            in varchar2         default hr_api.g_varchar2,
877   p_pmrpv_attribute11            in varchar2         default hr_api.g_varchar2,
878   p_pmrpv_attribute12            in varchar2         default hr_api.g_varchar2,
879   p_pmrpv_attribute13            in varchar2         default hr_api.g_varchar2,
880   p_pmrpv_attribute14            in varchar2         default hr_api.g_varchar2,
881   p_pmrpv_attribute15            in varchar2         default hr_api.g_varchar2,
882   p_pmrpv_attribute16            in varchar2         default hr_api.g_varchar2,
883   p_pmrpv_attribute17            in varchar2         default hr_api.g_varchar2,
884   p_pmrpv_attribute18            in varchar2         default hr_api.g_varchar2,
885   p_pmrpv_attribute19            in varchar2         default hr_api.g_varchar2,
886   p_pmrpv_attribute20            in varchar2         default hr_api.g_varchar2,
887   p_pmrpv_attribute21            in varchar2         default hr_api.g_varchar2,
888   p_pmrpv_attribute22            in varchar2         default hr_api.g_varchar2,
889   p_pmrpv_attribute23            in varchar2         default hr_api.g_varchar2,
890   p_pmrpv_attribute24            in varchar2         default hr_api.g_varchar2,
891   p_pmrpv_attribute25            in varchar2         default hr_api.g_varchar2,
892   p_pmrpv_attribute26            in varchar2         default hr_api.g_varchar2,
893   p_pmrpv_attribute27            in varchar2         default hr_api.g_varchar2,
894   p_pmrpv_attribute28            in varchar2         default hr_api.g_varchar2,
895   p_pmrpv_attribute29            in varchar2         default hr_api.g_varchar2,
896   p_pmrpv_attribute30            in varchar2         default hr_api.g_varchar2,
897   p_object_version_number        in out nocopy number,
898   p_effective_date		 in date,
899   p_datetrack_mode		 in varchar2
900   ) is
901 --
902   l_rec		ben_ppv_shd.g_rec_type;
903   l_proc	varchar2(72) := g_package||'upd';
904 --
905 Begin
906   hr_utility.set_location('Entering:'||l_proc, 5);
907   --
908   -- Call conversion function to turn arguments into the
909   -- l_rec structure.
910   --
911   l_rec :=
912   ben_ppv_shd.convert_args
913   (
914   p_prtl_mo_rt_prtn_val_id,
915   null,
916   null,
917   p_business_group_id,
918   p_rndg_cd,
919   p_to_dy_mo_num,
920   p_from_dy_mo_num,
921   p_pct_val,
922   p_acty_base_rt_id,
923   p_strt_r_stp_cvg_cd,
924   p_rndg_rl,
925   p_prtl_mo_prortn_rl,
926   p_actl_prem_id,
927   p_cvg_amt_calc_mthd_id,
928   p_num_days_month   ,
929   p_prorate_by_day_to_mon_flag,
930   p_pmrpv_attribute_category,
931   p_pmrpv_attribute1,
932   p_pmrpv_attribute2,
933   p_pmrpv_attribute3,
934   p_pmrpv_attribute4,
935   p_pmrpv_attribute5,
936   p_pmrpv_attribute6,
937   p_pmrpv_attribute7,
938   p_pmrpv_attribute8,
939   p_pmrpv_attribute9,
940   p_pmrpv_attribute10,
941   p_pmrpv_attribute11,
942   p_pmrpv_attribute12,
943   p_pmrpv_attribute13,
944   p_pmrpv_attribute14,
945   p_pmrpv_attribute15,
946   p_pmrpv_attribute16,
947   p_pmrpv_attribute17,
948   p_pmrpv_attribute18,
949   p_pmrpv_attribute19,
950   p_pmrpv_attribute20,
951   p_pmrpv_attribute21,
952   p_pmrpv_attribute22,
953   p_pmrpv_attribute23,
954   p_pmrpv_attribute24,
955   p_pmrpv_attribute25,
956   p_pmrpv_attribute26,
957   p_pmrpv_attribute27,
958   p_pmrpv_attribute28,
959   p_pmrpv_attribute29,
960   p_pmrpv_attribute30,
961   p_object_version_number
962   );
963   --
964   -- Having converted the arguments into the
965   -- plsql record structure we call the corresponding record
966   -- business process.
967   --
968   upd(l_rec, p_effective_date, p_datetrack_mode);
969   p_object_version_number       := l_rec.object_version_number;
970   p_effective_start_date        := l_rec.effective_start_date;
971   p_effective_end_date          := l_rec.effective_end_date;
972   --
973   --
974   hr_utility.set_location(' Leaving:'||l_proc, 10);
975 End upd;
976 --
977 end ben_ppv_upd;