DBA Data[Home] [Help]

PACKAGE BODY: APPS.BEN_LDC_UPD

Source


1 Package body ben_ldc_upd as
2 /* $Header: beldcrhi.pkb 120.0.12010000.2 2008/08/05 14:28:29 ubhat ship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33)	:= '  ben_ldc_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_ldc_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_ler_chg_dpnt_cvg_f',
78 	   p_base_key_column	=> 'ler_chg_dpnt_cvg_id',
79 	   p_base_key_value	=> p_rec.ler_chg_dpnt_cvg_id);
80     --
81     ben_ldc_shd.g_api_dml := true;  -- Set the api dml status
82     --
83     -- Update the ben_ler_chg_dpnt_cvg_f Row
84     --
85     update  ben_ler_chg_dpnt_cvg_f
86     set
87         ler_chg_dpnt_cvg_id             = p_rec.ler_chg_dpnt_cvg_id,
88     pl_id                           = p_rec.pl_id,
89     pgm_id                          = p_rec.pgm_id,
90     business_group_id               = p_rec.business_group_id,
91     ler_id                          = p_rec.ler_id,
92     ptip_id                         = p_rec.ptip_id,
93     add_rmv_cvg_cd                  = p_rec.add_rmv_cvg_cd,
94     cvg_eff_end_cd                  = p_rec.cvg_eff_end_cd,
95     cvg_eff_strt_cd                 = p_rec.cvg_eff_strt_cd,
96     ler_chg_dpnt_cvg_rl             = p_rec.ler_chg_dpnt_cvg_rl,
97     ler_chg_dpnt_cvg_cd             = p_rec.ler_chg_dpnt_cvg_cd,
98     cvg_eff_strt_rl                 = p_rec.cvg_eff_strt_rl,
99     cvg_eff_end_rl                  = p_rec.cvg_eff_end_rl,
100     ldc_attribute_category          = p_rec.ldc_attribute_category,
101     ldc_attribute1                  = p_rec.ldc_attribute1,
102     ldc_attribute2                  = p_rec.ldc_attribute2,
103     ldc_attribute3                  = p_rec.ldc_attribute3,
104     ldc_attribute4                  = p_rec.ldc_attribute4,
105     ldc_attribute5                  = p_rec.ldc_attribute5,
106     ldc_attribute6                  = p_rec.ldc_attribute6,
107     ldc_attribute7                  = p_rec.ldc_attribute7,
108     ldc_attribute8                  = p_rec.ldc_attribute8,
109     ldc_attribute9                  = p_rec.ldc_attribute9,
110     ldc_attribute10                 = p_rec.ldc_attribute10,
111     ldc_attribute11                 = p_rec.ldc_attribute11,
112     ldc_attribute12                 = p_rec.ldc_attribute12,
113     ldc_attribute13                 = p_rec.ldc_attribute13,
114     ldc_attribute14                 = p_rec.ldc_attribute14,
115     ldc_attribute15                 = p_rec.ldc_attribute15,
116     ldc_attribute16                 = p_rec.ldc_attribute16,
117     ldc_attribute17                 = p_rec.ldc_attribute17,
118     ldc_attribute18                 = p_rec.ldc_attribute18,
119     ldc_attribute19                 = p_rec.ldc_attribute19,
120     ldc_attribute20                 = p_rec.ldc_attribute20,
121     ldc_attribute21                 = p_rec.ldc_attribute21,
122     ldc_attribute22                 = p_rec.ldc_attribute22,
123     ldc_attribute23                 = p_rec.ldc_attribute23,
124     ldc_attribute24                 = p_rec.ldc_attribute24,
125     ldc_attribute25                 = p_rec.ldc_attribute25,
126     ldc_attribute26                 = p_rec.ldc_attribute26,
127     ldc_attribute27                 = p_rec.ldc_attribute27,
128     ldc_attribute28                 = p_rec.ldc_attribute28,
129     ldc_attribute29                 = p_rec.ldc_attribute29,
130     ldc_attribute30                 = p_rec.ldc_attribute30,
131     susp_if_ctfn_not_prvd_flag      = p_rec.susp_if_ctfn_not_prvd_flag,
132     ctfn_determine_cd               = p_rec.ctfn_determine_cd,
133     object_version_number           = p_rec.object_version_number
134     where   ler_chg_dpnt_cvg_id = p_rec.ler_chg_dpnt_cvg_id
135     and     effective_start_date = p_validation_start_date
136     and     effective_end_date   = p_validation_end_date;
137     --
138     ben_ldc_shd.g_api_dml := false;   -- Unset the api dml status
139     --
140     -- Set the effective start and end dates
141     --
142     p_rec.effective_start_date := p_validation_start_date;
143     p_rec.effective_end_date   := p_validation_end_date;
144   End If;
145 --
146 hr_utility.set_location(' Leaving:'||l_proc, 15);
147 Exception
148   When hr_api.check_integrity_violated Then
149     -- A check constraint has been violated
150     ben_ldc_shd.g_api_dml := false;   -- Unset the api dml status
151     ben_ldc_shd.constraint_error
152       (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
153   When hr_api.unique_integrity_violated Then
154     -- Unique integrity has been violated
155     ben_ldc_shd.g_api_dml := false;   -- Unset the api dml status
156     ben_ldc_shd.constraint_error
157       (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
158   When Others Then
159     ben_ldc_shd.g_api_dml := false;   -- Unset the api dml status
160     Raise;
161 End dt_update_dml;
162 --
163 -- ----------------------------------------------------------------------------
164 -- |------------------------------< update_dml >------------------------------|
165 -- ----------------------------------------------------------------------------
166 -- {Start Of Comments}
167 --
168 -- Description:
169 --   This procedure calls the dt_update_dml control logic which handles
170 --   the actual datetrack dml.
171 --
172 -- Prerequisites:
173 --   This is an internal private procedure which must be called from the upd
174 --   procedure.
175 --
176 -- In Parameters:
177 --   A Pl/Sql record structre.
178 --
179 -- Post Success:
180 --   Processing contines.
181 --
182 -- Post Failure:
183 --   No specific error handling is required within this procedure.
184 --
185 -- Developer Implementation Notes:
186 --   The update 'set' arguments list should be modified if any of your
187 --   attributes are not updateable.
188 --
189 -- Access Status:
190 --   Internal Row Handler Use Only.
191 --
192 -- {End Of Comments}
193 -- ----------------------------------------------------------------------------
194 Procedure update_dml
195 	(p_rec 			 in out nocopy ben_ldc_shd.g_rec_type,
196 	 p_effective_date	 in	date,
197 	 p_datetrack_mode	 in	varchar2,
198 	 p_validation_start_date in	date,
199 	 p_validation_end_date	 in	date) is
200 --
201   l_proc	varchar2(72) := g_package||'update_dml';
202 --
203 Begin
204   hr_utility.set_location('Entering:'||l_proc, 5);
205   --
206   dt_update_dml(p_rec			=> p_rec,
207 		p_effective_date	=> p_effective_date,
208 		p_datetrack_mode	=> p_datetrack_mode,
209        		p_validation_start_date	=> p_validation_start_date,
210 		p_validation_end_date	=> p_validation_end_date);
211   --
212   hr_utility.set_location(' Leaving:'||l_proc, 10);
213 End update_dml;
214 --
215 -- ----------------------------------------------------------------------------
216 -- |----------------------------< dt_pre_update >-----------------------------|
217 -- ----------------------------------------------------------------------------
218 -- {Start Of Comments}
219 --
220 -- Description:
221 --   The dt_pre_update procedure controls the execution
222 --   of dml for the datetrack modes of: UPDATE, UPDATE_OVERRIDE
223 --   and UPDATE_CHANGE_INSERT only. The execution required is as
224 --   follows:
225 --
226 --   1) Providing the datetrack update mode is not 'CORRECTION'
227 --      then set the effective end date of the current row (this
228 --      will be the validation_start_date - 1).
229 --   2) If the datetrack mode is 'UPDATE_OVERRIDE' then call the
230 --      corresponding delete_dml process to delete any future rows
231 --      where the effective_start_date is greater than or equal to
232 --	the validation_start_date.
233 --   3) Call the insert_dml process to insert the new updated row
234 --      details..
235 --
236 -- Prerequisites:
237 --   This is an internal procedure which is called from the
238 --   pre_update procedure.
239 --
240 -- In Parameters:
241 --
242 -- Post Success:
243 --   Processing continues.
244 --
245 -- Post Failure:
246 --   If an error has occurred, an error message and exception will be raised
247 --   but not handled.
248 --
249 -- Developer Implementation Notes:
250 --   This is an internal procedure which is required by Datetrack. Don't
251 --   remove or modify.
252 --
253 -- Access Status:
254 --   Internal Row Handler Use Only.
255 --
256 -- {End Of Comments}
257 -- ----------------------------------------------------------------------------
258 Procedure dt_pre_update
259 	(p_rec 			 in out nocopy ben_ldc_shd.g_rec_type,
260 	 p_effective_date	 in	date,
261 	 p_datetrack_mode	 in	varchar2,
262 	 p_validation_start_date in	date,
263 	 p_validation_end_date	 in	date) is
264 --
265   l_proc	         varchar2(72) := g_package||'dt_pre_update';
266   l_dummy_version_number number;
267 --
268 Begin
269   hr_utility.set_location('Entering:'||l_proc, 5);
270   If (p_datetrack_mode <> 'CORRECTION') then
271     hr_utility.set_location(l_proc, 10);
272     --
273     -- Update the current effective end date
274     --
275     ben_ldc_shd.upd_effective_end_date
276      (p_effective_date	       => p_effective_date,
277       p_base_key_value	       => p_rec.ler_chg_dpnt_cvg_id,
278       p_new_effective_end_date => (p_validation_start_date - 1),
279       p_validation_start_date  => p_validation_start_date,
280       p_validation_end_date    => p_validation_end_date,
281       p_object_version_number  => l_dummy_version_number);
282     --
283     If (p_datetrack_mode = 'UPDATE_OVERRIDE') then
284       hr_utility.set_location(l_proc, 15);
285       --
286       -- As the datetrack mode is 'UPDATE_OVERRIDE' then we must
287       -- delete any future rows
288       --
289       ben_ldc_del.delete_dml
290         (p_rec			 => p_rec,
291 	 p_effective_date	 => p_effective_date,
292 	 p_datetrack_mode	 => p_datetrack_mode,
293 	 p_validation_start_date => p_validation_start_date,
294 	 p_validation_end_date   => p_validation_end_date);
295     End If;
296     hr_utility.set_location(l_proc, 20);
297     --
298     -- We must now insert the updated row
299     --
300     ben_ldc_ins.insert_dml
301       (p_rec			=> p_rec,
302        p_effective_date		=> p_effective_date,
303        p_datetrack_mode		=> p_datetrack_mode,
304        p_validation_start_date	=> p_validation_start_date,
305        p_validation_end_date	=> p_validation_end_date);
306   End If;
307   hr_utility.set_location(' Leaving:'||l_proc, 20);
308 End dt_pre_update;
309 --
310 -- ----------------------------------------------------------------------------
311 -- |------------------------------< pre_update >------------------------------|
312 -- ----------------------------------------------------------------------------
313 -- {Start Of Comments}
314 --
315 -- Description:
316 --   This private procedure contains any processing which is required before
317 --   the update dml.
318 --
319 -- Prerequisites:
320 --   This is an internal procedure which is called from the upd procedure.
321 --
322 -- In Parameters:
323 --   A Pl/Sql record structre.
324 --
325 -- Post Success:
326 --   Processing continues.
327 --
328 -- Post Failure:
329 --   If an error has occurred, an error message and exception will be raised
330 --   but not handled.
331 --
332 -- Developer Implementation Notes:
333 --   Any pre-processing required before the update dml is issued should be
334 --   coded within this procedure. It is important to note that any 3rd party
335 --   maintenance should be reviewed before placing in this procedure. The call
336 --   to the dt_update_dml procedure should NOT be removed.
337 --
338 -- Access Status:
339 --   Internal Row Handler Use Only.
340 --
341 -- {End Of Comments}
342 -- ----------------------------------------------------------------------------
343 Procedure pre_update
344 	(p_rec 			 in out nocopy ben_ldc_shd.g_rec_type,
345 	 p_effective_date	 in	date,
346 	 p_datetrack_mode	 in	varchar2,
347 	 p_validation_start_date in	date,
348 	 p_validation_end_date	 in	date) is
349 --
350   l_proc	varchar2(72) := g_package||'pre_update';
351 --
352 Begin
353   hr_utility.set_location('Entering:'||l_proc, 5);
354   --
355   --
356   --
357   dt_pre_update
358     (p_rec 		     => p_rec,
359      p_effective_date	     => p_effective_date,
360      p_datetrack_mode	     => p_datetrack_mode,
361      p_validation_start_date => p_validation_start_date,
362      p_validation_end_date   => p_validation_end_date);
363   --
364   hr_utility.set_location(' Leaving:'||l_proc, 10);
365 End pre_update;
366 --
367 -- ----------------------------------------------------------------------------
368 -- |-----------------------------< post_update >------------------------------|
369 -- ----------------------------------------------------------------------------
370 -- {Start Of Comments}
371 --
372 -- Description:
373 --   This private procedure contains any processing which is required after the
374 --   update dml.
375 --
376 -- Prerequisites:
377 --   This is an internal procedure which is called from the upd procedure.
378 --
379 -- In Parameters:
380 --   A Pl/Sql record structre.
381 --
382 -- Post Success:
383 --   Processing continues.
384 --
385 -- Post Failure:
386 --   If an error has occurred, an error message and exception will be raised
387 --   but not handled.
388 --
389 -- Developer Implementation Notes:
390 --   Any post-processing required after the update dml is issued should be
391 --   coded within this procedure. It is important to note that any 3rd party
392 --   maintenance should be reviewed before placing in this procedure.
393 --
394 -- Access Status:
395 --   Internal Row Handler Use Only.
396 --
397 -- {End Of Comments}
398 -- ----------------------------------------------------------------------------
399 Procedure post_update
400 	(p_rec 			 in ben_ldc_shd.g_rec_type,
401 	 p_effective_date	 in date,
402 	 p_datetrack_mode	 in varchar2,
403 	 p_validation_start_date in date,
404 	 p_validation_end_date	 in date) is
405 --
406   l_proc	varchar2(72) := g_package||'post_update';
407 --
408 Begin
409   hr_utility.set_location('Entering:'||l_proc, 5);
410 --
411   --
412   -- Start of API User Hook for post_update.
413   --
414   begin
415     --
416     ben_ldc_rku.after_update
417       (
418   p_ler_chg_dpnt_cvg_id           =>p_rec.ler_chg_dpnt_cvg_id
419  ,p_effective_start_date          =>p_rec.effective_start_date
420  ,p_effective_end_date            =>p_rec.effective_end_date
421  ,p_pl_id                         =>p_rec.pl_id
422  ,p_pgm_id                        =>p_rec.pgm_id
423  ,p_business_group_id             =>p_rec.business_group_id
424  ,p_ler_id                        =>p_rec.ler_id
425  ,p_ptip_id                       =>p_rec.ptip_id
426  ,p_add_rmv_cvg_cd                =>p_rec.add_rmv_cvg_cd
427  ,p_cvg_eff_end_cd                =>p_rec.cvg_eff_end_cd
428  ,p_cvg_eff_strt_cd               =>p_rec.cvg_eff_strt_cd
429  ,p_ler_chg_dpnt_cvg_rl           =>p_rec.ler_chg_dpnt_cvg_rl
430  ,p_ler_chg_dpnt_cvg_cd           =>p_rec.ler_chg_dpnt_cvg_cd
431  ,p_cvg_eff_strt_rl               =>p_rec.cvg_eff_strt_rl
432  ,p_cvg_eff_end_rl                =>p_rec.cvg_eff_end_rl
433  ,p_ldc_attribute_category        =>p_rec.ldc_attribute_category
434  ,p_ldc_attribute1                =>p_rec.ldc_attribute1
435  ,p_ldc_attribute2                =>p_rec.ldc_attribute2
436  ,p_ldc_attribute3                =>p_rec.ldc_attribute3
437  ,p_ldc_attribute4                =>p_rec.ldc_attribute4
438  ,p_ldc_attribute5                =>p_rec.ldc_attribute5
439  ,p_ldc_attribute6                =>p_rec.ldc_attribute6
440  ,p_ldc_attribute7                =>p_rec.ldc_attribute7
441  ,p_ldc_attribute8                =>p_rec.ldc_attribute8
442  ,p_ldc_attribute9                =>p_rec.ldc_attribute9
443  ,p_ldc_attribute10               =>p_rec.ldc_attribute10
444  ,p_ldc_attribute11               =>p_rec.ldc_attribute11
445  ,p_ldc_attribute12               =>p_rec.ldc_attribute12
446  ,p_ldc_attribute13               =>p_rec.ldc_attribute13
447  ,p_ldc_attribute14               =>p_rec.ldc_attribute14
448  ,p_ldc_attribute15               =>p_rec.ldc_attribute15
449  ,p_ldc_attribute16               =>p_rec.ldc_attribute16
450  ,p_ldc_attribute17               =>p_rec.ldc_attribute17
451  ,p_ldc_attribute18               =>p_rec.ldc_attribute18
452  ,p_ldc_attribute19               =>p_rec.ldc_attribute19
453  ,p_ldc_attribute20               =>p_rec.ldc_attribute20
454  ,p_ldc_attribute21               =>p_rec.ldc_attribute21
455  ,p_ldc_attribute22               =>p_rec.ldc_attribute22
456  ,p_ldc_attribute23               =>p_rec.ldc_attribute23
457  ,p_ldc_attribute24               =>p_rec.ldc_attribute24
458  ,p_ldc_attribute25               =>p_rec.ldc_attribute25
459  ,p_ldc_attribute26               =>p_rec.ldc_attribute26
460  ,p_ldc_attribute27               =>p_rec.ldc_attribute27
461  ,p_ldc_attribute28               =>p_rec.ldc_attribute28
462  ,p_ldc_attribute29               =>p_rec.ldc_attribute29
463  ,p_ldc_attribute30               =>p_rec.ldc_attribute30
464  ,p_susp_if_ctfn_not_prvd_flag    =>p_rec.susp_if_ctfn_not_prvd_flag
465  ,p_ctfn_determine_cd             =>p_rec.ctfn_determine_cd
466  ,p_object_version_number         =>p_rec.object_version_number
467  ,p_effective_date                =>p_effective_date
468  ,p_datetrack_mode                =>p_datetrack_mode
469  ,p_validation_start_date         =>p_validation_start_date
470  ,p_validation_end_date           =>p_validation_end_date
471  ,p_effective_start_date_o        =>ben_ldc_shd.g_old_rec.effective_start_date
472  ,p_effective_end_date_o          =>ben_ldc_shd.g_old_rec.effective_end_date
473  ,p_pl_id_o                       =>ben_ldc_shd.g_old_rec.pl_id
474  ,p_pgm_id_o                      =>ben_ldc_shd.g_old_rec.pgm_id
475  ,p_business_group_id_o           =>ben_ldc_shd.g_old_rec.business_group_id
476  ,p_ler_id_o                      =>ben_ldc_shd.g_old_rec.ler_id
477  ,p_ptip_id_o                     =>ben_ldc_shd.g_old_rec.ptip_id
478  ,p_add_rmv_cvg_cd_o              =>ben_ldc_shd.g_old_rec.add_rmv_cvg_cd
479  ,p_cvg_eff_end_cd_o              =>ben_ldc_shd.g_old_rec.cvg_eff_end_cd
480  ,p_cvg_eff_strt_cd_o             =>ben_ldc_shd.g_old_rec.cvg_eff_strt_cd
481  ,p_ler_chg_dpnt_cvg_rl_o         =>ben_ldc_shd.g_old_rec.ler_chg_dpnt_cvg_rl
482  ,p_ler_chg_dpnt_cvg_cd_o         =>ben_ldc_shd.g_old_rec.ler_chg_dpnt_cvg_cd
483  ,p_cvg_eff_strt_rl_o             =>ben_ldc_shd.g_old_rec.cvg_eff_strt_rl
484  ,p_cvg_eff_end_rl_o              =>ben_ldc_shd.g_old_rec.cvg_eff_end_rl
485  ,p_ldc_attribute_category_o      =>ben_ldc_shd.g_old_rec.ldc_attribute_category
486  ,p_ldc_attribute1_o              =>ben_ldc_shd.g_old_rec.ldc_attribute1
487  ,p_ldc_attribute2_o              =>ben_ldc_shd.g_old_rec.ldc_attribute2
488  ,p_ldc_attribute3_o              =>ben_ldc_shd.g_old_rec.ldc_attribute3
489  ,p_ldc_attribute4_o              =>ben_ldc_shd.g_old_rec.ldc_attribute4
490  ,p_ldc_attribute5_o              =>ben_ldc_shd.g_old_rec.ldc_attribute5
491  ,p_ldc_attribute6_o              =>ben_ldc_shd.g_old_rec.ldc_attribute6
492  ,p_ldc_attribute7_o              =>ben_ldc_shd.g_old_rec.ldc_attribute7
493  ,p_ldc_attribute8_o              =>ben_ldc_shd.g_old_rec.ldc_attribute8
494  ,p_ldc_attribute9_o              =>ben_ldc_shd.g_old_rec.ldc_attribute9
495  ,p_ldc_attribute10_o             =>ben_ldc_shd.g_old_rec.ldc_attribute10
496  ,p_ldc_attribute11_o             =>ben_ldc_shd.g_old_rec.ldc_attribute11
497  ,p_ldc_attribute12_o             =>ben_ldc_shd.g_old_rec.ldc_attribute12
498  ,p_ldc_attribute13_o             =>ben_ldc_shd.g_old_rec.ldc_attribute13
499  ,p_ldc_attribute14_o             =>ben_ldc_shd.g_old_rec.ldc_attribute14
500  ,p_ldc_attribute15_o             =>ben_ldc_shd.g_old_rec.ldc_attribute15
501  ,p_ldc_attribute16_o             =>ben_ldc_shd.g_old_rec.ldc_attribute16
502  ,p_ldc_attribute17_o             =>ben_ldc_shd.g_old_rec.ldc_attribute17
503  ,p_ldc_attribute18_o             =>ben_ldc_shd.g_old_rec.ldc_attribute18
504  ,p_ldc_attribute19_o             =>ben_ldc_shd.g_old_rec.ldc_attribute19
505  ,p_ldc_attribute20_o             =>ben_ldc_shd.g_old_rec.ldc_attribute20
506  ,p_ldc_attribute21_o             =>ben_ldc_shd.g_old_rec.ldc_attribute21
507  ,p_ldc_attribute22_o             =>ben_ldc_shd.g_old_rec.ldc_attribute22
508  ,p_ldc_attribute23_o             =>ben_ldc_shd.g_old_rec.ldc_attribute23
509  ,p_ldc_attribute24_o             =>ben_ldc_shd.g_old_rec.ldc_attribute24
510  ,p_ldc_attribute25_o             =>ben_ldc_shd.g_old_rec.ldc_attribute25
511  ,p_ldc_attribute26_o             =>ben_ldc_shd.g_old_rec.ldc_attribute26
512  ,p_ldc_attribute27_o             =>ben_ldc_shd.g_old_rec.ldc_attribute27
513  ,p_ldc_attribute28_o             =>ben_ldc_shd.g_old_rec.ldc_attribute28
514  ,p_ldc_attribute29_o             =>ben_ldc_shd.g_old_rec.ldc_attribute29
515  ,p_ldc_attribute30_o             =>ben_ldc_shd.g_old_rec.ldc_attribute30
516  ,p_susp_if_ctfn_not_prvd_flag_o  =>ben_ldc_shd.g_old_rec.susp_if_ctfn_not_prvd_flag
517  ,p_ctfn_determine_cd_o           =>ben_ldc_shd.g_old_rec.ctfn_determine_cd
518  ,p_object_version_number_o       =>ben_ldc_shd.g_old_rec.object_version_number
519       );
520     --
521   exception
522     --
523     when hr_api.cannot_find_prog_unit then
524       --
525       hr_api.cannot_find_prog_unit_error
526         (p_module_name => 'ben_ler_chg_dpnt_cvg_f'
527         ,p_hook_type   => 'AU');
528       --
529   end;
530   --
531   -- End of API User Hook for post_update.
532   --
533   --
534   hr_utility.set_location(' Leaving:'||l_proc, 10);
535 End post_update;
536 --
537 -- ----------------------------------------------------------------------------
538 -- |-----------------------------< convert_defs >-----------------------------|
539 -- ----------------------------------------------------------------------------
540 -- {Start Of Comments}
541 --
542 -- Description:
543 --   The Convert_Defs procedure has one very important function:
544 --   It must return the record structure for the row with all system defaulted
545 --   values converted into its corresponding parameter value for update. When
546 --   we attempt to update a row through the Upd process , certain
547 --   parameters can be defaulted which enables flexibility in the calling of
548 --   the upd process (e.g. only attributes which need to be updated need to be
549 --   specified). For the upd process to determine which attributes
550 --   have NOT been specified we need to check if the parameter has a reserved
551 --   system default value. Therefore, for all parameters which have a
552 --   corresponding reserved system default mechanism specified we need to
553 --   check if a system default is being used. If a system default is being
554 --   used then we convert the defaulted value into its corresponding attribute
555 --   value held in the g_old_rec data structure.
556 --
557 -- Prerequisites:
558 --   This private function can only be called from the upd process.
559 --
560 -- In Parameters:
561 --   A Pl/Sql record structre.
562 --
563 -- Post Success:
564 --   The record structure will be returned with all system defaulted parameter
565 --   values converted into its current row attribute value.
566 --
567 -- Post Failure:
568 --   No direct error handling is required within this function. Any possible
569 --   errors within this procedure will be a PL/SQL value error due to conversion
570 --   of datatypes or data lengths.
571 --
572 -- Developer Implementation Notes:
573 --   None.
574 --
575 -- Access Status:
576 --   Internal Row Handler Use Only.
577 --
578 -- {End Of Comments}
579 -- ----------------------------------------------------------------------------
580 Procedure convert_defs(p_rec in out nocopy ben_ldc_shd.g_rec_type) is
581 --
582   l_proc  varchar2(72) := g_package||'convert_defs';
583 --
584 Begin
585   --
586   hr_utility.set_location('Entering:'||l_proc, 5);
587   --
588   -- We must now examine each argument value in the
589   -- p_rec plsql record structure
590   -- to see if a system default is being used. If a system default
591   -- is being used then we must set to the 'current' argument value.
592   --
593   If (p_rec.pl_id = hr_api.g_number) then
594     p_rec.pl_id :=
595     ben_ldc_shd.g_old_rec.pl_id;
596   End If;
597   If (p_rec.pgm_id = hr_api.g_number) then
598     p_rec.pgm_id :=
599     ben_ldc_shd.g_old_rec.pgm_id;
600   End If;
601   If (p_rec.business_group_id = hr_api.g_number) then
602     p_rec.business_group_id :=
603     ben_ldc_shd.g_old_rec.business_group_id;
604   End If;
605   If (p_rec.ler_id = hr_api.g_number) then
606     p_rec.ler_id :=
607     ben_ldc_shd.g_old_rec.ler_id;
608   End If;
609   If (p_rec.ptip_id = hr_api.g_number) then
610     p_rec.ptip_id :=
611     ben_ldc_shd.g_old_rec.ptip_id;
612   End If;
613   If (p_rec.add_rmv_cvg_cd = hr_api.g_varchar2) then
614     p_rec.add_rmv_cvg_cd :=
615     ben_ldc_shd.g_old_rec.add_rmv_cvg_cd;
616   End If;
617   If (p_rec.cvg_eff_end_cd = hr_api.g_varchar2) then
618     p_rec.cvg_eff_end_cd :=
619     ben_ldc_shd.g_old_rec.cvg_eff_end_cd;
620   End If;
621   If (p_rec.cvg_eff_strt_cd = hr_api.g_varchar2) then
622     p_rec.cvg_eff_strt_cd :=
623     ben_ldc_shd.g_old_rec.cvg_eff_strt_cd;
624   End If;
625   If (p_rec.ler_chg_dpnt_cvg_rl = hr_api.g_number) then
626     p_rec.ler_chg_dpnt_cvg_rl :=
627     ben_ldc_shd.g_old_rec.ler_chg_dpnt_cvg_rl;
628   End If;
629   If (p_rec.cvg_eff_strt_rl = hr_api.g_number) then
630     p_rec.cvg_eff_strt_rl :=
631     ben_ldc_shd.g_old_rec.cvg_eff_strt_rl;
632   End If;
633   If (p_rec.cvg_eff_end_rl = hr_api.g_number) then
634     p_rec.cvg_eff_end_rl :=
635     ben_ldc_shd.g_old_rec.cvg_eff_end_rl;
636   End If;
637   If (p_rec.ldc_attribute_category = hr_api.g_varchar2) then
638     p_rec.ldc_attribute_category :=
639     ben_ldc_shd.g_old_rec.ldc_attribute_category;
640   End If;
641   If (p_rec.ldc_attribute1 = hr_api.g_varchar2) then
642     p_rec.ldc_attribute1 :=
643     ben_ldc_shd.g_old_rec.ldc_attribute1;
644   End If;
645   If (p_rec.ldc_attribute2 = hr_api.g_varchar2) then
646     p_rec.ldc_attribute2 :=
647     ben_ldc_shd.g_old_rec.ldc_attribute2;
648   End If;
649   If (p_rec.ldc_attribute3 = hr_api.g_varchar2) then
650     p_rec.ldc_attribute3 :=
651     ben_ldc_shd.g_old_rec.ldc_attribute3;
652   End If;
653   If (p_rec.ldc_attribute4 = hr_api.g_varchar2) then
654     p_rec.ldc_attribute4 :=
655     ben_ldc_shd.g_old_rec.ldc_attribute4;
656   End If;
657   If (p_rec.ldc_attribute5 = hr_api.g_varchar2) then
658     p_rec.ldc_attribute5 :=
659     ben_ldc_shd.g_old_rec.ldc_attribute5;
660   End If;
661   If (p_rec.ldc_attribute6 = hr_api.g_varchar2) then
662     p_rec.ldc_attribute6 :=
663     ben_ldc_shd.g_old_rec.ldc_attribute6;
664   End If;
665   If (p_rec.ldc_attribute7 = hr_api.g_varchar2) then
666     p_rec.ldc_attribute7 :=
667     ben_ldc_shd.g_old_rec.ldc_attribute7;
668   End If;
669   If (p_rec.ldc_attribute8 = hr_api.g_varchar2) then
670     p_rec.ldc_attribute8 :=
671     ben_ldc_shd.g_old_rec.ldc_attribute8;
672   End If;
673   If (p_rec.ldc_attribute9 = hr_api.g_varchar2) then
674     p_rec.ldc_attribute9 :=
675     ben_ldc_shd.g_old_rec.ldc_attribute9;
676   End If;
677   If (p_rec.ldc_attribute10 = hr_api.g_varchar2) then
678     p_rec.ldc_attribute10 :=
679     ben_ldc_shd.g_old_rec.ldc_attribute10;
680   End If;
681   If (p_rec.ldc_attribute11 = hr_api.g_varchar2) then
682     p_rec.ldc_attribute11 :=
683     ben_ldc_shd.g_old_rec.ldc_attribute11;
684   End If;
685   If (p_rec.ldc_attribute12 = hr_api.g_varchar2) then
686     p_rec.ldc_attribute12 :=
687     ben_ldc_shd.g_old_rec.ldc_attribute12;
688   End If;
689   If (p_rec.ldc_attribute13 = hr_api.g_varchar2) then
690     p_rec.ldc_attribute13 :=
691     ben_ldc_shd.g_old_rec.ldc_attribute13;
692   End If;
693   If (p_rec.ldc_attribute14 = hr_api.g_varchar2) then
694     p_rec.ldc_attribute14 :=
695     ben_ldc_shd.g_old_rec.ldc_attribute14;
696   End If;
697   If (p_rec.ldc_attribute15 = hr_api.g_varchar2) then
698     p_rec.ldc_attribute15 :=
699     ben_ldc_shd.g_old_rec.ldc_attribute15;
700   End If;
701   If (p_rec.ldc_attribute16 = hr_api.g_varchar2) then
702     p_rec.ldc_attribute16 :=
703     ben_ldc_shd.g_old_rec.ldc_attribute16;
704   End If;
705   If (p_rec.ldc_attribute17 = hr_api.g_varchar2) then
706     p_rec.ldc_attribute17 :=
707     ben_ldc_shd.g_old_rec.ldc_attribute17;
708   End If;
709   If (p_rec.ldc_attribute18 = hr_api.g_varchar2) then
710     p_rec.ldc_attribute18 :=
711     ben_ldc_shd.g_old_rec.ldc_attribute18;
712   End If;
713   If (p_rec.ldc_attribute19 = hr_api.g_varchar2) then
714     p_rec.ldc_attribute19 :=
715     ben_ldc_shd.g_old_rec.ldc_attribute19;
716   End If;
717   If (p_rec.ldc_attribute20 = hr_api.g_varchar2) then
718     p_rec.ldc_attribute20 :=
719     ben_ldc_shd.g_old_rec.ldc_attribute20;
720   End If;
721   If (p_rec.ldc_attribute21 = hr_api.g_varchar2) then
722     p_rec.ldc_attribute21 :=
723     ben_ldc_shd.g_old_rec.ldc_attribute21;
724   End If;
725   If (p_rec.ldc_attribute22 = hr_api.g_varchar2) then
726     p_rec.ldc_attribute22 :=
727     ben_ldc_shd.g_old_rec.ldc_attribute22;
728   End If;
729   If (p_rec.ldc_attribute23 = hr_api.g_varchar2) then
730     p_rec.ldc_attribute23 :=
731     ben_ldc_shd.g_old_rec.ldc_attribute23;
732   End If;
733   If (p_rec.ldc_attribute24 = hr_api.g_varchar2) then
734     p_rec.ldc_attribute24 :=
735     ben_ldc_shd.g_old_rec.ldc_attribute24;
736   End If;
737   If (p_rec.ldc_attribute25 = hr_api.g_varchar2) then
738     p_rec.ldc_attribute25 :=
739     ben_ldc_shd.g_old_rec.ldc_attribute25;
740   End If;
741   If (p_rec.ldc_attribute26 = hr_api.g_varchar2) then
742     p_rec.ldc_attribute26 :=
743     ben_ldc_shd.g_old_rec.ldc_attribute26;
744   End If;
745   If (p_rec.ldc_attribute27 = hr_api.g_varchar2) then
746     p_rec.ldc_attribute27 :=
747     ben_ldc_shd.g_old_rec.ldc_attribute27;
748   End If;
749   If (p_rec.ldc_attribute28 = hr_api.g_varchar2) then
750     p_rec.ldc_attribute28 :=
751     ben_ldc_shd.g_old_rec.ldc_attribute28;
752   End If;
753   If (p_rec.ldc_attribute29 = hr_api.g_varchar2) then
754     p_rec.ldc_attribute29 :=
755     ben_ldc_shd.g_old_rec.ldc_attribute29;
756   End If;
757   If (p_rec.ldc_attribute30 = hr_api.g_varchar2) then
758     p_rec.ldc_attribute30 :=
759     ben_ldc_shd.g_old_rec.ldc_attribute30;
760   End If;
761   If (p_rec.susp_if_ctfn_not_prvd_flag = hr_api.g_varchar2) then
762     p_rec.susp_if_ctfn_not_prvd_flag :=
763     ben_ldc_shd.g_old_rec.susp_if_ctfn_not_prvd_flag;
764   End If;
765   If (p_rec.ctfn_determine_cd = hr_api.g_varchar2) then
766     p_rec.ctfn_determine_cd :=
767     ben_ldc_shd.g_old_rec.ctfn_determine_cd;
768   End If;
769 
770   --
771   hr_utility.set_location(' Leaving:'||l_proc, 10);
772 --
773 End convert_defs;
774 --
775 -- ----------------------------------------------------------------------------
776 -- |---------------------------------< upd >----------------------------------|
777 -- ----------------------------------------------------------------------------
778 Procedure upd
779   (
780   p_rec			in out nocopy 	ben_ldc_shd.g_rec_type,
781   p_effective_date	in 	date,
782   p_datetrack_mode	in 	varchar2
783   ) is
784 --
785   l_proc			varchar2(72) := g_package||'upd';
786   l_validation_start_date	date;
787   l_validation_end_date		date;
788 --
789 Begin
790   hr_utility.set_location('Entering:'||l_proc, 5);
791   --
792   -- Ensure that the DateTrack update mode is valid
793   --
794   dt_api.validate_dt_upd_mode(p_datetrack_mode => p_datetrack_mode);
795   --
796   -- We must lock the row which we need to update.
797   --
798   ben_ldc_shd.lck
799 	(p_effective_date	 => p_effective_date,
800       	 p_datetrack_mode	 => p_datetrack_mode,
801       	 p_ler_chg_dpnt_cvg_id	 => p_rec.ler_chg_dpnt_cvg_id,
802       	 p_object_version_number => p_rec.object_version_number,
803       	 p_validation_start_date => l_validation_start_date,
804       	 p_validation_end_date	 => l_validation_end_date);
805   --
806   -- 1. During an update system defaults are used to determine if
807   --    arguments have been defaulted or not. We must therefore
808   --    derive the full record structure values to be updated.
809   --
810   -- 2. Call the supporting update validate operations.
811   --
812   convert_defs(p_rec);
813   ben_ldc_bus.update_validate
814 	(p_rec			 => p_rec,
815 	 p_effective_date	 => p_effective_date,
816 	 p_datetrack_mode  	 => p_datetrack_mode,
817 	 p_validation_start_date => l_validation_start_date,
818 	 p_validation_end_date	 => l_validation_end_date);
819   --
820   -- Call the supporting pre-update operation
821   --
822   pre_update
823 	(p_rec			 => p_rec,
824 	 p_effective_date	 => p_effective_date,
825 	 p_datetrack_mode	 => p_datetrack_mode,
826 	 p_validation_start_date => l_validation_start_date,
827 	 p_validation_end_date	 => l_validation_end_date);
828   --
829   -- Update the row.
830   --
831   update_dml
832 	(p_rec			 => p_rec,
833 	 p_effective_date	 => p_effective_date,
834 	 p_datetrack_mode	 => p_datetrack_mode,
835 	 p_validation_start_date => l_validation_start_date,
836 	 p_validation_end_date	 => l_validation_end_date);
837   --
838   -- Call the supporting post-update operation
839   --
840   post_update
841 	(p_rec			 => p_rec,
842 	 p_effective_date	 => p_effective_date,
843 	 p_datetrack_mode	 => p_datetrack_mode,
844 	 p_validation_start_date => l_validation_start_date,
845 	 p_validation_end_date	 => l_validation_end_date);
846 End upd;
847 --
848 -- ----------------------------------------------------------------------------
849 -- |---------------------------------< upd >----------------------------------|
850 -- ----------------------------------------------------------------------------
851 Procedure upd
852   (
853   p_ler_chg_dpnt_cvg_id          in number,
854   p_effective_start_date         out nocopy date,
855   p_effective_end_date           out nocopy date,
856   p_pl_id                        in number           default hr_api.g_number,
857   p_pgm_id                       in number           default hr_api.g_number,
858   p_business_group_id            in number           default hr_api.g_number,
859   p_ler_id                       in number           default hr_api.g_number,
860   p_ptip_id                      in number           default hr_api.g_number,
861   p_add_rmv_cvg_cd               in varchar2         default hr_api.g_varchar2,
862   p_cvg_eff_end_cd               in varchar2         default hr_api.g_varchar2,
863   p_cvg_eff_strt_cd              in varchar2         default hr_api.g_varchar2,
864   p_ler_chg_dpnt_cvg_rl          in number           default hr_api.g_number,
865   p_ler_chg_dpnt_cvg_cd          in varchar2         default hr_api.g_varchar2,
866   p_cvg_eff_strt_rl              in number           default hr_api.g_number,
867   p_cvg_eff_end_rl               in number           default hr_api.g_number,
868   p_ldc_attribute_category       in varchar2         default hr_api.g_varchar2,
869   p_ldc_attribute1               in varchar2         default hr_api.g_varchar2,
870   p_ldc_attribute2               in varchar2         default hr_api.g_varchar2,
871   p_ldc_attribute3               in varchar2         default hr_api.g_varchar2,
872   p_ldc_attribute4               in varchar2         default hr_api.g_varchar2,
873   p_ldc_attribute5               in varchar2         default hr_api.g_varchar2,
874   p_ldc_attribute6               in varchar2         default hr_api.g_varchar2,
875   p_ldc_attribute7               in varchar2         default hr_api.g_varchar2,
876   p_ldc_attribute8               in varchar2         default hr_api.g_varchar2,
877   p_ldc_attribute9               in varchar2         default hr_api.g_varchar2,
878   p_ldc_attribute10              in varchar2         default hr_api.g_varchar2,
879   p_ldc_attribute11              in varchar2         default hr_api.g_varchar2,
880   p_ldc_attribute12              in varchar2         default hr_api.g_varchar2,
881   p_ldc_attribute13              in varchar2         default hr_api.g_varchar2,
882   p_ldc_attribute14              in varchar2         default hr_api.g_varchar2,
883   p_ldc_attribute15              in varchar2         default hr_api.g_varchar2,
884   p_ldc_attribute16              in varchar2         default hr_api.g_varchar2,
885   p_ldc_attribute17              in varchar2         default hr_api.g_varchar2,
886   p_ldc_attribute18              in varchar2         default hr_api.g_varchar2,
887   p_ldc_attribute19              in varchar2         default hr_api.g_varchar2,
888   p_ldc_attribute20              in varchar2         default hr_api.g_varchar2,
889   p_ldc_attribute21              in varchar2         default hr_api.g_varchar2,
890   p_ldc_attribute22              in varchar2         default hr_api.g_varchar2,
891   p_ldc_attribute23              in varchar2         default hr_api.g_varchar2,
892   p_ldc_attribute24              in varchar2         default hr_api.g_varchar2,
893   p_ldc_attribute25              in varchar2         default hr_api.g_varchar2,
894   p_ldc_attribute26              in varchar2         default hr_api.g_varchar2,
895   p_ldc_attribute27              in varchar2         default hr_api.g_varchar2,
896   p_ldc_attribute28              in varchar2         default hr_api.g_varchar2,
897   p_ldc_attribute29              in varchar2         default hr_api.g_varchar2,
898   p_ldc_attribute30              in varchar2         default hr_api.g_varchar2,
899   p_susp_if_ctfn_not_prvd_flag   in varchar2         default hr_api.g_varchar2,
900   p_ctfn_determine_cd            in varchar2         default hr_api.g_varchar2,
901   p_object_version_number        in out nocopy number,
902   p_effective_date		 in date,
903   p_datetrack_mode		 in varchar2
904   ) is
905 --
906   l_rec		ben_ldc_shd.g_rec_type;
907   l_proc	varchar2(72) := g_package||'upd';
908 --
909 Begin
910   hr_utility.set_location('Entering:'||l_proc, 5);
911   --
912   -- Call conversion function to turn arguments into the
913   -- l_rec structure.
914   --
915   l_rec :=
916   ben_ldc_shd.convert_args
917   (
918   p_ler_chg_dpnt_cvg_id,
919   null,
920   null,
921   p_pl_id,
922   p_pgm_id,
923   p_business_group_id,
924   p_ler_id,
925   p_ptip_id,
926   p_add_rmv_cvg_cd,
927   p_cvg_eff_end_cd,
928   p_cvg_eff_strt_cd,
929   p_ler_chg_dpnt_cvg_rl,
930   p_ler_chg_dpnt_cvg_cd,
931   p_cvg_eff_strt_rl,
932   p_cvg_eff_end_rl,
933   p_ldc_attribute_category,
934   p_ldc_attribute1,
935   p_ldc_attribute2,
936   p_ldc_attribute3,
937   p_ldc_attribute4,
938   p_ldc_attribute5,
939   p_ldc_attribute6,
940   p_ldc_attribute7,
941   p_ldc_attribute8,
942   p_ldc_attribute9,
943   p_ldc_attribute10,
944   p_ldc_attribute11,
945   p_ldc_attribute12,
946   p_ldc_attribute13,
947   p_ldc_attribute14,
948   p_ldc_attribute15,
949   p_ldc_attribute16,
950   p_ldc_attribute17,
951   p_ldc_attribute18,
952   p_ldc_attribute19,
953   p_ldc_attribute20,
954   p_ldc_attribute21,
955   p_ldc_attribute22,
956   p_ldc_attribute23,
957   p_ldc_attribute24,
958   p_ldc_attribute25,
959   p_ldc_attribute26,
960   p_ldc_attribute27,
961   p_ldc_attribute28,
962   p_ldc_attribute29,
963   p_ldc_attribute30,
964   p_susp_if_ctfn_not_prvd_flag,
965   p_ctfn_determine_cd,
966   p_object_version_number
967   );
968   --
969   -- Having converted the arguments into the
970   -- plsql record structure we call the corresponding record
971   -- business process.
972   --
973   upd(l_rec, p_effective_date, p_datetrack_mode);
974   p_object_version_number       := l_rec.object_version_number;
975   p_effective_start_date        := l_rec.effective_start_date;
976   p_effective_end_date          := l_rec.effective_end_date;
977   --
978   --
979   hr_utility.set_location(' Leaving:'||l_proc, 10);
980 End upd;
981 --
982 end ben_ldc_upd;