DBA Data[Home] [Help]

PACKAGE BODY: APPS.BEN_PET_UPD

Source


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