DBA Data[Home] [Help]

PACKAGE BODY: APPS.BEN_OPP_UPD

Source


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