DBA Data[Home] [Help]

PACKAGE BODY: APPS.BEN_CPO_UPD

Source


1 Package Body ben_cpo_upd as
2 /* $Header: becporhi.pkb 115.11 2002/12/13 06:20:48 hmani ship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33)	:= '  ben_cpo_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_cpo_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_org_f',
78 	   p_base_key_column	=> 'popl_org_id',
79 	   p_base_key_value	=> p_rec.popl_org_id);
80     --
81     ben_cpo_shd.g_api_dml := true;  -- Set the api dml status
82     --
83     -- Update the ben_popl_org_f Row
84     --
85     update  ben_popl_org_f
86     set
87         popl_org_id                     = p_rec.popl_org_id,
88     business_group_id               = p_rec.business_group_id,
89     cstmr_num                       = p_rec.cstmr_num,
90     plcy_r_grp                      = p_rec.plcy_r_grp,
91     pgm_id                          = p_rec.pgm_id,
92     pl_id                           = p_rec.pl_id,
93     organization_id                 = p_rec.organization_id,
94     person_id                       = p_rec.person_id,
95     cpo_attribute_category          = p_rec.cpo_attribute_category,
96     cpo_attribute1                  = p_rec.cpo_attribute1,
97     cpo_attribute2                  = p_rec.cpo_attribute2,
98     cpo_attribute3                  = p_rec.cpo_attribute3,
99     cpo_attribute4                  = p_rec.cpo_attribute4,
100     cpo_attribute5                  = p_rec.cpo_attribute5,
101     cpo_attribute6                  = p_rec.cpo_attribute6,
102     cpo_attribute7                  = p_rec.cpo_attribute7,
103     cpo_attribute8                  = p_rec.cpo_attribute8,
104     cpo_attribute9                  = p_rec.cpo_attribute9,
105     cpo_attribute10                 = p_rec.cpo_attribute10,
106     cpo_attribute11                 = p_rec.cpo_attribute11,
107     cpo_attribute12                 = p_rec.cpo_attribute12,
108     cpo_attribute13                 = p_rec.cpo_attribute13,
109     cpo_attribute14                 = p_rec.cpo_attribute14,
110     cpo_attribute15                 = p_rec.cpo_attribute15,
111     cpo_attribute16                 = p_rec.cpo_attribute16,
112     cpo_attribute17                 = p_rec.cpo_attribute17,
113     cpo_attribute18                 = p_rec.cpo_attribute18,
114     cpo_attribute19                 = p_rec.cpo_attribute19,
115     cpo_attribute20                 = p_rec.cpo_attribute20,
116     cpo_attribute21                 = p_rec.cpo_attribute21,
117     cpo_attribute22                 = p_rec.cpo_attribute22,
118     cpo_attribute23                 = p_rec.cpo_attribute23,
119     cpo_attribute24                 = p_rec.cpo_attribute24,
120     cpo_attribute25                 = p_rec.cpo_attribute25,
121     cpo_attribute26                 = p_rec.cpo_attribute26,
122     cpo_attribute27                 = p_rec.cpo_attribute27,
123     cpo_attribute28                 = p_rec.cpo_attribute28,
124     cpo_attribute29                 = p_rec.cpo_attribute29,
125     cpo_attribute30                 = p_rec.cpo_attribute30,
126     object_version_number           = p_rec.object_version_number
127     where   popl_org_id = p_rec.popl_org_id
128     and     effective_start_date = p_validation_start_date
129     and     effective_end_date   = p_validation_end_date;
130     --
131     ben_cpo_shd.g_api_dml := false;   -- Unset the api dml status
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     ben_cpo_shd.g_api_dml := false;   -- Unset the api dml status
144     ben_cpo_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     ben_cpo_shd.g_api_dml := false;   -- Unset the api dml status
149     ben_cpo_shd.constraint_error
150       (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
151   When Others Then
152     ben_cpo_shd.g_api_dml := false;   -- Unset the api dml status
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_cpo_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) is
193 --
194   l_proc	varchar2(72) := g_package||'update_dml';
195 --
196 Begin
197   hr_utility.set_location('Entering:'||l_proc, 5);
198   --
199   dt_update_dml(p_rec			=> p_rec,
200 		p_effective_date	=> p_effective_date,
201 		p_datetrack_mode	=> p_datetrack_mode,
202        		p_validation_start_date	=> p_validation_start_date,
203 		p_validation_end_date	=> p_validation_end_date);
204   --
205   hr_utility.set_location(' Leaving:'||l_proc, 10);
206 End update_dml;
207 --
208 -- ----------------------------------------------------------------------------
209 -- |----------------------------< dt_pre_update >-----------------------------|
210 -- ----------------------------------------------------------------------------
211 -- {Start Of Comments}
212 --
213 -- Description:
214 --   The dt_pre_update procedure controls the execution
215 --   of dml for the datetrack modes of: UPDATE, UPDATE_OVERRIDE
216 --   and UPDATE_CHANGE_INSERT only. The execution required is as
217 --   follows:
218 --
219 --   1) Providing the datetrack update mode is not 'CORRECTION'
220 --      then set the effective end date of the current row (this
221 --      will be the validation_start_date - 1).
222 --   2) If the datetrack mode is 'UPDATE_OVERRIDE' then call the
223 --      corresponding delete_dml process to delete any future rows
224 --      where the effective_start_date is greater than or equal to
225 --	the validation_start_date.
226 --   3) Call the insert_dml process to insert the new updated row
227 --      details..
228 --
229 -- Prerequisites:
230 --   This is an internal procedure which is called from the
231 --   pre_update procedure.
232 --
233 -- In Parameters:
234 --
235 -- Post Success:
236 --   Processing continues.
237 --
238 -- Post Failure:
239 --   If an error has occurred, an error message and exception will be raised
240 --   but not handled.
241 --
242 -- Developer Implementation Notes:
243 --   This is an internal procedure which is required by Datetrack. Don't
244 --   remove or modify.
245 --
246 -- Access Status:
247 --   Internal Row Handler Use Only.
248 --
249 -- {End Of Comments}
250 -- ----------------------------------------------------------------------------
251 Procedure dt_pre_update
252 	(p_rec 			 in out nocopy ben_cpo_shd.g_rec_type,
253 	 p_effective_date	 in	date,
254 	 p_datetrack_mode	 in	varchar2,
255 	 p_validation_start_date in	date,
256 	 p_validation_end_date	 in	date) is
257 --
258   l_proc	         varchar2(72) := g_package||'dt_pre_update';
259   l_dummy_version_number number;
260 --
261 Begin
262   hr_utility.set_location('Entering:'||l_proc, 5);
263   If (p_datetrack_mode <> 'CORRECTION') then
264     hr_utility.set_location(l_proc, 10);
265     --
266     -- Update the current effective end date
267     --
268     ben_cpo_shd.upd_effective_end_date
269      (p_effective_date	       => p_effective_date,
270       p_base_key_value	       => p_rec.popl_org_id,
271       p_new_effective_end_date => (p_validation_start_date - 1),
272       p_validation_start_date  => p_validation_start_date,
273       p_validation_end_date    => p_validation_end_date,
274       p_object_version_number  => l_dummy_version_number);
275     --
276     If (p_datetrack_mode = 'UPDATE_OVERRIDE') then
277       hr_utility.set_location(l_proc, 15);
278       --
279       -- As the datetrack mode is 'UPDATE_OVERRIDE' then we must
280       -- delete any future rows
281       --
282       ben_cpo_del.delete_dml
283         (p_rec			 => p_rec,
284 	 p_effective_date	 => p_effective_date,
285 	 p_datetrack_mode	 => p_datetrack_mode,
286 	 p_validation_start_date => p_validation_start_date,
287 	 p_validation_end_date   => p_validation_end_date);
288     End If;
289     hr_utility.set_location(l_proc, 20);
290     --
291     -- We must now insert the updated row
292     --
293     ben_cpo_ins.insert_dml
294       (p_rec			=> p_rec,
295        p_effective_date		=> p_effective_date,
296        p_datetrack_mode		=> p_datetrack_mode,
297        p_validation_start_date	=> p_validation_start_date,
298        p_validation_end_date	=> p_validation_end_date);
299   End If;
300   hr_utility.set_location(' Leaving:'||l_proc, 20);
301 End dt_pre_update;
302 --
303 -- ----------------------------------------------------------------------------
304 -- |------------------------------< pre_update >------------------------------|
305 -- ----------------------------------------------------------------------------
306 -- {Start Of Comments}
307 --
308 -- Description:
309 --   This private procedure contains any processing which is required before
310 --   the update dml.
311 --
312 -- Prerequisites:
313 --   This is an internal procedure which is called from the upd procedure.
314 --
315 -- In Parameters:
316 --   A Pl/Sql record structre.
317 --
318 -- Post Success:
319 --   Processing continues.
320 --
321 -- Post Failure:
322 --   If an error has occurred, an error message and exception will be raised
323 --   but not handled.
324 --
325 -- Developer Implementation Notes:
326 --   Any pre-processing required before the update dml is issued should be
327 --   coded within this procedure. It is important to note that any 3rd party
328 --   maintenance should be reviewed before placing in this procedure. The call
329 --   to the dt_update_dml procedure should NOT be removed.
330 --
331 -- Access Status:
332 --   Internal Row Handler Use Only.
333 --
334 -- {End Of Comments}
335 -- ----------------------------------------------------------------------------
336 Procedure pre_update
337 	(p_rec 			 in out nocopy ben_cpo_shd.g_rec_type,
338 	 p_effective_date	 in	date,
339 	 p_datetrack_mode	 in	varchar2,
340 	 p_validation_start_date in	date,
341 	 p_validation_end_date	 in	date) is
342 --
343   l_proc	varchar2(72) := g_package||'pre_update';
344 --
345 Begin
346   hr_utility.set_location('Entering:'||l_proc, 5);
347   --
348   --
349   --
350   dt_pre_update
351     (p_rec 		     => p_rec,
352      p_effective_date	     => p_effective_date,
353      p_datetrack_mode	     => p_datetrack_mode,
354      p_validation_start_date => p_validation_start_date,
355      p_validation_end_date   => p_validation_end_date);
356   --
357   hr_utility.set_location(' Leaving:'||l_proc, 10);
358 End pre_update;
359 --
360 -- ----------------------------------------------------------------------------
361 -- |-----------------------------< post_update >------------------------------|
362 -- ----------------------------------------------------------------------------
363 -- {Start Of Comments}
364 --
365 -- Description:
366 --   This private procedure contains any processing which is required after the
367 --   update dml.
368 --
369 -- Prerequisites:
370 --   This is an internal procedure which is called from the upd procedure.
371 --
372 -- In Parameters:
373 --   A Pl/Sql record structre.
374 --
375 -- Post Success:
376 --   Processing continues.
377 --
378 -- Post Failure:
379 --   If an error has occurred, an error message and exception will be raised
380 --   but not handled.
381 --
382 -- Developer Implementation Notes:
383 --   Any post-processing required after the update dml is issued should be
384 --   coded within this procedure. It is important to note that any 3rd party
385 --   maintenance should be reviewed before placing in this procedure.
386 --
387 -- Access Status:
388 --   Internal Row Handler Use Only.
389 --
390 -- {End Of Comments}
391 -- ----------------------------------------------------------------------------
392 Procedure post_update
393 	(p_rec 			 in ben_cpo_shd.g_rec_type,
394 	 p_effective_date	 in date,
395 	 p_datetrack_mode	 in varchar2,
396 	 p_validation_start_date in date,
397 	 p_validation_end_date	 in date) is
398 --
399   l_proc	varchar2(72) := g_package||'post_update';
400 --
401 Begin
402   hr_utility.set_location('Entering:'||l_proc, 5);
403   --
404   --
405   -- Start of API User Hook for post_update.
406   --
407   begin
408     --
409     ben_cpo_rku.after_update
410       (
411        p_popl_org_id              => p_rec.popl_org_id
412       ,p_effective_start_date     => p_rec.effective_start_date
413       ,p_effective_end_date       => p_rec.effective_end_date
414       ,p_business_group_id        => p_rec.business_group_id
415       ,p_cstmr_num                => p_rec.cstmr_num
416       ,p_plcy_r_grp               => p_rec.plcy_r_grp
417       ,p_pgm_id                   => p_rec.pgm_id
418       ,p_pl_id                    => p_rec.pl_id
419       ,p_organization_id          => p_rec.organization_id
420       ,p_person_id                => p_rec.person_id
421       ,p_cpo_attribute_category   => p_rec.cpo_attribute_category
422       ,p_cpo_attribute1           => p_rec.cpo_attribute1
423       ,p_cpo_attribute2           => p_rec.cpo_attribute2
424       ,p_cpo_attribute3           => p_rec.cpo_attribute3
425       ,p_cpo_attribute4           => p_rec.cpo_attribute4
426       ,p_cpo_attribute5           => p_rec.cpo_attribute5
427       ,p_cpo_attribute6           => p_rec.cpo_attribute6
428       ,p_cpo_attribute7           => p_rec.cpo_attribute7
429       ,p_cpo_attribute8           => p_rec.cpo_attribute8
430       ,p_cpo_attribute9           => p_rec.cpo_attribute9
431       ,p_cpo_attribute10          => p_rec.cpo_attribute10
432       ,p_cpo_attribute11          => p_rec.cpo_attribute11
433       ,p_cpo_attribute12          => p_rec.cpo_attribute12
434       ,p_cpo_attribute13          => p_rec.cpo_attribute13
435       ,p_cpo_attribute14          => p_rec.cpo_attribute14
436       ,p_cpo_attribute15          => p_rec.cpo_attribute15
437       ,p_cpo_attribute16          => p_rec.cpo_attribute16
438       ,p_cpo_attribute17          => p_rec.cpo_attribute17
439       ,p_cpo_attribute18          => p_rec.cpo_attribute18
440       ,p_cpo_attribute19          => p_rec.cpo_attribute19
441       ,p_cpo_attribute20          => p_rec.cpo_attribute20
442       ,p_cpo_attribute21          => p_rec.cpo_attribute21
443       ,p_cpo_attribute22          => p_rec.cpo_attribute22
444       ,p_cpo_attribute23          => p_rec.cpo_attribute23
445       ,p_cpo_attribute24          => p_rec.cpo_attribute24
446       ,p_cpo_attribute25          => p_rec.cpo_attribute25
447       ,p_cpo_attribute26          => p_rec.cpo_attribute26
448       ,p_cpo_attribute27          => p_rec.cpo_attribute27
449       ,p_cpo_attribute28          => p_rec.cpo_attribute28
450       ,p_cpo_attribute29          => p_rec.cpo_attribute29
451       ,p_cpo_attribute30          => p_rec.cpo_attribute30
452       ,p_object_version_number    => p_rec.object_version_number
453       ,p_effective_date           => p_effective_date
454       ,p_datetrack_mode           => p_datetrack_mode
455       ,p_validation_start_date    => p_validation_start_date
456       ,p_validation_end_date      => p_validation_end_date
457       ,p_effective_start_date_o   => ben_cpo_shd.g_old_rec.effective_start_date
458       ,p_effective_end_date_o     => ben_cpo_shd.g_old_rec.effective_end_date
459       ,p_business_group_id_o      => ben_cpo_shd.g_old_rec.business_group_id
460       ,p_cstmr_num_o              => ben_cpo_shd.g_old_rec.cstmr_num
461       ,p_plcy_r_grp_o             => ben_cpo_shd.g_old_rec.plcy_r_grp
462       ,p_pgm_id_o                 => ben_cpo_shd.g_old_rec.pgm_id
463       ,p_pl_id_o                  => ben_cpo_shd.g_old_rec.pl_id
464       ,p_organization_id_o        => ben_cpo_shd.g_old_rec.organization_id
465       ,p_person_id_o              => ben_cpo_shd.g_old_rec.person_id
466       ,p_cpo_attribute_category_o => ben_cpo_shd.g_old_rec.cpo_attribute_category
467       ,p_cpo_attribute1_o         => ben_cpo_shd.g_old_rec.cpo_attribute1
468       ,p_cpo_attribute2_o         => ben_cpo_shd.g_old_rec.cpo_attribute2
469       ,p_cpo_attribute3_o         => ben_cpo_shd.g_old_rec.cpo_attribute3
470       ,p_cpo_attribute4_o         => ben_cpo_shd.g_old_rec.cpo_attribute4
471       ,p_cpo_attribute5_o         => ben_cpo_shd.g_old_rec.cpo_attribute5
472       ,p_cpo_attribute6_o         => ben_cpo_shd.g_old_rec.cpo_attribute6
473       ,p_cpo_attribute7_o         => ben_cpo_shd.g_old_rec.cpo_attribute7
474       ,p_cpo_attribute8_o         => ben_cpo_shd.g_old_rec.cpo_attribute8
475       ,p_cpo_attribute9_o         => ben_cpo_shd.g_old_rec.cpo_attribute9
476       ,p_cpo_attribute10_o        => ben_cpo_shd.g_old_rec.cpo_attribute10
477       ,p_cpo_attribute11_o        => ben_cpo_shd.g_old_rec.cpo_attribute11
478       ,p_cpo_attribute12_o        => ben_cpo_shd.g_old_rec.cpo_attribute12
479       ,p_cpo_attribute13_o        => ben_cpo_shd.g_old_rec.cpo_attribute13
480       ,p_cpo_attribute14_o        => ben_cpo_shd.g_old_rec.cpo_attribute14
481       ,p_cpo_attribute15_o        => ben_cpo_shd.g_old_rec.cpo_attribute15
482       ,p_cpo_attribute16_o        => ben_cpo_shd.g_old_rec.cpo_attribute16
483       ,p_cpo_attribute17_o        => ben_cpo_shd.g_old_rec.cpo_attribute17
484       ,p_cpo_attribute18_o        => ben_cpo_shd.g_old_rec.cpo_attribute18
485       ,p_cpo_attribute19_o        => ben_cpo_shd.g_old_rec.cpo_attribute19
486       ,p_cpo_attribute20_o        => ben_cpo_shd.g_old_rec.cpo_attribute20
487       ,p_cpo_attribute21_o        => ben_cpo_shd.g_old_rec.cpo_attribute21
488       ,p_cpo_attribute22_o        => ben_cpo_shd.g_old_rec.cpo_attribute22
489       ,p_cpo_attribute23_o        => ben_cpo_shd.g_old_rec.cpo_attribute23
490       ,p_cpo_attribute24_o        => ben_cpo_shd.g_old_rec.cpo_attribute24
491       ,p_cpo_attribute25_o        => ben_cpo_shd.g_old_rec.cpo_attribute25
492       ,p_cpo_attribute26_o        => ben_cpo_shd.g_old_rec.cpo_attribute26
493       ,p_cpo_attribute27_o        => ben_cpo_shd.g_old_rec.cpo_attribute27
494       ,p_cpo_attribute28_o        => ben_cpo_shd.g_old_rec.cpo_attribute28
495       ,p_cpo_attribute29_o        => ben_cpo_shd.g_old_rec.cpo_attribute29
496       ,p_cpo_attribute30_o        => ben_cpo_shd.g_old_rec.cpo_attribute30
497       ,p_object_version_number_o  => ben_cpo_shd.g_old_rec.object_version_number
498       );
499     --
500   exception
501     --
502     when hr_api.cannot_find_prog_unit then
503       --
504       hr_api.cannot_find_prog_unit_error
505         (p_module_name => 'ben_popl_org_f'
506         ,p_hook_type   => 'AU');
507       --
508   end;
509   --
510   -- End of API User Hook for post_update.
511   --
512   hr_utility.set_location(' Leaving:'||l_proc, 10);
513 End post_update;
514 --
515 -- ----------------------------------------------------------------------------
516 -- |-----------------------------< convert_defs >-----------------------------|
517 -- ----------------------------------------------------------------------------
518 -- {Start Of Comments}
519 --
520 -- Description:
521 --   The Convert_Defs procedure has one very important function:
522 --   It must return the record structure for the row with all system defaulted
523 --   values converted into its corresponding parameter value for update. When
524 --   we attempt to update a row through the Upd process , certain
525 --   parameters can be defaulted which enables flexibility in the calling of
526 --   the upd process (e.g. only attributes which need to be updated need to be
527 --   specified). For the upd process to determine which attributes
528 --   have NOT been specified we need to check if the parameter has a reserved
529 --   system default value. Therefore, for all parameters which have a
530 --   corresponding reserved system default mechanism specified we need to
531 --   check if a system default is being used. If a system default is being
532 --   used then we convert the defaulted value into its corresponding attribute
533 --   value held in the g_old_rec data structure.
534 --
535 -- Prerequisites:
536 --   This private function can only be called from the upd process.
537 --
538 -- In Parameters:
539 --   A Pl/Sql record structre.
540 --
541 -- Post Success:
542 --   The record structure will be returned with all system defaulted parameter
543 --   values converted into its current row attribute value.
544 --
545 -- Post Failure:
546 --   No direct error handling is required within this function. Any possible
547 --   errors within this procedure will be a PL/SQL value error due to conversion
548 --   of datatypes or data lengths.
549 --
550 -- Developer Implementation Notes:
551 --   None.
552 --
553 -- Access Status:
554 --   Internal Row Handler Use Only.
555 --
556 -- {End Of Comments}
557 -- ----------------------------------------------------------------------------
558 Procedure convert_defs(p_rec in out nocopy ben_cpo_shd.g_rec_type) is
559 --
560   l_proc  varchar2(72) := g_package||'convert_defs';
561 --
562 Begin
563   --
564   hr_utility.set_location('Entering:'||l_proc, 5);
565   --
566   -- We must now examine each argument value in the
567   -- p_rec plsql record structure
568   -- to see if a system default is being used. If a system default
569   -- is being used then we must set to the 'current' argument value.
570   --
571   If (p_rec.business_group_id = hr_api.g_number) then
572     p_rec.business_group_id :=
573     ben_cpo_shd.g_old_rec.business_group_id;
574   End If;
575   If (p_rec.cstmr_num = hr_api.g_number) then
576     p_rec.cstmr_num :=
577     ben_cpo_shd.g_old_rec.cstmr_num;
578   End If;
579   If (p_rec.plcy_r_grp = hr_api.g_varchar2) then
580     p_rec.plcy_r_grp :=
581     ben_cpo_shd.g_old_rec.plcy_r_grp;
582   End If;
583   If (p_rec.pgm_id = hr_api.g_number) then
584     p_rec.pgm_id :=
585     ben_cpo_shd.g_old_rec.pgm_id;
586   End If;
587   If (p_rec.pl_id = hr_api.g_number) then
588     p_rec.pl_id :=
589     ben_cpo_shd.g_old_rec.pl_id;
590   End If;
591   If (p_rec.organization_id = hr_api.g_number) then
592     p_rec.organization_id :=
593     ben_cpo_shd.g_old_rec.organization_id;
594   End If;
595   If (p_rec.cpo_attribute_category = hr_api.g_varchar2) then
596     p_rec.cpo_attribute_category :=
597     ben_cpo_shd.g_old_rec.cpo_attribute_category;
598   End If;
599   If (p_rec.cpo_attribute1 = hr_api.g_varchar2) then
600     p_rec.cpo_attribute1 :=
601     ben_cpo_shd.g_old_rec.cpo_attribute1;
602   End If;
603   If (p_rec.cpo_attribute2 = hr_api.g_varchar2) then
604     p_rec.cpo_attribute2 :=
605     ben_cpo_shd.g_old_rec.cpo_attribute2;
606   End If;
607   If (p_rec.cpo_attribute3 = hr_api.g_varchar2) then
608     p_rec.cpo_attribute3 :=
609     ben_cpo_shd.g_old_rec.cpo_attribute3;
610   End If;
611   If (p_rec.cpo_attribute4 = hr_api.g_varchar2) then
612     p_rec.cpo_attribute4 :=
613     ben_cpo_shd.g_old_rec.cpo_attribute4;
614   End If;
615   If (p_rec.cpo_attribute5 = hr_api.g_varchar2) then
616     p_rec.cpo_attribute5 :=
617     ben_cpo_shd.g_old_rec.cpo_attribute5;
618   End If;
619   If (p_rec.cpo_attribute6 = hr_api.g_varchar2) then
620     p_rec.cpo_attribute6 :=
621     ben_cpo_shd.g_old_rec.cpo_attribute6;
622   End If;
623   If (p_rec.cpo_attribute7 = hr_api.g_varchar2) then
624     p_rec.cpo_attribute7 :=
625     ben_cpo_shd.g_old_rec.cpo_attribute7;
626   End If;
627   If (p_rec.cpo_attribute8 = hr_api.g_varchar2) then
628     p_rec.cpo_attribute8 :=
629     ben_cpo_shd.g_old_rec.cpo_attribute8;
630   End If;
631   If (p_rec.cpo_attribute9 = hr_api.g_varchar2) then
632     p_rec.cpo_attribute9 :=
633     ben_cpo_shd.g_old_rec.cpo_attribute9;
634   End If;
635   If (p_rec.cpo_attribute10 = hr_api.g_varchar2) then
636     p_rec.cpo_attribute10 :=
637     ben_cpo_shd.g_old_rec.cpo_attribute10;
638   End If;
639   If (p_rec.cpo_attribute11 = hr_api.g_varchar2) then
640     p_rec.cpo_attribute11 :=
641     ben_cpo_shd.g_old_rec.cpo_attribute11;
642   End If;
643   If (p_rec.cpo_attribute12 = hr_api.g_varchar2) then
644     p_rec.cpo_attribute12 :=
645     ben_cpo_shd.g_old_rec.cpo_attribute12;
646   End If;
647   If (p_rec.cpo_attribute13 = hr_api.g_varchar2) then
648     p_rec.cpo_attribute13 :=
649     ben_cpo_shd.g_old_rec.cpo_attribute13;
650   End If;
651   If (p_rec.cpo_attribute14 = hr_api.g_varchar2) then
652     p_rec.cpo_attribute14 :=
653     ben_cpo_shd.g_old_rec.cpo_attribute14;
654   End If;
655   If (p_rec.cpo_attribute15 = hr_api.g_varchar2) then
656     p_rec.cpo_attribute15 :=
657     ben_cpo_shd.g_old_rec.cpo_attribute15;
658   End If;
659   If (p_rec.cpo_attribute16 = hr_api.g_varchar2) then
660     p_rec.cpo_attribute16 :=
661     ben_cpo_shd.g_old_rec.cpo_attribute16;
662   End If;
663   If (p_rec.cpo_attribute17 = hr_api.g_varchar2) then
664     p_rec.cpo_attribute17 :=
665     ben_cpo_shd.g_old_rec.cpo_attribute17;
666   End If;
667   If (p_rec.cpo_attribute18 = hr_api.g_varchar2) then
668     p_rec.cpo_attribute18 :=
669     ben_cpo_shd.g_old_rec.cpo_attribute18;
670   End If;
671   If (p_rec.cpo_attribute19 = hr_api.g_varchar2) then
672     p_rec.cpo_attribute19 :=
673     ben_cpo_shd.g_old_rec.cpo_attribute19;
674   End If;
675   If (p_rec.cpo_attribute20 = hr_api.g_varchar2) then
676     p_rec.cpo_attribute20 :=
677     ben_cpo_shd.g_old_rec.cpo_attribute20;
678   End If;
679   If (p_rec.cpo_attribute21 = hr_api.g_varchar2) then
680     p_rec.cpo_attribute21 :=
681     ben_cpo_shd.g_old_rec.cpo_attribute21;
682   End If;
683   If (p_rec.cpo_attribute22 = hr_api.g_varchar2) then
684     p_rec.cpo_attribute22 :=
685     ben_cpo_shd.g_old_rec.cpo_attribute22;
686   End If;
687   If (p_rec.cpo_attribute23 = hr_api.g_varchar2) then
688     p_rec.cpo_attribute23 :=
689     ben_cpo_shd.g_old_rec.cpo_attribute23;
690   End If;
691   If (p_rec.cpo_attribute24 = hr_api.g_varchar2) then
692     p_rec.cpo_attribute24 :=
693     ben_cpo_shd.g_old_rec.cpo_attribute24;
694   End If;
695   If (p_rec.cpo_attribute25 = hr_api.g_varchar2) then
696     p_rec.cpo_attribute25 :=
697     ben_cpo_shd.g_old_rec.cpo_attribute25;
698   End If;
699   If (p_rec.cpo_attribute26 = hr_api.g_varchar2) then
700     p_rec.cpo_attribute26 :=
701     ben_cpo_shd.g_old_rec.cpo_attribute26;
702   End If;
703   If (p_rec.cpo_attribute27 = hr_api.g_varchar2) then
704     p_rec.cpo_attribute27 :=
705     ben_cpo_shd.g_old_rec.cpo_attribute27;
706   End If;
707   If (p_rec.cpo_attribute28 = hr_api.g_varchar2) then
708     p_rec.cpo_attribute28 :=
709     ben_cpo_shd.g_old_rec.cpo_attribute28;
710   End If;
711   If (p_rec.cpo_attribute29 = hr_api.g_varchar2) then
712     p_rec.cpo_attribute29 :=
713     ben_cpo_shd.g_old_rec.cpo_attribute29;
714   End If;
715   If (p_rec.cpo_attribute30 = hr_api.g_varchar2) then
716     p_rec.cpo_attribute30 :=
717     ben_cpo_shd.g_old_rec.cpo_attribute30;
718   End If;
719 
720   --
721   hr_utility.set_location(' Leaving:'||l_proc, 10);
722 --
723 End convert_defs;
724 --
725 -- ----------------------------------------------------------------------------
726 -- |---------------------------------< upd >----------------------------------|
727 -- ----------------------------------------------------------------------------
728 Procedure upd
729   (
730   p_rec			in out nocopy 	ben_cpo_shd.g_rec_type,
731   p_effective_date	in 	date,
732   p_datetrack_mode	in 	varchar2
733   ) is
734 --
735   l_proc			varchar2(72) := g_package||'upd';
736   l_validation_start_date	date;
737   l_validation_end_date		date;
738 --
739 Begin
740   hr_utility.set_location('Entering:'||l_proc, 5);
741   --
742   -- Ensure that the DateTrack update mode is valid
743   --
744   dt_api.validate_dt_upd_mode(p_datetrack_mode => p_datetrack_mode);
745   --
746   -- We must lock the row which we need to update.
747   --
748   ben_cpo_shd.lck
749 	(p_effective_date	 => p_effective_date,
750       	 p_datetrack_mode	 => p_datetrack_mode,
751       	 p_popl_org_id	 => p_rec.popl_org_id,
752       	 p_object_version_number => p_rec.object_version_number,
753       	 p_validation_start_date => l_validation_start_date,
754       	 p_validation_end_date	 => l_validation_end_date);
755   --
756   -- 1. During an update system defaults are used to determine if
757   --    arguments have been defaulted or not. We must therefore
758   --    derive the full record structure values to be updated.
759   --
760   -- 2. Call the supporting update validate operations.
761   --
762   convert_defs(p_rec);
763   ben_cpo_bus.update_validate
764 	(p_rec			 => p_rec,
765 	 p_effective_date	 => p_effective_date,
766 	 p_datetrack_mode  	 => p_datetrack_mode,
767 	 p_validation_start_date => l_validation_start_date,
768 	 p_validation_end_date	 => l_validation_end_date);
769   --
770   -- Call the supporting pre-update operation
771   --
772   pre_update
773 	(p_rec			 => p_rec,
774 	 p_effective_date	 => p_effective_date,
775 	 p_datetrack_mode	 => p_datetrack_mode,
776 	 p_validation_start_date => l_validation_start_date,
777 	 p_validation_end_date	 => l_validation_end_date);
778   --
779   -- Update the row.
780   --
781   update_dml
782 	(p_rec			 => p_rec,
783 	 p_effective_date	 => p_effective_date,
784 	 p_datetrack_mode	 => p_datetrack_mode,
785 	 p_validation_start_date => l_validation_start_date,
786 	 p_validation_end_date	 => l_validation_end_date);
787   --
788   -- Call the supporting post-update operation
789   --
790   post_update
791 	(p_rec			 => p_rec,
792 	 p_effective_date	 => p_effective_date,
793 	 p_datetrack_mode	 => p_datetrack_mode,
794 	 p_validation_start_date => l_validation_start_date,
795 	 p_validation_end_date	 => l_validation_end_date);
796 End upd;
797 --
798 -- ----------------------------------------------------------------------------
799 -- |---------------------------------< upd >----------------------------------|
800 -- ----------------------------------------------------------------------------
801 Procedure upd
802   (
803   p_popl_org_id                  in number,
804   p_effective_start_date         out nocopy date,
805   p_effective_end_date           out nocopy date,
806   p_business_group_id            in number           default hr_api.g_number,
807   p_cstmr_num                    in number           default hr_api.g_number,
808   p_plcy_r_grp                   in varchar2         default hr_api.g_varchar2,
809   p_pgm_id                       in number           default hr_api.g_number,
810   p_pl_id                        in number           default hr_api.g_number,
811   p_organization_id              in number           default hr_api.g_number,
812   p_person_id                    in number           default hr_api.g_number,
813   p_cpo_attribute_category       in varchar2         default hr_api.g_varchar2,
814   p_cpo_attribute1               in varchar2         default hr_api.g_varchar2,
815   p_cpo_attribute2               in varchar2         default hr_api.g_varchar2,
816   p_cpo_attribute3               in varchar2         default hr_api.g_varchar2,
817   p_cpo_attribute4               in varchar2         default hr_api.g_varchar2,
818   p_cpo_attribute5               in varchar2         default hr_api.g_varchar2,
819   p_cpo_attribute6               in varchar2         default hr_api.g_varchar2,
820   p_cpo_attribute7               in varchar2         default hr_api.g_varchar2,
821   p_cpo_attribute8               in varchar2         default hr_api.g_varchar2,
822   p_cpo_attribute9               in varchar2         default hr_api.g_varchar2,
823   p_cpo_attribute10              in varchar2         default hr_api.g_varchar2,
824   p_cpo_attribute11              in varchar2         default hr_api.g_varchar2,
825   p_cpo_attribute12              in varchar2         default hr_api.g_varchar2,
826   p_cpo_attribute13              in varchar2         default hr_api.g_varchar2,
827   p_cpo_attribute14              in varchar2         default hr_api.g_varchar2,
828   p_cpo_attribute15              in varchar2         default hr_api.g_varchar2,
829   p_cpo_attribute16              in varchar2         default hr_api.g_varchar2,
830   p_cpo_attribute17              in varchar2         default hr_api.g_varchar2,
831   p_cpo_attribute18              in varchar2         default hr_api.g_varchar2,
832   p_cpo_attribute19              in varchar2         default hr_api.g_varchar2,
833   p_cpo_attribute20              in varchar2         default hr_api.g_varchar2,
834   p_cpo_attribute21              in varchar2         default hr_api.g_varchar2,
835   p_cpo_attribute22              in varchar2         default hr_api.g_varchar2,
836   p_cpo_attribute23              in varchar2         default hr_api.g_varchar2,
837   p_cpo_attribute24              in varchar2         default hr_api.g_varchar2,
838   p_cpo_attribute25              in varchar2         default hr_api.g_varchar2,
839   p_cpo_attribute26              in varchar2         default hr_api.g_varchar2,
840   p_cpo_attribute27              in varchar2         default hr_api.g_varchar2,
841   p_cpo_attribute28              in varchar2         default hr_api.g_varchar2,
842   p_cpo_attribute29              in varchar2         default hr_api.g_varchar2,
843   p_cpo_attribute30              in varchar2         default hr_api.g_varchar2,
844   p_object_version_number        in out nocopy number,
845   p_effective_date		 in date,
846   p_datetrack_mode		 in varchar2
847   ) is
848 --
849   l_rec		ben_cpo_shd.g_rec_type;
850   l_proc	varchar2(72) := g_package||'upd';
851 --
852 Begin
853   hr_utility.set_location('Entering:'||l_proc, 5);
854   --
855   -- Call conversion function to turn arguments into the
856   -- l_rec structure.
857   --
858   l_rec :=
859   ben_cpo_shd.convert_args
860   (
861   p_popl_org_id,
862   null,
863   null,
864   p_business_group_id,
865   p_cstmr_num,
866   p_plcy_r_grp,
867   p_pgm_id,
868   p_pl_id,
869   p_organization_id,
870   p_person_id,
871   p_cpo_attribute_category,
872   p_cpo_attribute1,
873   p_cpo_attribute2,
874   p_cpo_attribute3,
875   p_cpo_attribute4,
876   p_cpo_attribute5,
877   p_cpo_attribute6,
878   p_cpo_attribute7,
879   p_cpo_attribute8,
880   p_cpo_attribute9,
881   p_cpo_attribute10,
882   p_cpo_attribute11,
883   p_cpo_attribute12,
884   p_cpo_attribute13,
885   p_cpo_attribute14,
886   p_cpo_attribute15,
887   p_cpo_attribute16,
888   p_cpo_attribute17,
889   p_cpo_attribute18,
890   p_cpo_attribute19,
891   p_cpo_attribute20,
892   p_cpo_attribute21,
893   p_cpo_attribute22,
894   p_cpo_attribute23,
895   p_cpo_attribute24,
896   p_cpo_attribute25,
897   p_cpo_attribute26,
898   p_cpo_attribute27,
899   p_cpo_attribute28,
900   p_cpo_attribute29,
901   p_cpo_attribute30,
902   p_object_version_number
903   );
904   --
905   -- Having converted the arguments into the
906   -- plsql record structure we call the corresponding record
907   -- business process.
908   --
909   upd(l_rec, p_effective_date, p_datetrack_mode);
910   p_object_version_number       := l_rec.object_version_number;
911   p_effective_start_date        := l_rec.effective_start_date;
912   p_effective_end_date          := l_rec.effective_end_date;
913   --
914   --
915   hr_utility.set_location(' Leaving:'||l_proc, 10);
916 End upd;
917 --
918 end ben_cpo_upd;