DBA Data[Home] [Help]

PACKAGE BODY: APPS.BEN_PEA_UPD

Source


1 Package Body ben_pea_upd as
2 /* $Header: bepearhi.pkb 120.2 2005/08/09 06:07:35 nhunur noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33)	:= '  ben_pea_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_pea_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_prtt_enrt_actn_f',
78 	   p_base_key_column	=> 'prtt_enrt_actn_id',
79 	   p_base_key_value	=> p_rec.prtt_enrt_actn_id);
80     --
81     ben_pea_shd.g_api_dml := true;  -- Set the api dml status
82     --
83     -- Update the ben_prtt_enrt_actn_f Row
84     --
85     update  ben_prtt_enrt_actn_f
86     set
87         prtt_enrt_actn_id               = p_rec.prtt_enrt_actn_id,
88     cmpltd_dt                       = p_rec.cmpltd_dt,
89     due_dt                          = p_rec.due_dt,
90     rqd_flag                        = p_rec.rqd_flag,
91     prtt_enrt_rslt_id               = p_rec.prtt_enrt_rslt_id,
92     per_in_ler_id               = p_rec.per_in_ler_id,
93     actn_typ_id                     = p_rec.actn_typ_id,
94     elig_cvrd_dpnt_id               = p_rec.elig_cvrd_dpnt_id,
95     pl_bnf_id                       = p_rec.pl_bnf_id,
96     business_group_id               = p_rec.business_group_id,
97     pea_attribute_category          = p_rec.pea_attribute_category,
98     pea_attribute1                  = p_rec.pea_attribute1,
99     pea_attribute2                  = p_rec.pea_attribute2,
100     pea_attribute3                  = p_rec.pea_attribute3,
101     pea_attribute4                  = p_rec.pea_attribute4,
102     pea_attribute5                  = p_rec.pea_attribute5,
103     pea_attribute6                  = p_rec.pea_attribute6,
104     pea_attribute7                  = p_rec.pea_attribute7,
105     pea_attribute8                  = p_rec.pea_attribute8,
106     pea_attribute9                  = p_rec.pea_attribute9,
107     pea_attribute10                 = p_rec.pea_attribute10,
108     pea_attribute11                 = p_rec.pea_attribute11,
109     pea_attribute12                 = p_rec.pea_attribute12,
110     pea_attribute13                 = p_rec.pea_attribute13,
111     pea_attribute14                 = p_rec.pea_attribute14,
112     pea_attribute15                 = p_rec.pea_attribute15,
113     pea_attribute16                 = p_rec.pea_attribute16,
114     pea_attribute17                 = p_rec.pea_attribute17,
115     pea_attribute18                 = p_rec.pea_attribute18,
116     pea_attribute19                 = p_rec.pea_attribute19,
117     pea_attribute20                 = p_rec.pea_attribute20,
118     pea_attribute21                 = p_rec.pea_attribute21,
119     pea_attribute22                 = p_rec.pea_attribute22,
120     pea_attribute23                 = p_rec.pea_attribute23,
121     pea_attribute24                 = p_rec.pea_attribute24,
122     pea_attribute25                 = p_rec.pea_attribute25,
123     pea_attribute26                 = p_rec.pea_attribute26,
124     pea_attribute27                 = p_rec.pea_attribute27,
125     pea_attribute28                 = p_rec.pea_attribute28,
126     pea_attribute29                 = p_rec.pea_attribute29,
127     pea_attribute30                 = p_rec.pea_attribute30,
128     object_version_number           = p_rec.object_version_number
129     where   prtt_enrt_actn_id = p_rec.prtt_enrt_actn_id
130     and     effective_start_date = p_validation_start_date
131     and     effective_end_date   = p_validation_end_date;
132     --
133     ben_pea_shd.g_api_dml := false;   -- Unset the api dml status
134     --
135     -- Set the effective start and end dates
136     --
137     p_rec.effective_start_date := p_validation_start_date;
138     p_rec.effective_end_date   := p_validation_end_date;
139   End If;
140 --
141 hr_utility.set_location(' Leaving:'||l_proc, 15);
142 Exception
143   When hr_api.check_integrity_violated Then
144     -- A check constraint has been violated
145     ben_pea_shd.g_api_dml := false;   -- Unset the api dml status
146     ben_pea_shd.constraint_error
147       (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
148   When hr_api.unique_integrity_violated Then
149     -- Unique integrity has been violated
150     ben_pea_shd.g_api_dml := false;   -- Unset the api dml status
151     ben_pea_shd.constraint_error
152       (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
153   When Others Then
154     ben_pea_shd.g_api_dml := false;   -- Unset the api dml status
155     Raise;
156 End dt_update_dml;
157 --
158 -- ----------------------------------------------------------------------------
159 -- |------------------------------< update_dml >------------------------------|
160 -- ----------------------------------------------------------------------------
161 -- {Start Of Comments}
162 --
163 -- Description:
164 --   This procedure calls the dt_update_dml control logic which handles
165 --   the actual datetrack dml.
166 --
167 -- Prerequisites:
168 --   This is an internal private procedure which must be called from the upd
169 --   procedure.
170 --
171 -- In Parameters:
172 --   A Pl/Sql record structre.
173 --
174 -- Post Success:
175 --   Processing contines.
176 --
177 -- Post Failure:
178 --   No specific error handling is required within this procedure.
179 --
180 -- Developer Implementation Notes:
181 --   The update 'set' arguments list should be modified if any of your
182 --   attributes are not updateable.
183 --
184 -- Access Status:
185 --   Internal Row Handler Use Only.
186 --
187 -- {End Of Comments}
188 -- ----------------------------------------------------------------------------
189 Procedure update_dml
190 	(p_rec 			 in out nocopy ben_pea_shd.g_rec_type,
191 	 p_effective_date	 in	date,
192 	 p_datetrack_mode	 in	varchar2,
193 	 p_validation_start_date in	date,
194 	 p_validation_end_date	 in	date) is
195 --
196   l_proc	varchar2(72) := g_package||'update_dml';
197 --
198 Begin
199   hr_utility.set_location('Entering:'||l_proc, 5);
200   --
201   dt_update_dml(p_rec			=> p_rec,
202 		p_effective_date	=> p_effective_date,
203 		p_datetrack_mode	=> p_datetrack_mode,
204        		p_validation_start_date	=> p_validation_start_date,
205 		p_validation_end_date	=> p_validation_end_date);
206   --
207   hr_utility.set_location(' Leaving:'||l_proc, 10);
208 End update_dml;
209 --
210 -- ----------------------------------------------------------------------------
211 -- |----------------------------< dt_pre_update >-----------------------------|
212 -- ----------------------------------------------------------------------------
213 -- {Start Of Comments}
214 --
215 -- Description:
216 --   The dt_pre_update procedure controls the execution
217 --   of dml for the datetrack modes of: UPDATE, UPDATE_OVERRIDE
218 --   and UPDATE_CHANGE_INSERT only. The execution required is as
219 --   follows:
220 --
221 --   1) Providing the datetrack update mode is not 'CORRECTION'
222 --      then set the effective end date of the current row (this
223 --      will be the validation_start_date - 1).
224 --   2) If the datetrack mode is 'UPDATE_OVERRIDE' then call the
225 --      corresponding delete_dml process to delete any future rows
226 --      where the effective_start_date is greater than or equal to
227 --	the validation_start_date.
228 --   3) Call the insert_dml process to insert the new updated row
229 --      details..
230 --
231 -- Prerequisites:
232 --   This is an internal procedure which is called from the
233 --   pre_update procedure.
234 --
235 -- In Parameters:
236 --
237 -- Post Success:
238 --   Processing continues.
239 --
240 -- Post Failure:
241 --   If an error has occurred, an error message and exception will be raised
242 --   but not handled.
243 --
244 -- Developer Implementation Notes:
245 --   This is an internal procedure which is required by Datetrack. Don't
246 --   remove or modify.
247 --
248 -- Access Status:
249 --   Internal Row Handler Use Only.
250 --
251 -- {End Of Comments}
252 -- ----------------------------------------------------------------------------
253 Procedure dt_pre_update
254 	(p_rec 			 in out nocopy ben_pea_shd.g_rec_type,
255 	 p_effective_date	 in	date,
256 	 p_datetrack_mode	 in	varchar2,
257 	 p_validation_start_date in	date,
258 	 p_validation_end_date	 in	date) is
259 --
260   l_proc	         varchar2(72) := g_package||'dt_pre_update';
261   l_dummy_version_number number;
262 --
263 Begin
264   hr_utility.set_location('Entering:'||l_proc, 5);
265   If (p_datetrack_mode <> 'CORRECTION') then
266     hr_utility.set_location(l_proc, 10);
267     --
268     -- Update the current effective end date
269     --
270     ben_pea_shd.upd_effective_end_date
271      (p_effective_date	       => p_effective_date,
272       p_base_key_value	       => p_rec.prtt_enrt_actn_id,
273       p_new_effective_end_date => (p_validation_start_date - 1),
274       p_validation_start_date  => p_validation_start_date,
275       p_validation_end_date    => p_validation_end_date,
276       p_object_version_number  => l_dummy_version_number);
277     --
278     If (p_datetrack_mode = 'UPDATE_OVERRIDE') then
279       hr_utility.set_location(l_proc, 15);
280       --
281       -- As the datetrack mode is 'UPDATE_OVERRIDE' then we must
282       -- delete any future rows
283       --
284       ben_pea_del.delete_dml
285         (p_rec			 => p_rec,
286 	 p_effective_date	 => p_effective_date,
287 	 p_datetrack_mode	 => p_datetrack_mode,
288 	 p_validation_start_date => p_validation_start_date,
289 	 p_validation_end_date   => p_validation_end_date);
290     End If;
291     hr_utility.set_location(l_proc, 20);
292     --
293     -- We must now insert the updated row
294     --
295     ben_pea_ins.insert_dml
296       (p_rec			=> p_rec,
297        p_effective_date		=> p_effective_date,
298        p_datetrack_mode		=> p_datetrack_mode,
299        p_validation_start_date	=> p_validation_start_date,
300        p_validation_end_date	=> p_validation_end_date);
301   End If;
302   hr_utility.set_location(' Leaving:'||l_proc, 20);
303 End dt_pre_update;
304 --
305 -- ----------------------------------------------------------------------------
306 -- |------------------------------< pre_update >------------------------------|
307 -- ----------------------------------------------------------------------------
308 -- {Start Of Comments}
309 --
310 -- Description:
311 --   This private procedure contains any processing which is required before
312 --   the update dml.
313 --
314 -- Prerequisites:
315 --   This is an internal procedure which is called from the upd procedure.
316 --
317 -- In Parameters:
318 --   A Pl/Sql record structre.
319 --
320 -- Post Success:
321 --   Processing continues.
322 --
323 -- Post Failure:
324 --   If an error has occurred, an error message and exception will be raised
325 --   but not handled.
326 --
327 -- Developer Implementation Notes:
328 --   Any pre-processing required before the update dml is issued should be
329 --   coded within this procedure. It is important to note that any 3rd party
330 --   maintenance should be reviewed before placing in this procedure. The call
331 --   to the dt_update_dml procedure should NOT be removed.
332 --
333 -- Access Status:
334 --   Internal Row Handler Use Only.
335 --
336 -- {End Of Comments}
337 -- ----------------------------------------------------------------------------
338 Procedure pre_update
339 	(p_rec 			 in out nocopy ben_pea_shd.g_rec_type,
340 	 p_effective_date	 in	date,
341 	 p_datetrack_mode	 in	varchar2,
342 	 p_validation_start_date in	date,
343 	 p_validation_end_date	 in	date) is
344 --
345   l_proc	varchar2(72) := g_package||'pre_update';
346 --
347 Begin
348   hr_utility.set_location('Entering:'||l_proc, 5);
349   --
350   --
351   --
352   dt_pre_update
353     (p_rec 		     => p_rec,
354      p_effective_date	     => p_effective_date,
355      p_datetrack_mode	     => p_datetrack_mode,
356      p_validation_start_date => p_validation_start_date,
357      p_validation_end_date   => p_validation_end_date);
358   --
359   hr_utility.set_location(' Leaving:'||l_proc, 10);
360 End pre_update;
361 --
362 -- ----------------------------------------------------------------------------
363 -- |-----------------------------< post_update >------------------------------|
364 -- ----------------------------------------------------------------------------
365 -- {Start Of Comments}
366 --
367 -- Description:
368 --   This private procedure contains any processing which is required after the
369 --   update dml.
370 --
371 -- Prerequisites:
372 --   This is an internal procedure which is called from the upd procedure.
373 --
374 -- In Parameters:
375 --   A Pl/Sql record structre.
376 --
377 -- Post Success:
378 --   Processing continues.
379 --
380 -- Post Failure:
381 --   If an error has occurred, an error message and exception will be raised
382 --   but not handled.
383 --
384 -- Developer Implementation Notes:
385 --   Any post-processing required after the update dml is issued should be
386 --   coded within this procedure. It is important to note that any 3rd party
390 --   Internal Row Handler Use Only.
387 --   maintenance should be reviewed before placing in this procedure.
388 --
389 -- Access Status:
391 --
392 -- {End Of Comments}
393 -- ----------------------------------------------------------------------------
394 Procedure post_update
395 	(p_rec 			 in ben_pea_shd.g_rec_type,
396 	 p_effective_date	 in date,
397 	 p_datetrack_mode	 in varchar2,
398 	 p_validation_start_date in date,
399 	 p_validation_end_date	 in date) is
400 --
401   l_proc	varchar2(72) := g_package||'post_update';
402 --
403 Begin
404   hr_utility.set_location('Entering:'||l_proc, 5);
405 --
406   --
407   -- Start of API User Hook for post_update.
408   --
409   begin
410     --
411     ben_pea_rku.after_update
412       (
413   p_prtt_enrt_actn_id             =>p_rec.prtt_enrt_actn_id
414  ,p_effective_start_date          =>p_rec.effective_start_date
415  ,p_effective_end_date            =>p_rec.effective_end_date
416  ,p_cmpltd_dt                     =>p_rec.cmpltd_dt
417  ,p_due_dt                        =>p_rec.due_dt
418  ,p_rqd_flag                      =>p_rec.rqd_flag
419  ,p_prtt_enrt_rslt_id             =>p_rec.prtt_enrt_rslt_id
420  ,p_per_in_ler_id             =>p_rec.per_in_ler_id
421  ,p_actn_typ_id                   =>p_rec.actn_typ_id
422  ,p_elig_cvrd_dpnt_id             =>p_rec.elig_cvrd_dpnt_id
423  ,p_pl_bnf_id                     =>p_rec.pl_bnf_id
424  ,p_business_group_id             =>p_rec.business_group_id
425  ,p_pea_attribute_category        =>p_rec.pea_attribute_category
426  ,p_pea_attribute1                =>p_rec.pea_attribute1
427  ,p_pea_attribute2                =>p_rec.pea_attribute2
428  ,p_pea_attribute3                =>p_rec.pea_attribute3
429  ,p_pea_attribute4                =>p_rec.pea_attribute4
430  ,p_pea_attribute5                =>p_rec.pea_attribute5
431  ,p_pea_attribute6                =>p_rec.pea_attribute6
432  ,p_pea_attribute7                =>p_rec.pea_attribute7
433  ,p_pea_attribute8                =>p_rec.pea_attribute8
434  ,p_pea_attribute9                =>p_rec.pea_attribute9
435  ,p_pea_attribute10               =>p_rec.pea_attribute10
436  ,p_pea_attribute11               =>p_rec.pea_attribute11
437  ,p_pea_attribute12               =>p_rec.pea_attribute12
438  ,p_pea_attribute13               =>p_rec.pea_attribute13
439  ,p_pea_attribute14               =>p_rec.pea_attribute14
440  ,p_pea_attribute15               =>p_rec.pea_attribute15
441  ,p_pea_attribute16               =>p_rec.pea_attribute16
442  ,p_pea_attribute17               =>p_rec.pea_attribute17
443  ,p_pea_attribute18               =>p_rec.pea_attribute18
444  ,p_pea_attribute19               =>p_rec.pea_attribute19
445  ,p_pea_attribute20               =>p_rec.pea_attribute20
446  ,p_pea_attribute21               =>p_rec.pea_attribute21
447  ,p_pea_attribute22               =>p_rec.pea_attribute22
448  ,p_pea_attribute23               =>p_rec.pea_attribute23
449  ,p_pea_attribute24               =>p_rec.pea_attribute24
450  ,p_pea_attribute25               =>p_rec.pea_attribute25
451  ,p_pea_attribute26               =>p_rec.pea_attribute26
452  ,p_pea_attribute27               =>p_rec.pea_attribute27
453  ,p_pea_attribute28               =>p_rec.pea_attribute28
454  ,p_pea_attribute29               =>p_rec.pea_attribute29
455  ,p_pea_attribute30               =>p_rec.pea_attribute30
456  ,p_object_version_number         =>p_rec.object_version_number
457  ,p_effective_date                =>p_effective_date
458  ,p_datetrack_mode                =>p_datetrack_mode
459  ,p_validation_start_date         =>p_validation_start_date
460  ,p_validation_end_date           =>p_validation_end_date
461  ,p_effective_start_date_o        =>ben_pea_shd.g_old_rec.effective_start_date
462  ,p_effective_end_date_o          =>ben_pea_shd.g_old_rec.effective_end_date
463  ,p_cmpltd_dt_o                   =>ben_pea_shd.g_old_rec.cmpltd_dt
464  ,p_due_dt_o                      =>ben_pea_shd.g_old_rec.due_dt
465  ,p_rqd_flag_o                    =>ben_pea_shd.g_old_rec.rqd_flag
466  ,p_prtt_enrt_rslt_id_o           =>ben_pea_shd.g_old_rec.prtt_enrt_rslt_id
467  ,p_per_in_ler_id_o           =>ben_pea_shd.g_old_rec.per_in_ler_id
468  ,p_actn_typ_id_o                 =>ben_pea_shd.g_old_rec.actn_typ_id
469  ,p_elig_cvrd_dpnt_id_o           =>ben_pea_shd.g_old_rec.elig_cvrd_dpnt_id
470  ,p_pl_bnf_id_o                   =>ben_pea_shd.g_old_rec.pl_bnf_id
471  ,p_business_group_id_o           =>ben_pea_shd.g_old_rec.business_group_id
472  ,p_pea_attribute_category_o      =>ben_pea_shd.g_old_rec.pea_attribute_category
473  ,p_pea_attribute1_o              =>ben_pea_shd.g_old_rec.pea_attribute1
474  ,p_pea_attribute2_o              =>ben_pea_shd.g_old_rec.pea_attribute2
475  ,p_pea_attribute3_o              =>ben_pea_shd.g_old_rec.pea_attribute3
476  ,p_pea_attribute4_o              =>ben_pea_shd.g_old_rec.pea_attribute4
477  ,p_pea_attribute5_o              =>ben_pea_shd.g_old_rec.pea_attribute5
478  ,p_pea_attribute6_o              =>ben_pea_shd.g_old_rec.pea_attribute6
479  ,p_pea_attribute7_o              =>ben_pea_shd.g_old_rec.pea_attribute7
480  ,p_pea_attribute8_o              =>ben_pea_shd.g_old_rec.pea_attribute8
481  ,p_pea_attribute9_o              =>ben_pea_shd.g_old_rec.pea_attribute9
482  ,p_pea_attribute10_o             =>ben_pea_shd.g_old_rec.pea_attribute10
483  ,p_pea_attribute11_o             =>ben_pea_shd.g_old_rec.pea_attribute11
484  ,p_pea_attribute12_o             =>ben_pea_shd.g_old_rec.pea_attribute12
485  ,p_pea_attribute13_o             =>ben_pea_shd.g_old_rec.pea_attribute13
486  ,p_pea_attribute14_o             =>ben_pea_shd.g_old_rec.pea_attribute14
490  ,p_pea_attribute18_o             =>ben_pea_shd.g_old_rec.pea_attribute18
487  ,p_pea_attribute15_o             =>ben_pea_shd.g_old_rec.pea_attribute15
488  ,p_pea_attribute16_o             =>ben_pea_shd.g_old_rec.pea_attribute16
489  ,p_pea_attribute17_o             =>ben_pea_shd.g_old_rec.pea_attribute17
491  ,p_pea_attribute19_o             =>ben_pea_shd.g_old_rec.pea_attribute19
492  ,p_pea_attribute20_o             =>ben_pea_shd.g_old_rec.pea_attribute20
493  ,p_pea_attribute21_o             =>ben_pea_shd.g_old_rec.pea_attribute21
494  ,p_pea_attribute22_o             =>ben_pea_shd.g_old_rec.pea_attribute22
495  ,p_pea_attribute23_o             =>ben_pea_shd.g_old_rec.pea_attribute23
496  ,p_pea_attribute24_o             =>ben_pea_shd.g_old_rec.pea_attribute24
497  ,p_pea_attribute25_o             =>ben_pea_shd.g_old_rec.pea_attribute25
498  ,p_pea_attribute26_o             =>ben_pea_shd.g_old_rec.pea_attribute26
499  ,p_pea_attribute27_o             =>ben_pea_shd.g_old_rec.pea_attribute27
500  ,p_pea_attribute28_o             =>ben_pea_shd.g_old_rec.pea_attribute28
501  ,p_pea_attribute29_o             =>ben_pea_shd.g_old_rec.pea_attribute29
502  ,p_pea_attribute30_o             =>ben_pea_shd.g_old_rec.pea_attribute30
503  ,p_object_version_number_o       =>ben_pea_shd.g_old_rec.object_version_number
504       );
505     --
506   exception
507     --
508     when hr_api.cannot_find_prog_unit then
509       --
510       hr_api.cannot_find_prog_unit_error
511         (p_module_name => 'ben_prtt_enrt_actn_f'
512         ,p_hook_type   => 'AU');
513       --
514   end;
515   --
516   -- End of API User Hook for post_update.
517   --
518   --
519   hr_utility.set_location(' Leaving:'||l_proc, 10);
520 End post_update;
521 --
522 -- ----------------------------------------------------------------------------
523 -- |-----------------------------< convert_defs >-----------------------------|
524 -- ----------------------------------------------------------------------------
525 -- {Start Of Comments}
526 --
527 -- Description:
528 --   The Convert_Defs procedure has one very important function:
529 --   It must return the record structure for the row with all system defaulted
530 --   values converted into its corresponding parameter value for update. When
531 --   we attempt to update a row through the Upd process , certain
532 --   parameters can be defaulted which enables flexibility in the calling of
533 --   the upd process (e.g. only attributes which need to be updated need to be
534 --   specified). For the upd process to determine which attributes
535 --   have NOT been specified we need to check if the parameter has a reserved
536 --   system default value. Therefore, for all parameters which have a
537 --   corresponding reserved system default mechanism specified we need to
538 --   check if a system default is being used. If a system default is being
539 --   used then we convert the defaulted value into its corresponding attribute
540 --   value held in the g_old_rec data structure.
541 --
542 -- Prerequisites:
543 --   This private function can only be called from the upd process.
544 --
545 -- In Parameters:
546 --   A Pl/Sql record structre.
547 --
548 -- Post Success:
549 --   The record structure will be returned with all system defaulted parameter
550 --   values converted into its current row attribute value.
551 --
552 -- Post Failure:
553 --   No direct error handling is required within this function. Any possible
554 --   errors within this procedure will be a PL/SQL value error due to conversion
555 --   of datatypes or data lengths.
556 --
557 -- Developer Implementation Notes:
558 --   None.
559 --
560 -- Access Status:
561 --   Internal Row Handler Use Only.
562 --
563 -- {End Of Comments}
564 -- ----------------------------------------------------------------------------
565 Procedure convert_defs(p_rec in out nocopy ben_pea_shd.g_rec_type) is
566 --
567   l_proc  varchar2(72) := g_package||'convert_defs';
568 --
569 Begin
570   --
571   hr_utility.set_location('Entering:'||l_proc, 5);
572   --
573   -- We must now examine each argument value in the
574   -- p_rec plsql record structure
575   -- to see if a system default is being used. If a system default
576   -- is being used then we must set to the 'current' argument value.
577   --
578   If (p_rec.cmpltd_dt = hr_api.g_date) then
579     p_rec.cmpltd_dt :=
580     ben_pea_shd.g_old_rec.cmpltd_dt;
581   End If;
582   If (p_rec.due_dt = hr_api.g_date) then
583     p_rec.due_dt :=
584     ben_pea_shd.g_old_rec.due_dt;
585   End If;
586   If (p_rec.rqd_flag = hr_api.g_varchar2) then
587     p_rec.rqd_flag :=
588     ben_pea_shd.g_old_rec.rqd_flag;
589   End If;
590   If (p_rec.prtt_enrt_rslt_id = hr_api.g_number) then
591     p_rec.prtt_enrt_rslt_id :=
592     ben_pea_shd.g_old_rec.prtt_enrt_rslt_id;
593   End If;
594   If (p_rec.per_in_ler_id = hr_api.g_number) then
595     p_rec.per_in_ler_id :=
596     ben_pea_shd.g_old_rec.per_in_ler_id;
597   End If;
598   If (p_rec.actn_typ_id = hr_api.g_number) then
599     p_rec.actn_typ_id :=
600     ben_pea_shd.g_old_rec.actn_typ_id;
601   End If;
602   If (p_rec.elig_cvrd_dpnt_id = hr_api.g_number) then
603     p_rec.elig_cvrd_dpnt_id :=
604     ben_pea_shd.g_old_rec.elig_cvrd_dpnt_id;
605   End If;
606   If (p_rec.pl_bnf_id = hr_api.g_number) then
610   If (p_rec.business_group_id = hr_api.g_number) then
607     p_rec.pl_bnf_id :=
608     ben_pea_shd.g_old_rec.pl_bnf_id;
609   End If;
611     p_rec.business_group_id :=
612     ben_pea_shd.g_old_rec.business_group_id;
613   End If;
614   If (p_rec.pea_attribute_category = hr_api.g_varchar2) then
615     p_rec.pea_attribute_category :=
616     ben_pea_shd.g_old_rec.pea_attribute_category;
617   End If;
618   If (p_rec.pea_attribute1 = hr_api.g_varchar2) then
619     p_rec.pea_attribute1 :=
620     ben_pea_shd.g_old_rec.pea_attribute1;
621   End If;
622   If (p_rec.pea_attribute2 = hr_api.g_varchar2) then
623     p_rec.pea_attribute2 :=
624     ben_pea_shd.g_old_rec.pea_attribute2;
625   End If;
626   If (p_rec.pea_attribute3 = hr_api.g_varchar2) then
627     p_rec.pea_attribute3 :=
628     ben_pea_shd.g_old_rec.pea_attribute3;
629   End If;
630   If (p_rec.pea_attribute4 = hr_api.g_varchar2) then
631     p_rec.pea_attribute4 :=
632     ben_pea_shd.g_old_rec.pea_attribute4;
633   End If;
634   If (p_rec.pea_attribute5 = hr_api.g_varchar2) then
635     p_rec.pea_attribute5 :=
636     ben_pea_shd.g_old_rec.pea_attribute5;
637   End If;
638   If (p_rec.pea_attribute6 = hr_api.g_varchar2) then
639     p_rec.pea_attribute6 :=
640     ben_pea_shd.g_old_rec.pea_attribute6;
641   End If;
642   If (p_rec.pea_attribute7 = hr_api.g_varchar2) then
643     p_rec.pea_attribute7 :=
644     ben_pea_shd.g_old_rec.pea_attribute7;
645   End If;
646   If (p_rec.pea_attribute8 = hr_api.g_varchar2) then
647     p_rec.pea_attribute8 :=
648     ben_pea_shd.g_old_rec.pea_attribute8;
649   End If;
650   If (p_rec.pea_attribute9 = hr_api.g_varchar2) then
651     p_rec.pea_attribute9 :=
652     ben_pea_shd.g_old_rec.pea_attribute9;
653   End If;
654   If (p_rec.pea_attribute10 = hr_api.g_varchar2) then
655     p_rec.pea_attribute10 :=
656     ben_pea_shd.g_old_rec.pea_attribute10;
657   End If;
658   If (p_rec.pea_attribute11 = hr_api.g_varchar2) then
659     p_rec.pea_attribute11 :=
660     ben_pea_shd.g_old_rec.pea_attribute11;
661   End If;
662   If (p_rec.pea_attribute12 = hr_api.g_varchar2) then
663     p_rec.pea_attribute12 :=
664     ben_pea_shd.g_old_rec.pea_attribute12;
665   End If;
666   If (p_rec.pea_attribute13 = hr_api.g_varchar2) then
667     p_rec.pea_attribute13 :=
668     ben_pea_shd.g_old_rec.pea_attribute13;
669   End If;
670   If (p_rec.pea_attribute14 = hr_api.g_varchar2) then
671     p_rec.pea_attribute14 :=
672     ben_pea_shd.g_old_rec.pea_attribute14;
673   End If;
674   If (p_rec.pea_attribute15 = hr_api.g_varchar2) then
675     p_rec.pea_attribute15 :=
676     ben_pea_shd.g_old_rec.pea_attribute15;
677   End If;
678   If (p_rec.pea_attribute16 = hr_api.g_varchar2) then
679     p_rec.pea_attribute16 :=
680     ben_pea_shd.g_old_rec.pea_attribute16;
681   End If;
682   If (p_rec.pea_attribute17 = hr_api.g_varchar2) then
683     p_rec.pea_attribute17 :=
684     ben_pea_shd.g_old_rec.pea_attribute17;
685   End If;
686   If (p_rec.pea_attribute18 = hr_api.g_varchar2) then
687     p_rec.pea_attribute18 :=
688     ben_pea_shd.g_old_rec.pea_attribute18;
689   End If;
690   If (p_rec.pea_attribute19 = hr_api.g_varchar2) then
691     p_rec.pea_attribute19 :=
692     ben_pea_shd.g_old_rec.pea_attribute19;
693   End If;
694   If (p_rec.pea_attribute20 = hr_api.g_varchar2) then
695     p_rec.pea_attribute20 :=
696     ben_pea_shd.g_old_rec.pea_attribute20;
697   End If;
698   If (p_rec.pea_attribute21 = hr_api.g_varchar2) then
699     p_rec.pea_attribute21 :=
700     ben_pea_shd.g_old_rec.pea_attribute21;
701   End If;
702   If (p_rec.pea_attribute22 = hr_api.g_varchar2) then
703     p_rec.pea_attribute22 :=
704     ben_pea_shd.g_old_rec.pea_attribute22;
705   End If;
706   If (p_rec.pea_attribute23 = hr_api.g_varchar2) then
707     p_rec.pea_attribute23 :=
708     ben_pea_shd.g_old_rec.pea_attribute23;
709   End If;
710   If (p_rec.pea_attribute24 = hr_api.g_varchar2) then
711     p_rec.pea_attribute24 :=
712     ben_pea_shd.g_old_rec.pea_attribute24;
713   End If;
714   If (p_rec.pea_attribute25 = hr_api.g_varchar2) then
715     p_rec.pea_attribute25 :=
716     ben_pea_shd.g_old_rec.pea_attribute25;
717   End If;
718   If (p_rec.pea_attribute26 = hr_api.g_varchar2) then
719     p_rec.pea_attribute26 :=
720     ben_pea_shd.g_old_rec.pea_attribute26;
721   End If;
722   If (p_rec.pea_attribute27 = hr_api.g_varchar2) then
723     p_rec.pea_attribute27 :=
724     ben_pea_shd.g_old_rec.pea_attribute27;
725   End If;
726   If (p_rec.pea_attribute28 = hr_api.g_varchar2) then
727     p_rec.pea_attribute28 :=
728     ben_pea_shd.g_old_rec.pea_attribute28;
729   End If;
730   If (p_rec.pea_attribute29 = hr_api.g_varchar2) then
731     p_rec.pea_attribute29 :=
732     ben_pea_shd.g_old_rec.pea_attribute29;
733   End If;
734   If (p_rec.pea_attribute30 = hr_api.g_varchar2) then
735     p_rec.pea_attribute30 :=
736     ben_pea_shd.g_old_rec.pea_attribute30;
737   End If;
738 
739   --
740   hr_utility.set_location(' Leaving:'||l_proc, 10);
741 --
742 End convert_defs;
743 --
744 -- ----------------------------------------------------------------------------
748   (
745 -- |---------------------------------< upd >----------------------------------|
746 -- ----------------------------------------------------------------------------
747 Procedure upd
749   p_rec			in out nocopy 	ben_pea_shd.g_rec_type,
750   p_effective_date	in 	date,
751   p_datetrack_mode	in 	varchar2
752   ) is
753 --
754   l_proc			varchar2(72) := g_package||'upd';
755   l_validation_start_date	date;
756   l_validation_end_date		date;
757 --
758 Begin
759   hr_utility.set_location('Entering:'||l_proc, 5);
760   --
761   -- Ensure that the DateTrack update mode is valid
762   --
763   dt_api.validate_dt_upd_mode(p_datetrack_mode => p_datetrack_mode);
764   --
765   -- We must lock the row which we need to update.
766   --
767   ben_pea_shd.lck
768 	(p_effective_date	 => p_effective_date,
769       	 p_datetrack_mode	 => p_datetrack_mode,
770       	 p_prtt_enrt_actn_id	 => p_rec.prtt_enrt_actn_id,
771       	 p_object_version_number => p_rec.object_version_number,
772       	 p_validation_start_date => l_validation_start_date,
773       	 p_validation_end_date	 => l_validation_end_date);
774   --
775   -- 1. During an update system defaults are used to determine if
776   --    arguments have been defaulted or not. We must therefore
777   --    derive the full record structure values to be updated.
778   --
779   -- 2. Call the supporting update validate operations.
780   --
781   convert_defs(p_rec);
782   ben_pea_bus.update_validate
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   -- Call the supporting pre-update operation
790   --
791   pre_update
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   -- Update the row.
799   --
800   update_dml
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   --
807   -- Call the supporting post-update operation
808   --
809   post_update
810 	(p_rec			 => p_rec,
811 	 p_effective_date	 => p_effective_date,
812 	 p_datetrack_mode	 => p_datetrack_mode,
813 	 p_validation_start_date => l_validation_start_date,
814 	 p_validation_end_date	 => l_validation_end_date);
815    --
816    --
817    --
818   if HRI_BPL_BEN_UTIL.enable_ben_col_evt_que then
819           HRI_OPL_BEN_ENRLACTN_EQ.update_event (p_rec 	=> p_rec ,
820                                		        p_effective_date => p_effective_date,
821                             		        p_datetrack_mode => p_datetrack_mode );
822 
823   end if;
824   --
825 End upd;
826 --
827 -- ----------------------------------------------------------------------------
828 -- |---------------------------------< upd >----------------------------------|
829 -- ----------------------------------------------------------------------------
830 Procedure upd
831   (
832   p_prtt_enrt_actn_id            in number,
833   p_effective_start_date         out nocopy date,
834   p_effective_end_date           out nocopy date,
835   p_cmpltd_dt                    in date             default hr_api.g_date,
836   p_due_dt                       in date             default hr_api.g_date,
837   p_rqd_flag                     in varchar2         default hr_api.g_varchar2,
838   p_prtt_enrt_rslt_id            in number           default hr_api.g_number,
839   p_per_in_ler_id            in number           default hr_api.g_number,
840   p_actn_typ_id                  in number           default hr_api.g_number,
841   p_elig_cvrd_dpnt_id            in number           default hr_api.g_number,
842   p_pl_bnf_id                    in number           default hr_api.g_number,
843   p_business_group_id            in number           default hr_api.g_number,
844   p_pea_attribute_category       in varchar2         default hr_api.g_varchar2,
845   p_pea_attribute1               in varchar2         default hr_api.g_varchar2,
846   p_pea_attribute2               in varchar2         default hr_api.g_varchar2,
847   p_pea_attribute3               in varchar2         default hr_api.g_varchar2,
848   p_pea_attribute4               in varchar2         default hr_api.g_varchar2,
849   p_pea_attribute5               in varchar2         default hr_api.g_varchar2,
850   p_pea_attribute6               in varchar2         default hr_api.g_varchar2,
851   p_pea_attribute7               in varchar2         default hr_api.g_varchar2,
852   p_pea_attribute8               in varchar2         default hr_api.g_varchar2,
853   p_pea_attribute9               in varchar2         default hr_api.g_varchar2,
854   p_pea_attribute10              in varchar2         default hr_api.g_varchar2,
855   p_pea_attribute11              in varchar2         default hr_api.g_varchar2,
856   p_pea_attribute12              in varchar2         default hr_api.g_varchar2,
857   p_pea_attribute13              in varchar2         default hr_api.g_varchar2,
858   p_pea_attribute14              in varchar2         default hr_api.g_varchar2,
859   p_pea_attribute15              in varchar2         default hr_api.g_varchar2,
860   p_pea_attribute16              in varchar2         default hr_api.g_varchar2,
861   p_pea_attribute17              in varchar2         default hr_api.g_varchar2,
862   p_pea_attribute18              in varchar2         default hr_api.g_varchar2,
863   p_pea_attribute19              in varchar2         default hr_api.g_varchar2,
864   p_pea_attribute20              in varchar2         default hr_api.g_varchar2,
865   p_pea_attribute21              in varchar2         default hr_api.g_varchar2,
866   p_pea_attribute22              in varchar2         default hr_api.g_varchar2,
867   p_pea_attribute23              in varchar2         default hr_api.g_varchar2,
868   p_pea_attribute24              in varchar2         default hr_api.g_varchar2,
869   p_pea_attribute25              in varchar2         default hr_api.g_varchar2,
870   p_pea_attribute26              in varchar2         default hr_api.g_varchar2,
871   p_pea_attribute27              in varchar2         default hr_api.g_varchar2,
872   p_pea_attribute28              in varchar2         default hr_api.g_varchar2,
873   p_pea_attribute29              in varchar2         default hr_api.g_varchar2,
874   p_pea_attribute30              in varchar2         default hr_api.g_varchar2,
875   p_object_version_number        in out nocopy number,
876   p_effective_date		 in date,
877   p_datetrack_mode		 in varchar2
878   ) is
879 --
880   l_rec		ben_pea_shd.g_rec_type;
881   l_proc	varchar2(72) := g_package||'upd';
882 --
883 Begin
884   hr_utility.set_location('Entering:'||l_proc, 5);
885   --
886   -- Call conversion function to turn arguments into the
887   -- l_rec structure.
888   --
889   l_rec :=
890   ben_pea_shd.convert_args
891   (
892   p_prtt_enrt_actn_id,
893   null,
894   null,
895   p_cmpltd_dt,
896   p_due_dt,
897   p_rqd_flag,
898   p_prtt_enrt_rslt_id,
899   p_per_in_ler_id,
900   p_actn_typ_id,
901   p_elig_cvrd_dpnt_id,
902   p_pl_bnf_id,
903   p_business_group_id,
904   p_pea_attribute_category,
905   p_pea_attribute1,
906   p_pea_attribute2,
907   p_pea_attribute3,
908   p_pea_attribute4,
909   p_pea_attribute5,
910   p_pea_attribute6,
911   p_pea_attribute7,
912   p_pea_attribute8,
913   p_pea_attribute9,
914   p_pea_attribute10,
915   p_pea_attribute11,
916   p_pea_attribute12,
917   p_pea_attribute13,
918   p_pea_attribute14,
919   p_pea_attribute15,
920   p_pea_attribute16,
921   p_pea_attribute17,
922   p_pea_attribute18,
923   p_pea_attribute19,
924   p_pea_attribute20,
925   p_pea_attribute21,
926   p_pea_attribute22,
927   p_pea_attribute23,
928   p_pea_attribute24,
929   p_pea_attribute25,
933   p_pea_attribute29,
930   p_pea_attribute26,
931   p_pea_attribute27,
932   p_pea_attribute28,
934   p_pea_attribute30,
935   p_object_version_number
936   );
937   --
938   -- Having converted the arguments into the
939   -- plsql record structure we call the corresponding record
940   -- business process.
941   --
942   upd(l_rec, p_effective_date, p_datetrack_mode);
943   p_object_version_number       := l_rec.object_version_number;
944   p_effective_start_date        := l_rec.effective_start_date;
945   p_effective_end_date          := l_rec.effective_end_date;
946   --
947   --
948   hr_utility.set_location(' Leaving:'||l_proc, 10);
949 End upd;
950 --
951 end ben_pea_upd;