DBA Data[Home] [Help]

PACKAGE BODY: APPS.BEN_PAT_UPD

Source


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