DBA Data[Home] [Help]

PACKAGE BODY: APPS.BEN_PCT_UPD

Source


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