DBA Data[Home] [Help]

PACKAGE BODY: APPS.BEN_REG_UPD

Source


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