DBA Data[Home] [Help]

PACKAGE BODY: APPS.BEN_JRT_UPD

Source


1 Package Body ben_jrt_upd as
2 /* $Header: bejrtrhi.pkb 120.2 2006/03/30 23:48:52 gsehgal noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33) := '  ben_jrt_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
21 --   this 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 structure.
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_jrt_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
63   ) is
64 --
65   l_proc        varchar2(72) := g_package||'dt_update_dml';
66 --
67 Begin
68   hr_utility.set_location('Entering:'||l_proc, 5);
69   --
70   If (p_datetrack_mode = hr_api.g_correction) then
71     hr_utility.set_location(l_proc, 10);
72     --
73     -- Because we are updating a row we must get the next object
74     -- version number.
75     --
76     p_rec.object_version_number :=
77       dt_api.get_object_version_number
78         (p_base_table_name => 'ben_job_rt_f'
79         ,p_base_key_column => 'job_rt_id'
80         ,p_base_key_value  => p_rec.job_rt_id
81         );
82     --
83     --
84     --
85     -- Update the ben_job_rt_f Row
86     --
87     update  ben_job_rt_f
88     set
89      job_rt_id                            = p_rec.job_rt_id
90     ,job_id                               = p_rec.job_id
91     ,excld_flag                           = p_rec.excld_flag
92     ,business_group_id                    = p_rec.business_group_id
93     ,vrbl_rt_prfl_id                      = p_rec.vrbl_rt_prfl_id
94     ,object_version_number                = p_rec.object_version_number
95     ,ordr_num                             = p_rec.ordr_num
96     ,jrt_attribute_category               = p_rec.jrt_attribute_category
97     ,jrt_attribute1                       = p_rec.jrt_attribute1
98     ,jrt_attribute2                       = p_rec.jrt_attribute2
99     ,jrt_attribute3                       = p_rec.jrt_attribute3
100     ,jrt_attribute4                       = p_rec.jrt_attribute4
101     ,jrt_attribute5                       = p_rec.jrt_attribute5
102     ,jrt_attribute6                       = p_rec.jrt_attribute6
103     ,jrt_attribute7                       = p_rec.jrt_attribute7
104     ,jrt_attribute8                       = p_rec.jrt_attribute8
105     ,jrt_attribute9                       = p_rec.jrt_attribute9
106     ,jrt_attribute10                      = p_rec.jrt_attribute10
107     ,jrt_attribute11                      = p_rec.jrt_attribute11
108     ,jrt_attribute12                      = p_rec.jrt_attribute12
109     ,jrt_attribute13                      = p_rec.jrt_attribute13
110     ,jrt_attribute14                      = p_rec.jrt_attribute14
111     ,jrt_attribute15                      = p_rec.jrt_attribute15
112     ,jrt_attribute16                      = p_rec.jrt_attribute16
113     ,jrt_attribute17                      = p_rec.jrt_attribute17
114     ,jrt_attribute18                      = p_rec.jrt_attribute18
115     ,jrt_attribute19                      = p_rec.jrt_attribute19
116     ,jrt_attribute20                      = p_rec.jrt_attribute20
117     ,jrt_attribute21                      = p_rec.jrt_attribute21
118     ,jrt_attribute22                      = p_rec.jrt_attribute22
119     ,jrt_attribute23                      = p_rec.jrt_attribute23
120     ,jrt_attribute24                      = p_rec.jrt_attribute24
121     ,jrt_attribute25                      = p_rec.jrt_attribute25
122     ,jrt_attribute26                      = p_rec.jrt_attribute26
123     ,jrt_attribute27                      = p_rec.jrt_attribute27
124     ,jrt_attribute28                      = p_rec.jrt_attribute28
125     ,jrt_attribute29                      = p_rec.jrt_attribute29
126     ,jrt_attribute30                      = p_rec.jrt_attribute30
127     where   job_rt_id = p_rec.job_rt_id
128     and     effective_start_date = p_validation_start_date
129     and     effective_end_date   = p_validation_end_date;
130     --
131     --
132     --
133     -- Set the effective start and end dates
134     --
135     p_rec.effective_start_date := p_validation_start_date;
136     p_rec.effective_end_date   := p_validation_end_date;
137   End If;
138 --
139 hr_utility.set_location(' Leaving:'||l_proc, 15);
140 Exception
141   When hr_api.check_integrity_violated Then
142     -- A check constraint has been violated
143     --
144     ben_jrt_shd.constraint_error
145       (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
146   When hr_api.unique_integrity_violated Then
147     -- Unique integrity has been violated
148     --
149     ben_jrt_shd.constraint_error
150       (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
151   When Others Then
152     --
153     Raise;
154 End dt_update_dml;
155 --
156 -- ----------------------------------------------------------------------------
157 -- |------------------------------< update_dml >------------------------------|
158 -- ----------------------------------------------------------------------------
159 -- {Start Of Comments}
160 --
161 -- Description:
162 --   This procedure calls the dt_update_dml control logic which handles
163 --   the actual datetrack dml.
164 --
165 -- Prerequisites:
166 --   This is an internal private procedure which must be called from the upd
167 --   procedure.
168 --
169 -- In Parameters:
170 --   A Pl/Sql record structre.
171 --
172 -- Post Success:
173 --   Processing contines.
174 --
175 -- Post Failure:
176 --   No specific error handling is required within this procedure.
177 --
178 -- Developer Implementation Notes:
179 --   The update 'set' arguments list should be modified if any of your
180 --   attributes are not updateable.
181 --
182 -- Access Status:
183 --   Internal Row Handler Use Only.
184 --
185 -- {End Of Comments}
186 -- ----------------------------------------------------------------------------
187 Procedure update_dml
188   (p_rec                      in out nocopy ben_jrt_shd.g_rec_type
189   ,p_effective_date           in date
190   ,p_datetrack_mode           in varchar2
191   ,p_validation_start_date    in date
192   ,p_validation_end_date      in date
193   ) 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   ben_jrt_upd.dt_update_dml
201     (p_rec                   => p_rec
202     ,p_effective_date        => p_effective_date
203     ,p_datetrack_mode        => p_datetrack_mode
204     ,p_validation_start_date => p_validation_start_date
205     ,p_validation_end_date   => p_validation_end_date
206     );
207   --
208   hr_utility.set_location(' Leaving:'||l_proc, 10);
209 End update_dml;
210 --
211 -- ----------------------------------------------------------------------------
212 -- |----------------------------< dt_pre_update >-----------------------------|
213 -- ----------------------------------------------------------------------------
214 -- {Start Of Comments}
215 --
216 -- Description:
217 --   The dt_pre_update procedure controls the execution
218 --   of dml for the datetrack modes of: UPDATE, UPDATE_OVERRIDE
219 --   and UPDATE_CHANGE_INSERT only. The execution required is as
220 --   follows:
221 --
222 --   1) Providing the datetrack update mode is not 'CORRECTION'
223 --      then set the effective end date of the current row (this
224 --      will be the validation_start_date - 1).
225 --   2) If the datetrack mode is 'UPDATE_OVERRIDE' then call the
226 --      corresponding delete_dml process to delete any future rows
227 --      where the effective_start_date is greater than or equal to
228 --      the validation_start_date.
229 --   3) Call the insert_dml process to insert the new updated row
230 --      details.
231 --
232 -- Prerequisites:
233 --   This is an internal procedure which is called from the
234 --   pre_update procedure.
235 --
236 -- In Parameters:
237 --
238 -- Post Success:
239 --   Processing continues.
240 --
241 -- Post Failure:
242 --   If an error has occurred, an error message and exception will be raised
243 --   but not handled.
244 --
245 -- Developer Implementation Notes:
246 --   This is an internal procedure which is required by Datetrack. Don't
247 --   remove or modify.
248 --
249 -- Access Status:
250 --   Internal Row Handler Use Only.
251 --
252 -- {End Of Comments}
253 -- ----------------------------------------------------------------------------
254 Procedure dt_pre_update
255   (p_rec                     in out nocopy     ben_jrt_shd.g_rec_type
256   ,p_effective_date          in date
257   ,p_datetrack_mode          in varchar2
258   ,p_validation_start_date   in date
259   ,p_validation_end_date     in date
260   ) is
261 --
262   l_proc                 varchar2(72) := g_package||'dt_pre_update';
263   l_dummy_version_number number;
264 --
265 Begin
266   hr_utility.set_location('Entering:'||l_proc, 5);
267   If (p_datetrack_mode <> hr_api.g_correction) then
268     --
269     -- Update the current effective end date
270     --
271     ben_jrt_shd.upd_effective_end_date
272       (p_effective_date         => p_effective_date
273       ,p_base_key_value         => p_rec.job_rt_id
274       ,p_new_effective_end_date => (p_validation_start_date - 1)
275       ,p_validation_start_date  => p_validation_start_date
276       ,p_validation_end_date    => p_validation_end_date
277       ,p_object_version_number  => l_dummy_version_number
278       );
279     --
280     If (p_datetrack_mode = hr_api.g_update_override) then
281       --
282       -- As the datetrack mode is 'UPDATE_OVERRIDE' then we must
283       -- delete any future rows
284       --
285       ben_jrt_del.delete_dml
286         (p_rec                   => p_rec
287         ,p_effective_date        => p_effective_date
288         ,p_datetrack_mode        => p_datetrack_mode
289         ,p_validation_start_date => p_validation_start_date
290         ,p_validation_end_date   => p_validation_end_date
291         );
292     End If;
293     --
294     -- We must now insert the updated row
295     --
296     ben_jrt_ins.insert_dml
297       (p_rec                    => p_rec
298       ,p_effective_date         => p_effective_date
299       ,p_datetrack_mode         => p_datetrack_mode
300       ,p_validation_start_date  => p_validation_start_date
301       ,p_validation_end_date    => p_validation_end_date
302       );
303   End If;
304   hr_utility.set_location(' Leaving:'||l_proc, 20);
305 End dt_pre_update;
306 --
307 -- ----------------------------------------------------------------------------
308 -- |------------------------------< pre_update >------------------------------|
309 -- ----------------------------------------------------------------------------
310 -- {Start Of Comments}
311 --
312 -- Description:
313 --   This private procedure contains any processing which is required before
314 --   the update dml.
315 --
316 -- Prerequisites:
317 --   This is an internal procedure which is called from the upd procedure.
318 --
319 -- In Parameters:
320 --   A Pl/Sql record structure.
321 --
322 -- Post Success:
323 --   Processing continues.
324 --
325 -- Post Failure:
326 --   If an error has occurred, an error message and exception will be raised
327 --   but not handled.
328 -- Developer Implementation Notes:
329 --   Any pre-processing required before the update dml is issued should be
330 --   coded within this procedure. It is important to note that any 3rd party
331 --   maintenance should be reviewed before placing in this procedure. The call
332 --   to the dt_update_dml procedure should NOT be removed.
333 --
334 -- Access Status:
335 --   Internal Row Handler Use Only.
336 --
337 -- {End Of Comments}
338 -- ----------------------------------------------------------------------------
339 Procedure pre_update
340   (p_rec                   in out nocopy ben_jrt_shd.g_rec_type
341   ,p_effective_date        in date
342   ,p_datetrack_mode        in varchar2
343   ,p_validation_start_date in date
344   ,p_validation_end_date   in date
345   ) is
346 --
347   l_proc        varchar2(72) := g_package||'pre_update';
348 --
349 Begin
350   hr_utility.set_location('Entering:'||l_proc, 5);
351   --
352   --
353   --
354   dt_pre_update
355     (p_rec                   => p_rec
356     ,p_effective_date        => p_effective_date
357     ,p_datetrack_mode        => p_datetrack_mode
358     ,p_validation_start_date => p_validation_start_date
359     ,p_validation_end_date   => p_validation_end_date
360     );
361   --
362   hr_utility.set_location(' Leaving:'||l_proc, 10);
363 End pre_update;
364 --
365 -- ----------------------------------------------------------------------------
366 -- |----------------------------< post_update >-------------------------------|
367 -- ----------------------------------------------------------------------------
368 -- {Start Of Comments}
369 --
370 -- Description:
371 --   This private procedure contains any processing which is required after
372 --   the update dml.
373 --
374 -- Prerequisites:
375 --   This is an internal procedure which is called from the upd procedure.
376 --
377 -- In Parameters:
378 --   A Pl/Sql record structure.
379 --
380 -- Post Success:
381 --   Processing continues.
382 --
383 -- Post Failure:
384 --   If an error has occurred, an error message and exception will be raised
385 --   but not handled.
386 --
387 -- Developer Implementation Notes:
388 --   Any post-processing required after the update dml is issued should be
389 --   coded within this procedure. It is important to note that any 3rd party
390 --   maintenance should be reviewed before placing in this procedure.
391 --
392 -- Access Status:
393 --   Internal Row Handler Use Only.
394 --
395 -- {End Of Comments}
396 -- ----------------------------------------------------------------------------
397 Procedure post_update
398   (p_rec                   in ben_jrt_shd.g_rec_type
399   ,p_effective_date        in date
400   ,p_datetrack_mode        in varchar2
401   ,p_validation_start_date in date
402   ,p_validation_end_date   in date
403   ) is
404 --
405   l_proc        varchar2(72) := g_package||'post_update';
406 --
407 Begin
408   hr_utility.set_location('Entering:'||l_proc, 5);
409   begin
410     --
411     ben_jrt_rku.after_update
412       (p_effective_date
413       => p_effective_date
414       ,p_datetrack_mode
415       => p_datetrack_mode
416       ,p_validation_start_date
417       => p_validation_start_date
418       ,p_validation_end_date
419       => p_validation_end_date
420       ,p_job_rt_id
421       => p_rec.job_rt_id
422       ,p_effective_start_date
423       => p_rec.effective_start_date
424       ,p_effective_end_date
425       => p_rec.effective_end_date
426       ,p_job_id
427       => p_rec.job_id
428       ,p_excld_flag
429       => p_rec.excld_flag
430       ,p_business_group_id
431       => p_rec.business_group_id
432       ,p_vrbl_rt_prfl_id
433       => p_rec.vrbl_rt_prfl_id
434       ,p_object_version_number
435       => p_rec.object_version_number
436       ,p_ordr_num
437       => p_rec.ordr_num
438       ,p_jrt_attribute_category
439       => p_rec.jrt_attribute_category
440       ,p_jrt_attribute1
441       => p_rec.jrt_attribute1
442       ,p_jrt_attribute2
443       => p_rec.jrt_attribute2
444       ,p_jrt_attribute3
445       => p_rec.jrt_attribute3
446       ,p_jrt_attribute4
447       => p_rec.jrt_attribute4
448       ,p_jrt_attribute5
449       => p_rec.jrt_attribute5
450       ,p_jrt_attribute6
451       => p_rec.jrt_attribute6
452       ,p_jrt_attribute7
453       => p_rec.jrt_attribute7
454       ,p_jrt_attribute8
455       => p_rec.jrt_attribute8
456       ,p_jrt_attribute9
457       => p_rec.jrt_attribute9
458       ,p_jrt_attribute10
459       => p_rec.jrt_attribute10
460       ,p_jrt_attribute11
461       => p_rec.jrt_attribute11
462       ,p_jrt_attribute12
463       => p_rec.jrt_attribute12
464       ,p_jrt_attribute13
465       => p_rec.jrt_attribute13
466       ,p_jrt_attribute14
467       => p_rec.jrt_attribute14
468       ,p_jrt_attribute15
469       => p_rec.jrt_attribute15
470       ,p_jrt_attribute16
471       => p_rec.jrt_attribute16
472       ,p_jrt_attribute17
473       => p_rec.jrt_attribute17
474       ,p_jrt_attribute18
475       => p_rec.jrt_attribute18
476       ,p_jrt_attribute19
477       => p_rec.jrt_attribute19
478       ,p_jrt_attribute20
479       => p_rec.jrt_attribute20
480       ,p_jrt_attribute21
481       => p_rec.jrt_attribute21
482       ,p_jrt_attribute22
483       => p_rec.jrt_attribute22
484       ,p_jrt_attribute23
485       => p_rec.jrt_attribute23
486       ,p_jrt_attribute24
487       => p_rec.jrt_attribute24
488       ,p_jrt_attribute25
489       => p_rec.jrt_attribute25
490       ,p_jrt_attribute26
491       => p_rec.jrt_attribute26
492       ,p_jrt_attribute27
493       => p_rec.jrt_attribute27
494       ,p_jrt_attribute28
495       => p_rec.jrt_attribute28
496       ,p_jrt_attribute29
497       => p_rec.jrt_attribute29
498       ,p_jrt_attribute30
499       => p_rec.jrt_attribute30
500       ,p_effective_start_date_o
501       => ben_jrt_shd.g_old_rec.effective_start_date
502       ,p_effective_end_date_o
503       => ben_jrt_shd.g_old_rec.effective_end_date
504       ,p_job_id_o
505       => ben_jrt_shd.g_old_rec.job_id
506       ,p_excld_flag_o
507       => ben_jrt_shd.g_old_rec.excld_flag
508       ,p_business_group_id_o
509       => ben_jrt_shd.g_old_rec.business_group_id
510       ,p_vrbl_rt_prfl_id_o
511       => ben_jrt_shd.g_old_rec.vrbl_rt_prfl_id
512       ,p_object_version_number_o
513       => ben_jrt_shd.g_old_rec.object_version_number
514       ,p_ordr_num_o
515       => ben_jrt_shd.g_old_rec.ordr_num
516       ,p_jrt_attribute_category_o
517       => ben_jrt_shd.g_old_rec.jrt_attribute_category
518       ,p_jrt_attribute1_o
519       => ben_jrt_shd.g_old_rec.jrt_attribute1
520       ,p_jrt_attribute2_o
521       => ben_jrt_shd.g_old_rec.jrt_attribute2
522       ,p_jrt_attribute3_o
523       => ben_jrt_shd.g_old_rec.jrt_attribute3
524       ,p_jrt_attribute4_o
525       => ben_jrt_shd.g_old_rec.jrt_attribute4
526       ,p_jrt_attribute5_o
527       => ben_jrt_shd.g_old_rec.jrt_attribute5
528       ,p_jrt_attribute6_o
529       => ben_jrt_shd.g_old_rec.jrt_attribute6
530       ,p_jrt_attribute7_o
531       => ben_jrt_shd.g_old_rec.jrt_attribute7
532       ,p_jrt_attribute8_o
533       => ben_jrt_shd.g_old_rec.jrt_attribute8
534       ,p_jrt_attribute9_o
535       => ben_jrt_shd.g_old_rec.jrt_attribute9
536       ,p_jrt_attribute10_o
537       => ben_jrt_shd.g_old_rec.jrt_attribute10
538       ,p_jrt_attribute11_o
539       => ben_jrt_shd.g_old_rec.jrt_attribute11
540       ,p_jrt_attribute12_o
541       => ben_jrt_shd.g_old_rec.jrt_attribute12
542       ,p_jrt_attribute13_o
543       => ben_jrt_shd.g_old_rec.jrt_attribute13
544       ,p_jrt_attribute14_o
545       => ben_jrt_shd.g_old_rec.jrt_attribute14
546       ,p_jrt_attribute15_o
547       => ben_jrt_shd.g_old_rec.jrt_attribute15
548       ,p_jrt_attribute16_o
549       => ben_jrt_shd.g_old_rec.jrt_attribute16
550       ,p_jrt_attribute17_o
551       => ben_jrt_shd.g_old_rec.jrt_attribute17
552       ,p_jrt_attribute18_o
553       => ben_jrt_shd.g_old_rec.jrt_attribute18
554       ,p_jrt_attribute19_o
555       => ben_jrt_shd.g_old_rec.jrt_attribute19
556       ,p_jrt_attribute20_o
557       => ben_jrt_shd.g_old_rec.jrt_attribute20
558       ,p_jrt_attribute21_o
559       => ben_jrt_shd.g_old_rec.jrt_attribute21
560       ,p_jrt_attribute22_o
561       => ben_jrt_shd.g_old_rec.jrt_attribute22
562       ,p_jrt_attribute23_o
563       => ben_jrt_shd.g_old_rec.jrt_attribute23
564       ,p_jrt_attribute24_o
565       => ben_jrt_shd.g_old_rec.jrt_attribute24
566       ,p_jrt_attribute25_o
567       => ben_jrt_shd.g_old_rec.jrt_attribute25
568       ,p_jrt_attribute26_o
569       => ben_jrt_shd.g_old_rec.jrt_attribute26
570       ,p_jrt_attribute27_o
571       => ben_jrt_shd.g_old_rec.jrt_attribute27
572       ,p_jrt_attribute28_o
573       => ben_jrt_shd.g_old_rec.jrt_attribute28
574       ,p_jrt_attribute29_o
575       => ben_jrt_shd.g_old_rec.jrt_attribute29
576       ,p_jrt_attribute30_o
577       => ben_jrt_shd.g_old_rec.jrt_attribute30
578       );
579     --
580   exception
581     --
582     when hr_api.cannot_find_prog_unit then
583       --
584       hr_api.cannot_find_prog_unit_error
585         (p_module_name => 'BEN_JOB_RT_F'
586         ,p_hook_type   => 'AU');
587       --
588   end;
589   --
590   hr_utility.set_location(' Leaving:'||l_proc, 10);
591 End post_update;
592 --
593 -- ----------------------------------------------------------------------------
594 -- |-----------------------------< convert_defs >-----------------------------|
595 -- ----------------------------------------------------------------------------
596 -- {Start Of Comments}
597 --
598 -- Description:
599 --   The Convert_Defs procedure has one very important function:
600 --   It must return the record structure for the row with all system defaulted
601 --   values converted into its corresponding parameter value for update. When
602 --   we attempt to update a row through the Upd process , certain
603 --   parameters can be defaulted which enables flexibility in the calling of
604 --   the upd process (e.g. only attributes which need to be updated need to be
605 --   specified). For the upd process to determine which attributes
606 --   have NOT been specified we need to check if the parameter has a reserved
607 --   system default value. Therefore, for all parameters which have a
608 --   corresponding reserved system default mechanism specified we need to
609 --   check if a system default is being used. If a system default is being
610 --   used then we convert the defaulted value into its corresponding attribute
611 --   value held in the g_old_rec data structure.
612 --
613 -- Prerequisites:
614 --   This private function can only be called from the upd process.
615 --
616 -- In Parameters:
617 --   A Pl/Sql record structure.
618 --
619 -- Post Success:
620 --   The record structure will be returned with all system defaulted parameter
621 --   values converted into its current row attribute value.
622 --
623 -- Post Failure:
624 --   No direct error handling is required within this function. Any possible
625 --   errors within this procedure will be a PL/SQL value error due to
626 --   conversion of datatypes or data lengths.
627 --
628 -- Developer Implementation Notes:
629 --   None.
630 --
631 -- Access Status:
632 --   Internal Row Handler Use Only.
633 --
634 -- {End Of Comments}
635 -- ----------------------------------------------------------------------------
636 Procedure convert_defs
637   (p_rec in out nocopy ben_jrt_shd.g_rec_type
638   ) is
639 --
640 Begin
641   --
642   -- We must now examine each argument value in the
643   -- p_rec plsql record structure
644   -- to see if a system default is being used. If a system default
645   -- is being used then we must set to the 'current' argument value.
646   --
647   If (p_rec.job_id = hr_api.g_number) then
648     p_rec.job_id :=
649     ben_jrt_shd.g_old_rec.job_id;
650   End If;
651   If (p_rec.excld_flag = hr_api.g_varchar2) then
652     p_rec.excld_flag :=
653     ben_jrt_shd.g_old_rec.excld_flag;
654   End If;
655   If (p_rec.business_group_id = hr_api.g_number) then
656     p_rec.business_group_id :=
657     ben_jrt_shd.g_old_rec.business_group_id;
658   End If;
659   If (p_rec.vrbl_rt_prfl_id = hr_api.g_number) then
660     p_rec.vrbl_rt_prfl_id :=
661     ben_jrt_shd.g_old_rec.vrbl_rt_prfl_id;
662   End If;
663   If (p_rec.ordr_num = hr_api.g_number) then
664     p_rec.ordr_num :=
665     ben_jrt_shd.g_old_rec.ordr_num;
666   End If;
667   If (p_rec.jrt_attribute_category = hr_api.g_varchar2) then
668     p_rec.jrt_attribute_category :=
669     ben_jrt_shd.g_old_rec.jrt_attribute_category;
670   End If;
671   If (p_rec.jrt_attribute1 = hr_api.g_varchar2) then
672     p_rec.jrt_attribute1 :=
673     ben_jrt_shd.g_old_rec.jrt_attribute1;
674   End If;
675   If (p_rec.jrt_attribute2 = hr_api.g_varchar2) then
676     p_rec.jrt_attribute2 :=
677     ben_jrt_shd.g_old_rec.jrt_attribute2;
678   End If;
679   If (p_rec.jrt_attribute3 = hr_api.g_varchar2) then
680     p_rec.jrt_attribute3 :=
681     ben_jrt_shd.g_old_rec.jrt_attribute3;
682   End If;
683   If (p_rec.jrt_attribute4 = hr_api.g_varchar2) then
684     p_rec.jrt_attribute4 :=
685     ben_jrt_shd.g_old_rec.jrt_attribute4;
686   End If;
687   If (p_rec.jrt_attribute5 = hr_api.g_varchar2) then
688     p_rec.jrt_attribute5 :=
689     ben_jrt_shd.g_old_rec.jrt_attribute5;
690   End If;
691   If (p_rec.jrt_attribute6 = hr_api.g_varchar2) then
692     p_rec.jrt_attribute6 :=
693     ben_jrt_shd.g_old_rec.jrt_attribute6;
694   End If;
695   If (p_rec.jrt_attribute7 = hr_api.g_varchar2) then
696     p_rec.jrt_attribute7 :=
697     ben_jrt_shd.g_old_rec.jrt_attribute7;
698   End If;
699   If (p_rec.jrt_attribute8 = hr_api.g_varchar2) then
700     p_rec.jrt_attribute8 :=
701     ben_jrt_shd.g_old_rec.jrt_attribute8;
702   End If;
703   If (p_rec.jrt_attribute9 = hr_api.g_varchar2) then
704     p_rec.jrt_attribute9 :=
705     ben_jrt_shd.g_old_rec.jrt_attribute9;
706   End If;
707   If (p_rec.jrt_attribute10 = hr_api.g_varchar2) then
708     p_rec.jrt_attribute10 :=
709     ben_jrt_shd.g_old_rec.jrt_attribute10;
710   End If;
711   If (p_rec.jrt_attribute11 = hr_api.g_varchar2) then
712     p_rec.jrt_attribute11 :=
713     ben_jrt_shd.g_old_rec.jrt_attribute11;
714   End If;
715   If (p_rec.jrt_attribute12 = hr_api.g_varchar2) then
716     p_rec.jrt_attribute12 :=
717     ben_jrt_shd.g_old_rec.jrt_attribute12;
718   End If;
719   If (p_rec.jrt_attribute13 = hr_api.g_varchar2) then
720     p_rec.jrt_attribute13 :=
721     ben_jrt_shd.g_old_rec.jrt_attribute13;
722   End If;
723   If (p_rec.jrt_attribute14 = hr_api.g_varchar2) then
724     p_rec.jrt_attribute14 :=
725     ben_jrt_shd.g_old_rec.jrt_attribute14;
726   End If;
727   If (p_rec.jrt_attribute15 = hr_api.g_varchar2) then
728     p_rec.jrt_attribute15 :=
729     ben_jrt_shd.g_old_rec.jrt_attribute15;
730   End If;
731   If (p_rec.jrt_attribute16 = hr_api.g_varchar2) then
732     p_rec.jrt_attribute16 :=
733     ben_jrt_shd.g_old_rec.jrt_attribute16;
734   End If;
735   If (p_rec.jrt_attribute17 = hr_api.g_varchar2) then
736     p_rec.jrt_attribute17 :=
737     ben_jrt_shd.g_old_rec.jrt_attribute17;
738   End If;
739   If (p_rec.jrt_attribute18 = hr_api.g_varchar2) then
740     p_rec.jrt_attribute18 :=
741     ben_jrt_shd.g_old_rec.jrt_attribute18;
742   End If;
743   If (p_rec.jrt_attribute19 = hr_api.g_varchar2) then
744     p_rec.jrt_attribute19 :=
745     ben_jrt_shd.g_old_rec.jrt_attribute19;
746   End If;
747   If (p_rec.jrt_attribute20 = hr_api.g_varchar2) then
748     p_rec.jrt_attribute20 :=
749     ben_jrt_shd.g_old_rec.jrt_attribute20;
750   End If;
751   If (p_rec.jrt_attribute21 = hr_api.g_varchar2) then
752     p_rec.jrt_attribute21 :=
753     ben_jrt_shd.g_old_rec.jrt_attribute21;
754   End If;
755   If (p_rec.jrt_attribute22 = hr_api.g_varchar2) then
756     p_rec.jrt_attribute22 :=
757     ben_jrt_shd.g_old_rec.jrt_attribute22;
758   End If;
759   If (p_rec.jrt_attribute23 = hr_api.g_varchar2) then
760     p_rec.jrt_attribute23 :=
761     ben_jrt_shd.g_old_rec.jrt_attribute23;
762   End If;
763   If (p_rec.jrt_attribute24 = hr_api.g_varchar2) then
764     p_rec.jrt_attribute24 :=
765     ben_jrt_shd.g_old_rec.jrt_attribute24;
766   End If;
767   If (p_rec.jrt_attribute25 = hr_api.g_varchar2) then
768     p_rec.jrt_attribute25 :=
769     ben_jrt_shd.g_old_rec.jrt_attribute25;
770   End If;
771   If (p_rec.jrt_attribute26 = hr_api.g_varchar2) then
772     p_rec.jrt_attribute26 :=
773     ben_jrt_shd.g_old_rec.jrt_attribute26;
774   End If;
775   If (p_rec.jrt_attribute27 = hr_api.g_varchar2) then
776     p_rec.jrt_attribute27 :=
777     ben_jrt_shd.g_old_rec.jrt_attribute27;
778   End If;
779   If (p_rec.jrt_attribute28 = hr_api.g_varchar2) then
780     p_rec.jrt_attribute28 :=
781     ben_jrt_shd.g_old_rec.jrt_attribute28;
782   End If;
783   If (p_rec.jrt_attribute29 = hr_api.g_varchar2) then
784     p_rec.jrt_attribute29 :=
785     ben_jrt_shd.g_old_rec.jrt_attribute29;
786   End If;
787   If (p_rec.jrt_attribute30 = hr_api.g_varchar2) then
788     p_rec.jrt_attribute30 :=
789     ben_jrt_shd.g_old_rec.jrt_attribute30;
790   End If;
791   --
792 End convert_defs;
793 --
794 -- ----------------------------------------------------------------------------
795 -- |---------------------------------< upd >----------------------------------|
796 -- ----------------------------------------------------------------------------
797 Procedure upd
798   (p_effective_date in     date
799   ,p_datetrack_mode in     varchar2
800   ,p_rec            in out nocopy ben_jrt_shd.g_rec_type
801   ) is
802 --
803   l_proc                        varchar2(72) := g_package||'upd';
804   l_validation_start_date       date;
805   l_validation_end_date         date;
806 --
807 Begin
808   hr_utility.set_location('Entering:'||l_proc, 5);
809   --
810   -- Ensure that the DateTrack update mode is valid
811   --
812   dt_api.validate_dt_upd_mode(p_datetrack_mode => p_datetrack_mode);
813   --
814   -- We must lock the row which we need to update.
815   --
816   ben_jrt_shd.lck
817     (p_effective_date                   => p_effective_date
818     ,p_datetrack_mode                   => p_datetrack_mode
819     ,p_job_rt_id                        => p_rec.job_rt_id
820     ,p_object_version_number            => p_rec.object_version_number
821     ,p_validation_start_date            => l_validation_start_date
822     ,p_validation_end_date              => l_validation_end_date
823     );
824   --
825   -- 1. During an update system defaults are used to determine if
826   --    arguments have been defaulted or not. We must therefore
827   --    derive the full record structure values to be updated.
828   --
829   -- 2. Call the supporting update validate operations.
830   --
831   ben_jrt_upd.convert_defs(p_rec);
832   --
833   ben_jrt_bus.update_validate
834     (p_rec                              => p_rec
835     ,p_effective_date                   => p_effective_date
836     ,p_datetrack_mode                   => p_datetrack_mode
837     ,p_validation_start_date            => l_validation_start_date
838     ,p_validation_end_date              => l_validation_end_date
839     );
840   --
841   -- Call to raise any errors on multi-message list
842   hr_multi_message.end_validation_set;
843   --
844   -- Call the supporting pre-update operation
845   --
846   pre_update
847     (p_rec                              => p_rec
848     ,p_effective_date                   => p_effective_date
849     ,p_datetrack_mode                   => p_datetrack_mode
850     ,p_validation_start_date            => l_validation_start_date
851     ,p_validation_end_date              => l_validation_end_date
852     );
853   --
854   -- Update the row.
855   --
856   update_dml
857     (p_rec                              => p_rec
858     ,p_effective_date                   => p_effective_date
859     ,p_datetrack_mode                   => p_datetrack_mode
860     ,p_validation_start_date            => l_validation_start_date
861     ,p_validation_end_date                  => l_validation_end_date
862     );
863   --
864   -- Call the supporting post-update operation
865   --
866   post_update
867     (p_rec                              => p_rec
868     ,p_effective_date                   => p_effective_date
869     ,p_datetrack_mode                   => p_datetrack_mode
870     ,p_validation_start_date            => l_validation_start_date
871     ,p_validation_end_date              => l_validation_end_date
872     );
873   --
874   -- Call to raise any errors on multi-message list
875   hr_multi_message.end_validation_set;
876 End upd;
877 --
878 -- ----------------------------------------------------------------------------
879 -- |------------------------------< upd >-------------------------------------|
880 -- ----------------------------------------------------------------------------
881 Procedure upd
882   (p_effective_date               in     date
883   ,p_datetrack_mode               in     varchar2
884   ,p_job_rt_id                    in     number
885   ,p_object_version_number        in out nocopy number
886   ,p_job_id                       in     number    default hr_api.g_number
887   ,p_excld_flag                   in     varchar2  default hr_api.g_varchar2
888   ,p_business_group_id            in     number    default hr_api.g_number
889   ,p_vrbl_rt_prfl_id              in     number    default hr_api.g_number
890   ,p_ordr_num                     in     number    default hr_api.g_number
891   ,p_jrt_attribute_category       in     varchar2  default hr_api.g_varchar2
892   ,p_jrt_attribute1               in     varchar2  default hr_api.g_varchar2
893   ,p_jrt_attribute2               in     varchar2  default hr_api.g_varchar2
894   ,p_jrt_attribute3               in     varchar2  default hr_api.g_varchar2
895   ,p_jrt_attribute4               in     varchar2  default hr_api.g_varchar2
896   ,p_jrt_attribute5               in     varchar2  default hr_api.g_varchar2
897   ,p_jrt_attribute6               in     varchar2  default hr_api.g_varchar2
898   ,p_jrt_attribute7               in     varchar2  default hr_api.g_varchar2
899   ,p_jrt_attribute8               in     varchar2  default hr_api.g_varchar2
900   ,p_jrt_attribute9               in     varchar2  default hr_api.g_varchar2
901   ,p_jrt_attribute10              in     varchar2  default hr_api.g_varchar2
902   ,p_jrt_attribute11              in     varchar2  default hr_api.g_varchar2
903   ,p_jrt_attribute12              in     varchar2  default hr_api.g_varchar2
904   ,p_jrt_attribute13              in     varchar2  default hr_api.g_varchar2
905   ,p_jrt_attribute14              in     varchar2  default hr_api.g_varchar2
906   ,p_jrt_attribute15              in     varchar2  default hr_api.g_varchar2
907   ,p_jrt_attribute16              in     varchar2  default hr_api.g_varchar2
908   ,p_jrt_attribute17              in     varchar2  default hr_api.g_varchar2
909   ,p_jrt_attribute18              in     varchar2  default hr_api.g_varchar2
910   ,p_jrt_attribute19              in     varchar2  default hr_api.g_varchar2
911   ,p_jrt_attribute20              in     varchar2  default hr_api.g_varchar2
912   ,p_jrt_attribute21              in     varchar2  default hr_api.g_varchar2
913   ,p_jrt_attribute22              in     varchar2  default hr_api.g_varchar2
914   ,p_jrt_attribute23              in     varchar2  default hr_api.g_varchar2
915   ,p_jrt_attribute24              in     varchar2  default hr_api.g_varchar2
916   ,p_jrt_attribute25              in     varchar2  default hr_api.g_varchar2
917   ,p_jrt_attribute26              in     varchar2  default hr_api.g_varchar2
918   ,p_jrt_attribute27              in     varchar2  default hr_api.g_varchar2
919   ,p_jrt_attribute28              in     varchar2  default hr_api.g_varchar2
920   ,p_jrt_attribute29              in     varchar2  default hr_api.g_varchar2
921   ,p_jrt_attribute30              in     varchar2  default hr_api.g_varchar2
922   ,p_effective_start_date            out nocopy date
923   ,p_effective_end_date              out nocopy date
924   ) is
925 --
926   l_rec         ben_jrt_shd.g_rec_type;
927   l_proc        varchar2(72) := g_package||'upd';
928 --
929 Begin
930   hr_utility.set_location('Entering:'||l_proc, 5);
931   --
932   -- Call conversion function to turn arguments into the
933   -- l_rec structure.
934   --
935   l_rec :=
936   ben_jrt_shd.convert_args
937     (p_job_rt_id
938     ,null
939     ,null
940     ,p_job_id
941     ,p_excld_flag
942     ,p_business_group_id
943     ,p_vrbl_rt_prfl_id
944     ,p_object_version_number
945     ,p_ordr_num
946     ,p_jrt_attribute_category
947     ,p_jrt_attribute1
948     ,p_jrt_attribute2
949     ,p_jrt_attribute3
950     ,p_jrt_attribute4
951     ,p_jrt_attribute5
952     ,p_jrt_attribute6
953     ,p_jrt_attribute7
954     ,p_jrt_attribute8
955     ,p_jrt_attribute9
956     ,p_jrt_attribute10
957     ,p_jrt_attribute11
958     ,p_jrt_attribute12
959     ,p_jrt_attribute13
960     ,p_jrt_attribute14
961     ,p_jrt_attribute15
962     ,p_jrt_attribute16
963     ,p_jrt_attribute17
964     ,p_jrt_attribute18
965     ,p_jrt_attribute19
966     ,p_jrt_attribute20
967     ,p_jrt_attribute21
968     ,p_jrt_attribute22
969     ,p_jrt_attribute23
970     ,p_jrt_attribute24
971     ,p_jrt_attribute25
972     ,p_jrt_attribute26
973     ,p_jrt_attribute27
974     ,p_jrt_attribute28
975     ,p_jrt_attribute29
976     ,p_jrt_attribute30
977     );
978   --
979   -- Having converted the arguments into the
980   -- plsql record structure we call the corresponding record
981   -- business process.
982   --
983   ben_jrt_upd.upd
984     (p_effective_date
985     ,p_datetrack_mode
986     ,l_rec
987     );
988   --
989   -- Set the out parameters
990   --
991   p_object_version_number            := l_rec.object_version_number;
992   p_effective_start_date             := l_rec.effective_start_date;
993   p_effective_end_date               := l_rec.effective_end_date;
994   --
995   --
996   hr_utility.set_location(' Leaving:'||l_proc, 10);
997 End upd;
998 --
999 end ben_jrt_upd;