DBA Data[Home] [Help]

PACKAGE BODY: APPS.BEN_SAZ_UPD

Source


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