DBA Data[Home] [Help]

PACKAGE BODY: APPS.BEN_PBB_UPD

Source


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