DBA Data[Home] [Help]

PACKAGE BODY: APPS.BEN_BNB_UPD

Source


1 Package Body ben_bnb_upd as
2 /* $Header: bebnbrhi.pkb 120.1 2006/04/02 22:53:31 abparekh noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33)	:= '  ben_bnb_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_bnb_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_bnfts_bal_f',
78 	   p_base_key_column	=> 'bnfts_bal_id',
79 	   p_base_key_value	=> p_rec.bnfts_bal_id);
80     --
81     ben_bnb_shd.g_api_dml := true;  -- Set the api dml status
82     --
83     -- Update the ben_bnfts_bal_f Row
84     --
85     update  ben_bnfts_bal_f
86     set
87         bnfts_bal_id                    = p_rec.bnfts_bal_id,
88     name                            = p_rec.name,
89     bnfts_bal_usg_cd                = p_rec.bnfts_bal_usg_cd,
90     bnfts_bal_desc                  = p_rec.bnfts_bal_desc,
91     uom                             = p_rec.uom,
92     nnmntry_uom                     = p_rec.nnmntry_uom,
93     business_group_id               = p_rec.business_group_id,
94     bnb_attribute_category          = p_rec.bnb_attribute_category,
95     bnb_attribute1                  = p_rec.bnb_attribute1,
96     bnb_attribute2                  = p_rec.bnb_attribute2,
97     bnb_attribute3                  = p_rec.bnb_attribute3,
98     bnb_attribute4                  = p_rec.bnb_attribute4,
99     bnb_attribute5                  = p_rec.bnb_attribute5,
100     bnb_attribute6                  = p_rec.bnb_attribute6,
101     bnb_attribute7                  = p_rec.bnb_attribute7,
102     bnb_attribute8                  = p_rec.bnb_attribute8,
103     bnb_attribute9                  = p_rec.bnb_attribute9,
104     bnb_attribute10                 = p_rec.bnb_attribute10,
105     bnb_attribute11                 = p_rec.bnb_attribute11,
106     bnb_attribute12                 = p_rec.bnb_attribute12,
107     bnb_attribute13                 = p_rec.bnb_attribute13,
108     bnb_attribute14                 = p_rec.bnb_attribute14,
109     bnb_attribute15                 = p_rec.bnb_attribute15,
110     bnb_attribute16                 = p_rec.bnb_attribute16,
111     bnb_attribute17                 = p_rec.bnb_attribute17,
112     bnb_attribute18                 = p_rec.bnb_attribute18,
113     bnb_attribute19                 = p_rec.bnb_attribute19,
114     bnb_attribute20                 = p_rec.bnb_attribute20,
115     bnb_attribute21                 = p_rec.bnb_attribute21,
116     bnb_attribute22                 = p_rec.bnb_attribute22,
117     bnb_attribute23                 = p_rec.bnb_attribute23,
118     bnb_attribute24                 = p_rec.bnb_attribute24,
119     bnb_attribute25                 = p_rec.bnb_attribute25,
120     bnb_attribute26                 = p_rec.bnb_attribute26,
121     bnb_attribute27                 = p_rec.bnb_attribute27,
122     bnb_attribute28                 = p_rec.bnb_attribute28,
123     bnb_attribute29                 = p_rec.bnb_attribute29,
124     bnb_attribute30                 = p_rec.bnb_attribute30,
125     object_version_number           = p_rec.object_version_number
126     where   bnfts_bal_id = p_rec.bnfts_bal_id
127     and     effective_start_date = p_validation_start_date
128     and     effective_end_date   = p_validation_end_date;
129     --
130     ben_bnb_shd.g_api_dml := false;   -- Unset the api dml status
131     --
132     -- Set the effective start and end dates
133     --
134     p_rec.effective_start_date := p_validation_start_date;
135     p_rec.effective_end_date   := p_validation_end_date;
136   End If;
137 --
138 hr_utility.set_location(' Leaving:'||l_proc, 15);
139 Exception
140   When hr_api.check_integrity_violated Then
141     -- A check constraint has been violated
142     ben_bnb_shd.g_api_dml := false;   -- Unset the api dml status
143     ben_bnb_shd.constraint_error
144       (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
145   When hr_api.unique_integrity_violated Then
146     -- Unique integrity has been violated
147     ben_bnb_shd.g_api_dml := false;   -- Unset the api dml status
148     ben_bnb_shd.constraint_error
149       (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
150   When Others Then
151     ben_bnb_shd.g_api_dml := false;   -- Unset the api dml status
152     Raise;
153 End dt_update_dml;
154 --
155 -- ----------------------------------------------------------------------------
156 -- |------------------------------< update_dml >------------------------------|
157 -- ----------------------------------------------------------------------------
158 -- {Start Of Comments}
159 --
160 -- Description:
161 --   This procedure calls the dt_update_dml control logic which handles
162 --   the actual datetrack dml.
163 --
164 -- Prerequisites:
165 --   This is an internal private procedure which must be called from the upd
166 --   procedure.
167 --
168 -- In Parameters:
169 --   A Pl/Sql record structre.
170 --
171 -- Post Success:
172 --   Processing contines.
173 --
174 -- Post Failure:
175 --   No specific error handling is required within this procedure.
176 --
177 -- Developer Implementation Notes:
178 --   The update 'set' arguments list should be modified if any of your
179 --   attributes are not updateable.
180 --
181 -- Access Status:
182 --   Internal Row Handler Use Only.
183 --
184 -- {End Of Comments}
185 -- ----------------------------------------------------------------------------
186 Procedure update_dml
187 	(p_rec 			 in out nocopy ben_bnb_shd.g_rec_type,
188 	 p_effective_date	 in	date,
189 	 p_datetrack_mode	 in	varchar2,
190 	 p_validation_start_date in	date,
191 	 p_validation_end_date	 in	date) is
192 --
193   l_proc	varchar2(72) := g_package||'update_dml';
194 --
195 Begin
196   hr_utility.set_location('Entering:'||l_proc, 5);
197   --
198   dt_update_dml(p_rec			=> p_rec,
199 		p_effective_date	=> p_effective_date,
200 		p_datetrack_mode	=> p_datetrack_mode,
201        		p_validation_start_date	=> p_validation_start_date,
202 		p_validation_end_date	=> p_validation_end_date);
203   --
204   hr_utility.set_location(' Leaving:'||l_proc, 10);
205 End update_dml;
206 --
207 -- ----------------------------------------------------------------------------
208 -- |----------------------------< dt_pre_update >-----------------------------|
209 -- ----------------------------------------------------------------------------
210 -- {Start Of Comments}
211 --
212 -- Description:
213 --   The dt_pre_update procedure controls the execution
214 --   of dml for the datetrack modes of: UPDATE, UPDATE_OVERRIDE
215 --   and UPDATE_CHANGE_INSERT only. The execution required is as
216 --   follows:
217 --
218 --   1) Providing the datetrack update mode is not 'CORRECTION'
219 --      then set the effective end date of the current row (this
220 --      will be the validation_start_date - 1).
221 --   2) If the datetrack mode is 'UPDATE_OVERRIDE' then call the
222 --      corresponding delete_dml process to delete any future rows
223 --      where the effective_start_date is greater than or equal to
224 --	the validation_start_date.
225 --   3) Call the insert_dml process to insert the new updated row
226 --      details..
227 --
228 -- Prerequisites:
229 --   This is an internal procedure which is called from the
230 --   pre_update procedure.
231 --
232 -- In Parameters:
233 --
234 -- Post Success:
235 --   Processing continues.
236 --
237 -- Post Failure:
238 --   If an error has occurred, an error message and exception will be raised
239 --   but not handled.
240 --
241 -- Developer Implementation Notes:
242 --   This is an internal procedure which is required by Datetrack. Don't
243 --   remove or modify.
244 --
245 -- Access Status:
246 --   Internal Row Handler Use Only.
247 --
248 -- {End Of Comments}
249 -- ----------------------------------------------------------------------------
250 Procedure dt_pre_update
251 	(p_rec 			 in out nocopy ben_bnb_shd.g_rec_type,
252 	 p_effective_date	 in	date,
253 	 p_datetrack_mode	 in	varchar2,
254 	 p_validation_start_date in	date,
255 	 p_validation_end_date	 in	date) is
256 --
257   l_proc	         varchar2(72) := g_package||'dt_pre_update';
258   l_dummy_version_number number;
259 --
260 Begin
261   hr_utility.set_location('Entering:'||l_proc, 5);
262   If (p_datetrack_mode <> 'CORRECTION') then
263     hr_utility.set_location(l_proc, 10);
264     --
265     -- Update the current effective end date
266     --
267     ben_bnb_shd.upd_effective_end_date
268      (p_effective_date	       => p_effective_date,
269       p_base_key_value	       => p_rec.bnfts_bal_id,
270       p_new_effective_end_date => (p_validation_start_date - 1),
271       p_validation_start_date  => p_validation_start_date,
272       p_validation_end_date    => p_validation_end_date,
273       p_object_version_number  => l_dummy_version_number);
274     --
275     If (p_datetrack_mode = 'UPDATE_OVERRIDE') then
276       hr_utility.set_location(l_proc, 15);
277       --
278       -- As the datetrack mode is 'UPDATE_OVERRIDE' then we must
279       -- delete any future rows
280       --
281       ben_bnb_del.delete_dml
282         (p_rec			 => p_rec,
283 	 p_effective_date	 => p_effective_date,
284 	 p_datetrack_mode	 => p_datetrack_mode,
285 	 p_validation_start_date => p_validation_start_date,
286 	 p_validation_end_date   => p_validation_end_date);
287     End If;
288     hr_utility.set_location(l_proc, 20);
289     --
290     -- We must now insert the updated row
291     --
292     ben_bnb_ins.insert_dml
293       (p_rec			=> p_rec,
294        p_effective_date		=> p_effective_date,
295        p_datetrack_mode		=> p_datetrack_mode,
296        p_validation_start_date	=> p_validation_start_date,
297        p_validation_end_date	=> p_validation_end_date);
298   End If;
299   hr_utility.set_location(' Leaving:'||l_proc, 20);
300 End dt_pre_update;
301 --
302 -- ----------------------------------------------------------------------------
303 -- |------------------------------< pre_update >------------------------------|
304 -- ----------------------------------------------------------------------------
305 -- {Start Of Comments}
306 --
307 -- Description:
308 --   This private procedure contains any processing which is required before
309 --   the update dml.
310 --
311 -- Prerequisites:
312 --   This is an internal procedure which is called from the upd procedure.
313 --
314 -- In Parameters:
315 --   A Pl/Sql record structre.
316 --
317 -- Post Success:
318 --   Processing continues.
319 --
320 -- Post Failure:
321 --   If an error has occurred, an error message and exception will be raised
322 --   but not handled.
323 --
324 -- Developer Implementation Notes:
325 --   Any pre-processing required before the update dml is issued should be
326 --   coded within this procedure. It is important to note that any 3rd party
327 --   maintenance should be reviewed before placing in this procedure. The call
328 --   to the dt_update_dml procedure should NOT be removed.
329 --
330 -- Access Status:
331 --   Internal Row Handler Use Only.
332 --
333 -- {End Of Comments}
334 -- ----------------------------------------------------------------------------
335 Procedure pre_update
336 	(p_rec 			 in out nocopy ben_bnb_shd.g_rec_type,
337 	 p_effective_date	 in	date,
338 	 p_datetrack_mode	 in	varchar2,
339 	 p_validation_start_date in	date,
340 	 p_validation_end_date	 in	date) is
341 --
342   l_proc	varchar2(72) := g_package||'pre_update';
343 --
344 Begin
345   hr_utility.set_location('Entering:'||l_proc, 5);
346   --
347   --
348   --
349   dt_pre_update
350     (p_rec 		     => p_rec,
351      p_effective_date	     => p_effective_date,
352      p_datetrack_mode	     => p_datetrack_mode,
353      p_validation_start_date => p_validation_start_date,
354      p_validation_end_date   => p_validation_end_date);
355   --
356   hr_utility.set_location(' Leaving:'||l_proc, 10);
357 End pre_update;
358 --
359 -- ----------------------------------------------------------------------------
360 -- |-----------------------------< post_update >------------------------------|
361 -- ----------------------------------------------------------------------------
362 -- {Start Of Comments}
363 --
364 -- Description:
365 --   This private procedure contains any processing which is required after the
366 --   update dml.
367 --
368 -- Prerequisites:
369 --   This is an internal procedure which is called from the upd procedure.
370 --
371 -- In Parameters:
372 --   A Pl/Sql record structre.
373 --
374 -- Post Success:
375 --   Processing continues.
376 --
377 -- Post Failure:
378 --   If an error has occurred, an error message and exception will be raised
379 --   but not handled.
380 --
381 -- Developer Implementation Notes:
382 --   Any post-processing required after the update dml is issued should be
383 --   coded within this procedure. It is important to note that any 3rd party
384 --   maintenance should be reviewed before placing in this procedure.
385 --
386 -- Access Status:
387 --   Internal Row Handler Use Only.
388 --
389 -- {End Of Comments}
390 -- ----------------------------------------------------------------------------
391 Procedure post_update
392 	(p_rec 			 in ben_bnb_shd.g_rec_type,
393 	 p_effective_date	 in date,
394 	 p_datetrack_mode	 in varchar2,
395 	 p_validation_start_date in date,
396 	 p_validation_end_date	 in date) is
397 --
398   l_proc	varchar2(72) := g_package||'post_update';
399 --
400 Begin
401   hr_utility.set_location('Entering:'||l_proc, 5);
402 --
403   --
404   -- Start of API User Hook for post_update.
405   --
406   begin
407     --
408     ben_bnb_rku.after_update
409       (
410   p_bnfts_bal_id                  =>p_rec.bnfts_bal_id
411  ,p_effective_start_date          =>p_rec.effective_start_date
412  ,p_effective_end_date            =>p_rec.effective_end_date
413  ,p_name                          =>p_rec.name
414  ,p_bnfts_bal_usg_cd              =>p_rec.bnfts_bal_usg_cd
415  ,p_bnfts_bal_desc                =>p_rec.bnfts_bal_desc
416  ,p_uom                           =>p_rec.uom
417  ,p_nnmntry_uom                   =>p_rec.nnmntry_uom
418  ,p_business_group_id             =>p_rec.business_group_id
419  ,p_bnb_attribute_category        =>p_rec.bnb_attribute_category
420  ,p_bnb_attribute1                =>p_rec.bnb_attribute1
421  ,p_bnb_attribute2                =>p_rec.bnb_attribute2
422  ,p_bnb_attribute3                =>p_rec.bnb_attribute3
423  ,p_bnb_attribute4                =>p_rec.bnb_attribute4
424  ,p_bnb_attribute5                =>p_rec.bnb_attribute5
425  ,p_bnb_attribute6                =>p_rec.bnb_attribute6
426  ,p_bnb_attribute7                =>p_rec.bnb_attribute7
427  ,p_bnb_attribute8                =>p_rec.bnb_attribute8
428  ,p_bnb_attribute9                =>p_rec.bnb_attribute9
429  ,p_bnb_attribute10               =>p_rec.bnb_attribute10
430  ,p_bnb_attribute11               =>p_rec.bnb_attribute11
431  ,p_bnb_attribute12               =>p_rec.bnb_attribute12
432  ,p_bnb_attribute13               =>p_rec.bnb_attribute13
433  ,p_bnb_attribute14               =>p_rec.bnb_attribute14
434  ,p_bnb_attribute15               =>p_rec.bnb_attribute15
435  ,p_bnb_attribute16               =>p_rec.bnb_attribute16
436  ,p_bnb_attribute17               =>p_rec.bnb_attribute17
437  ,p_bnb_attribute18               =>p_rec.bnb_attribute18
438  ,p_bnb_attribute19               =>p_rec.bnb_attribute19
439  ,p_bnb_attribute20               =>p_rec.bnb_attribute20
440  ,p_bnb_attribute21               =>p_rec.bnb_attribute21
441  ,p_bnb_attribute22               =>p_rec.bnb_attribute22
442  ,p_bnb_attribute23               =>p_rec.bnb_attribute23
443  ,p_bnb_attribute24               =>p_rec.bnb_attribute24
444  ,p_bnb_attribute25               =>p_rec.bnb_attribute25
445  ,p_bnb_attribute26               =>p_rec.bnb_attribute26
446  ,p_bnb_attribute27               =>p_rec.bnb_attribute27
447  ,p_bnb_attribute28               =>p_rec.bnb_attribute28
448  ,p_bnb_attribute29               =>p_rec.bnb_attribute29
449  ,p_bnb_attribute30               =>p_rec.bnb_attribute30
450  ,p_object_version_number         =>p_rec.object_version_number
451  ,p_effective_date                =>p_effective_date
452  ,p_datetrack_mode                =>p_datetrack_mode
453  ,p_validation_start_date         =>p_validation_start_date
454  ,p_validation_end_date           =>p_validation_end_date
455  ,p_effective_start_date_o        =>ben_bnb_shd.g_old_rec.effective_start_date
456  ,p_effective_end_date_o          =>ben_bnb_shd.g_old_rec.effective_end_date
457  ,p_name_o                        =>ben_bnb_shd.g_old_rec.name
458  ,p_bnfts_bal_usg_cd_o            =>ben_bnb_shd.g_old_rec.bnfts_bal_usg_cd
459  ,p_bnfts_bal_desc_o              =>ben_bnb_shd.g_old_rec.bnfts_bal_desc
460  ,p_uom_o                         =>ben_bnb_shd.g_old_rec.uom
461  ,p_nnmntry_uom_o                 =>ben_bnb_shd.g_old_rec.nnmntry_uom
462  ,p_business_group_id_o           =>ben_bnb_shd.g_old_rec.business_group_id
463  ,p_bnb_attribute_category_o      =>ben_bnb_shd.g_old_rec.bnb_attribute_category
464  ,p_bnb_attribute1_o              =>ben_bnb_shd.g_old_rec.bnb_attribute1
465  ,p_bnb_attribute2_o              =>ben_bnb_shd.g_old_rec.bnb_attribute2
466  ,p_bnb_attribute3_o              =>ben_bnb_shd.g_old_rec.bnb_attribute3
467  ,p_bnb_attribute4_o              =>ben_bnb_shd.g_old_rec.bnb_attribute4
468  ,p_bnb_attribute5_o              =>ben_bnb_shd.g_old_rec.bnb_attribute5
469  ,p_bnb_attribute6_o              =>ben_bnb_shd.g_old_rec.bnb_attribute6
470  ,p_bnb_attribute7_o              =>ben_bnb_shd.g_old_rec.bnb_attribute7
471  ,p_bnb_attribute8_o              =>ben_bnb_shd.g_old_rec.bnb_attribute8
472  ,p_bnb_attribute9_o              =>ben_bnb_shd.g_old_rec.bnb_attribute9
473  ,p_bnb_attribute10_o             =>ben_bnb_shd.g_old_rec.bnb_attribute10
474  ,p_bnb_attribute11_o             =>ben_bnb_shd.g_old_rec.bnb_attribute11
475  ,p_bnb_attribute12_o             =>ben_bnb_shd.g_old_rec.bnb_attribute12
476  ,p_bnb_attribute13_o             =>ben_bnb_shd.g_old_rec.bnb_attribute13
477  ,p_bnb_attribute14_o             =>ben_bnb_shd.g_old_rec.bnb_attribute14
478  ,p_bnb_attribute15_o             =>ben_bnb_shd.g_old_rec.bnb_attribute15
479  ,p_bnb_attribute16_o             =>ben_bnb_shd.g_old_rec.bnb_attribute16
480  ,p_bnb_attribute17_o             =>ben_bnb_shd.g_old_rec.bnb_attribute17
481  ,p_bnb_attribute18_o             =>ben_bnb_shd.g_old_rec.bnb_attribute18
482  ,p_bnb_attribute19_o             =>ben_bnb_shd.g_old_rec.bnb_attribute19
483  ,p_bnb_attribute20_o             =>ben_bnb_shd.g_old_rec.bnb_attribute20
484  ,p_bnb_attribute21_o             =>ben_bnb_shd.g_old_rec.bnb_attribute21
485  ,p_bnb_attribute22_o             =>ben_bnb_shd.g_old_rec.bnb_attribute22
486  ,p_bnb_attribute23_o             =>ben_bnb_shd.g_old_rec.bnb_attribute23
487  ,p_bnb_attribute24_o             =>ben_bnb_shd.g_old_rec.bnb_attribute24
488  ,p_bnb_attribute25_o             =>ben_bnb_shd.g_old_rec.bnb_attribute25
489  ,p_bnb_attribute26_o             =>ben_bnb_shd.g_old_rec.bnb_attribute26
490  ,p_bnb_attribute27_o             =>ben_bnb_shd.g_old_rec.bnb_attribute27
491  ,p_bnb_attribute28_o             =>ben_bnb_shd.g_old_rec.bnb_attribute28
492  ,p_bnb_attribute29_o             =>ben_bnb_shd.g_old_rec.bnb_attribute29
493  ,p_bnb_attribute30_o             =>ben_bnb_shd.g_old_rec.bnb_attribute30
494  ,p_object_version_number_o       =>ben_bnb_shd.g_old_rec.object_version_number
495       );
496     --
497   exception
498     --
499     when hr_api.cannot_find_prog_unit then
500       --
501       hr_api.cannot_find_prog_unit_error
502         (p_module_name => 'ben_bnfts_bal_f'
503         ,p_hook_type   => 'AU');
504       --
505   end;
506   --
507   -- End of API User Hook for post_update.
508   --
509   --
510   hr_utility.set_location(' Leaving:'||l_proc, 10);
511 End post_update;
512 --
513 -- ----------------------------------------------------------------------------
514 -- |-----------------------------< convert_defs >-----------------------------|
515 -- ----------------------------------------------------------------------------
516 -- {Start Of Comments}
517 --
518 -- Description:
519 --   The Convert_Defs procedure has one very important function:
520 --   It must return the record structure for the row with all system defaulted
521 --   values converted into its corresponding parameter value for update. When
522 --   we attempt to update a row through the Upd process , certain
523 --   parameters can be defaulted which enables flexibility in the calling of
524 --   the upd process (e.g. only attributes which need to be updated need to be
525 --   specified). For the upd process to determine which attributes
526 --   have NOT been specified we need to check if the parameter has a reserved
527 --   system default value. Therefore, for all parameters which have a
528 --   corresponding reserved system default mechanism specified we need to
529 --   check if a system default is being used. If a system default is being
530 --   used then we convert the defaulted value into its corresponding attribute
531 --   value held in the g_old_rec data structure.
532 --
533 -- Prerequisites:
534 --   This private function can only be called from the upd process.
535 --
536 -- In Parameters:
537 --   A Pl/Sql record structre.
538 --
539 -- Post Success:
540 --   The record structure will be returned with all system defaulted parameter
541 --   values converted into its current row attribute value.
542 --
543 -- Post Failure:
544 --   No direct error handling is required within this function. Any possible
545 --   errors within this procedure will be a PL/SQL value error due to conversion
546 --   of datatypes or data lengths.
547 --
548 -- Developer Implementation Notes:
549 --   None.
550 --
551 -- Access Status:
552 --   Internal Row Handler Use Only.
553 --
554 -- {End Of Comments}
555 -- ----------------------------------------------------------------------------
556 Procedure convert_defs(p_rec in out nocopy ben_bnb_shd.g_rec_type) is
557 --
558   l_proc  varchar2(72) := g_package||'convert_defs';
559 --
560 Begin
561   --
562   hr_utility.set_location('Entering:'||l_proc, 5);
563   --
564   -- We must now examine each argument value in the
565   -- p_rec plsql record structure
566   -- to see if a system default is being used. If a system default
567   -- is being used then we must set to the 'current' argument value.
568   --
569   If (p_rec.name = hr_api.g_varchar2) then
570     p_rec.name :=
571     ben_bnb_shd.g_old_rec.name;
572   End If;
573   If (p_rec.bnfts_bal_usg_cd = hr_api.g_varchar2) then
574     p_rec.bnfts_bal_usg_cd :=
575     ben_bnb_shd.g_old_rec.bnfts_bal_usg_cd;
576   End If;
577 --            Next 8 lines added for nnmntry_uom , uom
578   If (p_rec.nnmntry_uom = hr_api.g_varchar2) then
579     p_rec.nnmntry_uom  :=
580     ben_bnb_shd.g_old_rec.nnmntry_uom;
581   End If;
582   If (p_rec.uom = hr_api.g_varchar2) then
583     p_rec.uom  :=
584     ben_bnb_shd.g_old_rec.uom;
585   End If;
586   If (p_rec.bnfts_bal_desc = hr_api.g_varchar2) then
587     p_rec.bnfts_bal_desc :=
588     ben_bnb_shd.g_old_rec.bnfts_bal_desc;
589   End If;
590   If (p_rec.business_group_id = hr_api.g_number) then
591     p_rec.business_group_id :=
592     ben_bnb_shd.g_old_rec.business_group_id;
593   End If;
594   If (p_rec.bnb_attribute_category = hr_api.g_varchar2) then
595     p_rec.bnb_attribute_category :=
596     ben_bnb_shd.g_old_rec.bnb_attribute_category;
597   End If;
598   If (p_rec.bnb_attribute1 = hr_api.g_varchar2) then
599     p_rec.bnb_attribute1 :=
600     ben_bnb_shd.g_old_rec.bnb_attribute1;
601   End If;
602   If (p_rec.bnb_attribute2 = hr_api.g_varchar2) then
603     p_rec.bnb_attribute2 :=
604     ben_bnb_shd.g_old_rec.bnb_attribute2;
605   End If;
606   If (p_rec.bnb_attribute3 = hr_api.g_varchar2) then
607     p_rec.bnb_attribute3 :=
608     ben_bnb_shd.g_old_rec.bnb_attribute3;
609   End If;
610   If (p_rec.bnb_attribute4 = hr_api.g_varchar2) then
611     p_rec.bnb_attribute4 :=
612     ben_bnb_shd.g_old_rec.bnb_attribute4;
613   End If;
614   If (p_rec.bnb_attribute5 = hr_api.g_varchar2) then
615     p_rec.bnb_attribute5 :=
616     ben_bnb_shd.g_old_rec.bnb_attribute5;
617   End If;
618   If (p_rec.bnb_attribute6 = hr_api.g_varchar2) then
619     p_rec.bnb_attribute6 :=
620     ben_bnb_shd.g_old_rec.bnb_attribute6;
621   End If;
622   If (p_rec.bnb_attribute7 = hr_api.g_varchar2) then
623     p_rec.bnb_attribute7 :=
624     ben_bnb_shd.g_old_rec.bnb_attribute7;
625   End If;
626   If (p_rec.bnb_attribute8 = hr_api.g_varchar2) then
627     p_rec.bnb_attribute8 :=
628     ben_bnb_shd.g_old_rec.bnb_attribute8;
629   End If;
630   If (p_rec.bnb_attribute9 = hr_api.g_varchar2) then
631     p_rec.bnb_attribute9 :=
632     ben_bnb_shd.g_old_rec.bnb_attribute9;
633   End If;
634   If (p_rec.bnb_attribute10 = hr_api.g_varchar2) then
635     p_rec.bnb_attribute10 :=
636     ben_bnb_shd.g_old_rec.bnb_attribute10;
637   End If;
638   If (p_rec.bnb_attribute11 = hr_api.g_varchar2) then
639     p_rec.bnb_attribute11 :=
640     ben_bnb_shd.g_old_rec.bnb_attribute11;
641   End If;
642   If (p_rec.bnb_attribute12 = hr_api.g_varchar2) then
643     p_rec.bnb_attribute12 :=
644     ben_bnb_shd.g_old_rec.bnb_attribute12;
645   End If;
646   If (p_rec.bnb_attribute13 = hr_api.g_varchar2) then
647     p_rec.bnb_attribute13 :=
648     ben_bnb_shd.g_old_rec.bnb_attribute13;
649   End If;
650   If (p_rec.bnb_attribute14 = hr_api.g_varchar2) then
651     p_rec.bnb_attribute14 :=
652     ben_bnb_shd.g_old_rec.bnb_attribute14;
653   End If;
654   If (p_rec.bnb_attribute15 = hr_api.g_varchar2) then
655     p_rec.bnb_attribute15 :=
656     ben_bnb_shd.g_old_rec.bnb_attribute15;
657   End If;
658   If (p_rec.bnb_attribute16 = hr_api.g_varchar2) then
659     p_rec.bnb_attribute16 :=
660     ben_bnb_shd.g_old_rec.bnb_attribute16;
661   End If;
662   If (p_rec.bnb_attribute17 = hr_api.g_varchar2) then
663     p_rec.bnb_attribute17 :=
664     ben_bnb_shd.g_old_rec.bnb_attribute17;
665   End If;
666   If (p_rec.bnb_attribute18 = hr_api.g_varchar2) then
667     p_rec.bnb_attribute18 :=
668     ben_bnb_shd.g_old_rec.bnb_attribute18;
669   End If;
670   If (p_rec.bnb_attribute19 = hr_api.g_varchar2) then
671     p_rec.bnb_attribute19 :=
672     ben_bnb_shd.g_old_rec.bnb_attribute19;
673   End If;
674   If (p_rec.bnb_attribute20 = hr_api.g_varchar2) then
675     p_rec.bnb_attribute20 :=
676     ben_bnb_shd.g_old_rec.bnb_attribute20;
677   End If;
678   If (p_rec.bnb_attribute21 = hr_api.g_varchar2) then
679     p_rec.bnb_attribute21 :=
680     ben_bnb_shd.g_old_rec.bnb_attribute21;
681   End If;
682   If (p_rec.bnb_attribute22 = hr_api.g_varchar2) then
683     p_rec.bnb_attribute22 :=
684     ben_bnb_shd.g_old_rec.bnb_attribute22;
685   End If;
686   If (p_rec.bnb_attribute23 = hr_api.g_varchar2) then
687     p_rec.bnb_attribute23 :=
688     ben_bnb_shd.g_old_rec.bnb_attribute23;
689   End If;
690   If (p_rec.bnb_attribute24 = hr_api.g_varchar2) then
691     p_rec.bnb_attribute24 :=
692     ben_bnb_shd.g_old_rec.bnb_attribute24;
693   End If;
694   If (p_rec.bnb_attribute25 = hr_api.g_varchar2) then
695     p_rec.bnb_attribute25 :=
696     ben_bnb_shd.g_old_rec.bnb_attribute25;
697   End If;
698   If (p_rec.bnb_attribute26 = hr_api.g_varchar2) then
699     p_rec.bnb_attribute26 :=
700     ben_bnb_shd.g_old_rec.bnb_attribute26;
701   End If;
702   If (p_rec.bnb_attribute27 = hr_api.g_varchar2) then
703     p_rec.bnb_attribute27 :=
704     ben_bnb_shd.g_old_rec.bnb_attribute27;
705   End If;
706   If (p_rec.bnb_attribute28 = hr_api.g_varchar2) then
707     p_rec.bnb_attribute28 :=
708     ben_bnb_shd.g_old_rec.bnb_attribute28;
709   End If;
710   If (p_rec.bnb_attribute29 = hr_api.g_varchar2) then
711     p_rec.bnb_attribute29 :=
712     ben_bnb_shd.g_old_rec.bnb_attribute29;
713   End If;
714   If (p_rec.bnb_attribute30 = hr_api.g_varchar2) then
715     p_rec.bnb_attribute30 :=
716     ben_bnb_shd.g_old_rec.bnb_attribute30;
717   End If;
718 
719   --
720   hr_utility.set_location(' Leaving:'||l_proc, 10);
721 --
722 End convert_defs;
723 --
724 -- ----------------------------------------------------------------------------
725 -- |---------------------------------< upd >----------------------------------|
726 -- ----------------------------------------------------------------------------
727 Procedure upd
728   (
729   p_rec			in out nocopy 	ben_bnb_shd.g_rec_type,
730   p_effective_date	in 	date,
731   p_datetrack_mode	in 	varchar2
732   ) is
733 --
734   l_proc			varchar2(72) := g_package||'upd';
735   l_validation_start_date	date;
736   l_validation_end_date		date;
737 --
738 Begin
739   hr_utility.set_location('Entering:'||l_proc, 5);
740   --
741   -- Ensure that the DateTrack update mode is valid
742   --
743   dt_api.validate_dt_upd_mode(p_datetrack_mode => p_datetrack_mode);
744   --
745   -- We must lock the row which we need to update.
746   --
747   ben_bnb_shd.lck
748 	(p_effective_date	 => p_effective_date,
749       	 p_datetrack_mode	 => p_datetrack_mode,
750       	 p_bnfts_bal_id	 => p_rec.bnfts_bal_id,
751       	 p_object_version_number => p_rec.object_version_number,
752       	 p_validation_start_date => l_validation_start_date,
753       	 p_validation_end_date	 => l_validation_end_date);
754   --
755   -- 1. During an update system defaults are used to determine if
756   --    arguments have been defaulted or not. We must therefore
757   --    derive the full record structure values to be updated.
758   --
759   -- 2. Call the supporting update validate operations.
760   --
761   convert_defs(p_rec);
762   ben_bnb_bus.update_validate
763 	(p_rec			 => p_rec,
764 	 p_effective_date	 => p_effective_date,
765 	 p_datetrack_mode  	 => p_datetrack_mode,
766 	 p_validation_start_date => l_validation_start_date,
767 	 p_validation_end_date	 => l_validation_end_date);
768   --
769   -- Call the supporting pre-update operation
770   --
771   pre_update
772 	(p_rec			 => p_rec,
773 	 p_effective_date	 => p_effective_date,
774 	 p_datetrack_mode	 => p_datetrack_mode,
775 	 p_validation_start_date => l_validation_start_date,
776 	 p_validation_end_date	 => l_validation_end_date);
777   --
778   -- Update the row.
779   --
780   update_dml
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 post-update operation
788   --
789   post_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 End upd;
796 --
797 -- ----------------------------------------------------------------------------
798 -- |---------------------------------< upd >----------------------------------|
799 -- ----------------------------------------------------------------------------
800 Procedure upd
801   (
802   p_bnfts_bal_id                 in number,
803   p_effective_start_date         out nocopy date,
804   p_effective_end_date           out nocopy date,
805   p_name                         in varchar2         default hr_api.g_varchar2,
806   p_bnfts_bal_usg_cd             in varchar2         default hr_api.g_varchar2,
807   p_bnfts_bal_desc               in varchar2         default hr_api.g_varchar2,
808   p_uom                          in varchar2         default hr_api.g_varchar2,
809   p_nnmntry_uom                  in varchar2         default hr_api.g_varchar2,
810   p_business_group_id            in number           default hr_api.g_number,
811   p_bnb_attribute_category       in varchar2         default hr_api.g_varchar2,
812   p_bnb_attribute1               in varchar2         default hr_api.g_varchar2,
813   p_bnb_attribute2               in varchar2         default hr_api.g_varchar2,
814   p_bnb_attribute3               in varchar2         default hr_api.g_varchar2,
815   p_bnb_attribute4               in varchar2         default hr_api.g_varchar2,
816   p_bnb_attribute5               in varchar2         default hr_api.g_varchar2,
817   p_bnb_attribute6               in varchar2         default hr_api.g_varchar2,
818   p_bnb_attribute7               in varchar2         default hr_api.g_varchar2,
819   p_bnb_attribute8               in varchar2         default hr_api.g_varchar2,
820   p_bnb_attribute9               in varchar2         default hr_api.g_varchar2,
821   p_bnb_attribute10              in varchar2         default hr_api.g_varchar2,
822   p_bnb_attribute11              in varchar2         default hr_api.g_varchar2,
823   p_bnb_attribute12              in varchar2         default hr_api.g_varchar2,
824   p_bnb_attribute13              in varchar2         default hr_api.g_varchar2,
825   p_bnb_attribute14              in varchar2         default hr_api.g_varchar2,
826   p_bnb_attribute15              in varchar2         default hr_api.g_varchar2,
827   p_bnb_attribute16              in varchar2         default hr_api.g_varchar2,
828   p_bnb_attribute17              in varchar2         default hr_api.g_varchar2,
829   p_bnb_attribute18              in varchar2         default hr_api.g_varchar2,
830   p_bnb_attribute19              in varchar2         default hr_api.g_varchar2,
831   p_bnb_attribute20              in varchar2         default hr_api.g_varchar2,
832   p_bnb_attribute21              in varchar2         default hr_api.g_varchar2,
833   p_bnb_attribute22              in varchar2         default hr_api.g_varchar2,
834   p_bnb_attribute23              in varchar2         default hr_api.g_varchar2,
835   p_bnb_attribute24              in varchar2         default hr_api.g_varchar2,
836   p_bnb_attribute25              in varchar2         default hr_api.g_varchar2,
837   p_bnb_attribute26              in varchar2         default hr_api.g_varchar2,
838   p_bnb_attribute27              in varchar2         default hr_api.g_varchar2,
839   p_bnb_attribute28              in varchar2         default hr_api.g_varchar2,
840   p_bnb_attribute29              in varchar2         default hr_api.g_varchar2,
841   p_bnb_attribute30              in varchar2         default hr_api.g_varchar2,
842   p_object_version_number        in out nocopy number,
843   p_effective_date		 in date,
844   p_datetrack_mode		 in varchar2
845   ) is
846 --
847   l_rec		ben_bnb_shd.g_rec_type;
848   l_proc	varchar2(72) := g_package||'upd';
849 --
850 Begin
851   hr_utility.set_location('Entering:'||l_proc, 5);
852   --
853   -- Call conversion function to turn arguments into the
854   -- l_rec structure.
855   --
856   l_rec :=
857   ben_bnb_shd.convert_args
858   (
859   p_bnfts_bal_id,
860   null,
861   null,
862   p_name,
863   p_bnfts_bal_usg_cd,
864   p_bnfts_bal_desc,
865   p_uom,
866   p_nnmntry_uom,
867   p_business_group_id,
868   p_bnb_attribute_category,
869   p_bnb_attribute1,
870   p_bnb_attribute2,
871   p_bnb_attribute3,
872   p_bnb_attribute4,
873   p_bnb_attribute5,
874   p_bnb_attribute6,
875   p_bnb_attribute7,
876   p_bnb_attribute8,
877   p_bnb_attribute9,
878   p_bnb_attribute10,
879   p_bnb_attribute11,
880   p_bnb_attribute12,
881   p_bnb_attribute13,
882   p_bnb_attribute14,
883   p_bnb_attribute15,
884   p_bnb_attribute16,
885   p_bnb_attribute17,
886   p_bnb_attribute18,
887   p_bnb_attribute19,
888   p_bnb_attribute20,
889   p_bnb_attribute21,
890   p_bnb_attribute22,
891   p_bnb_attribute23,
892   p_bnb_attribute24,
893   p_bnb_attribute25,
894   p_bnb_attribute26,
895   p_bnb_attribute27,
896   p_bnb_attribute28,
897   p_bnb_attribute29,
898   p_bnb_attribute30,
899   p_object_version_number
900   );
901   --
902   -- Having converted the arguments into the
903   -- plsql record structure we call the corresponding record
904   -- business process.
905   --
906   upd(l_rec, p_effective_date, p_datetrack_mode);
907   p_object_version_number       := l_rec.object_version_number;
908   p_effective_start_date        := l_rec.effective_start_date;
909   p_effective_end_date          := l_rec.effective_end_date;
910   --
911   --
912   hr_utility.set_location(' Leaving:'||l_proc, 10);
913 End upd;
914 --
915 end ben_bnb_upd;