DBA Data[Home] [Help]

PACKAGE BODY: APPS.BEN_RGR_UPD

Source


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