[Home] [Help]
PACKAGE BODY: APPS.BEN_VEP_SHD
Source
1 Package Body ben_vep_shd as
2 /* $Header: beveprhi.pkb 120.0.12010000.2 2008/08/05 15:33:44 ubhat ship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- | Private Global Definitions |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package varchar2(33) := ' ben_vep_shd.'; -- Global package name
9 --
10 -- ----------------------------------------------------------------------------
11 -- |------------------------< return_api_dml_status >-------------------------|
12 -- ----------------------------------------------------------------------------
13 Function return_api_dml_status Return Boolean Is
14 --
15 Begin
16 --
17 Return (nvl(g_api_dml, false));
18 --
19 End return_api_dml_status;
20 --
21 -- ----------------------------------------------------------------------------
22 -- |---------------------------< constraint_error >---------------------------|
23 -- ----------------------------------------------------------------------------
24 Procedure constraint_error
25 (p_constraint_name in all_constraints.constraint_name%TYPE
26 ) Is
27 --
28 l_proc varchar2(72) := g_package||'constraint_error';
29 --
30 Begin
31 --
32 If (p_constraint_name = 'BEN_VRBL_RT_ELIG_PRFL_F_PK') Then
33 fnd_message.set_name('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
34 fnd_message.set_token('PROCEDURE', l_proc);
35 fnd_message.set_token('STEP','5');
36 fnd_message.raise_error;
37 Else
38 fnd_message.set_name('PAY', 'HR_7877_API_INVALID_CONSTRAINT');
39 fnd_message.set_token('PROCEDURE', l_proc);
40 fnd_message.set_token('CONSTRAINT_NAME', p_constraint_name);
41 fnd_message.raise_error;
42 End If;
43 --
44 End constraint_error;
45 --
46 -- ----------------------------------------------------------------------------
47 -- |-----------------------------< api_updating >-----------------------------|
48 -- ----------------------------------------------------------------------------
49 Function api_updating
50 (p_effective_date in date
51 ,p_vrbl_rt_elig_prfl_id in number
52 ,p_object_version_number in number
53 ) Return Boolean Is
54 --
55 -- Cursor selects the 'current' row from the HR Schema
56 --
57 Cursor C_Sel1 is
58 select
59 vrbl_rt_elig_prfl_id
60 ,effective_start_date
61 ,effective_end_date
62 ,business_group_id
63 ,vrbl_rt_prfl_id
64 ,eligy_prfl_id
65 ,mndtry_flag
66 ,vep_attribute_category
67 ,vep_attribute1
68 ,vep_attribute2
69 ,vep_attribute3
70 ,vep_attribute4
71 ,vep_attribute5
72 ,vep_attribute6
73 ,vep_attribute7
74 ,vep_attribute8
75 ,vep_attribute9
76 ,vep_attribute10
77 ,vep_attribute11
78 ,vep_attribute12
79 ,vep_attribute13
80 ,vep_attribute14
81 ,vep_attribute15
82 ,vep_attribute16
83 ,vep_attribute17
84 ,vep_attribute18
85 ,vep_attribute19
86 ,vep_attribute20
87 ,vep_attribute21
88 ,vep_attribute22
89 ,vep_attribute23
90 ,vep_attribute24
91 ,vep_attribute25
92 ,vep_attribute26
93 ,vep_attribute27
94 ,vep_attribute28
95 ,vep_attribute29
96 ,vep_attribute30
97 ,object_version_number
98 from BEN_VRBL_RT_ELIG_PRFL_f
99 where vrbl_rt_elig_prfl_id = p_vrbl_rt_elig_prfl_id
100 and p_effective_date
101 between effective_start_date and effective_end_date;
102 --
103 l_fct_ret boolean;
104 --
105 Begin
106 --
107 If (p_effective_date is null or
108 p_vrbl_rt_elig_prfl_id is null or
109 p_object_version_number is null) Then
110 --
111 -- One of the primary key arguments is null therefore we must
112 -- set the returning function value to false
113 --
114 l_fct_ret := false;
115 Else
116 If (p_vrbl_rt_elig_prfl_id =
117 ben_vep_shd.g_old_rec.vrbl_rt_elig_prfl_id and
118 p_object_version_number =
119 ben_vep_shd.g_old_rec.object_version_number) Then
120 --
121 -- The g_old_rec is current therefore we must
122 -- set the returning function to true
123 --
124 l_fct_ret := true;
125 Else
126 --
127 -- Select the current row
128 --
129 Open C_Sel1;
130 Fetch C_Sel1 Into ben_vep_shd.g_old_rec;
131 If C_Sel1%notfound Then
132 Close C_Sel1;
133 --
134 -- The primary key is invalid therefore we must error
135 --
136 fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
137 fnd_message.raise_error;
138 End If;
139 Close C_Sel1;
140 If (p_object_version_number
141 <> ben_vep_shd.g_old_rec.object_version_number) Then
142 fnd_message.set_name('PAY', 'HR_7155_OBJECT_INVALID');
143 fnd_message.raise_error;
144 End If;
145 l_fct_ret := true;
146 End If;
147 End If;
148 Return (l_fct_ret);
149 --
150 End api_updating;
151 --
152 -- ----------------------------------------------------------------------------
153 -- |---------------------------< find_dt_upd_modes >--------------------------|
154 -- ----------------------------------------------------------------------------
155 Procedure find_dt_upd_modes
156 (p_effective_date in date
157 ,p_base_key_value in number
158 ,p_correction out nocopy boolean
159 ,p_update out nocopy boolean
160 ,p_update_override out nocopy boolean
161 ,p_update_change_insert out nocopy boolean
162 ) is
163 --
164 l_proc varchar2(72) := g_package||'find_dt_upd_modes';
165 --
166 Begin
167 hr_utility.set_location('Entering:'||l_proc, 5);
168 --
169 -- Call the corresponding datetrack api
170 --
171 dt_api.find_dt_upd_modes
172 (p_effective_date => p_effective_date
173 ,p_base_table_name => 'BEN_VRBL_RT_ELIG_PRFL_f'
174 ,p_base_key_column => 'VRBL_RT_ELIG_PRFL_ID'
175 ,p_base_key_value => p_base_key_value
176 ,p_correction => p_correction
177 ,p_update => p_update
178 ,p_update_override => p_update_override
179 ,p_update_change_insert => p_update_change_insert
180 );
181 --
182 hr_utility.set_location(' Leaving:'||l_proc, 10);
183 End find_dt_upd_modes;
184 --
185 -- ----------------------------------------------------------------------------
186 -- |---------------------------< find_dt_del_modes >--------------------------|
187 -- ----------------------------------------------------------------------------
188 Procedure find_dt_del_modes
189 (p_effective_date in date
190 ,p_base_key_value in number
191 ,p_zap out nocopy boolean
192 ,p_delete out nocopy boolean
193 ,p_future_change out nocopy boolean
194 ,p_delete_next_change out nocopy boolean
195 ) is
196 --
197 l_proc varchar2(72) := g_package||'find_dt_del_modes';
198 --
199 l_parent_key_value1 number;
200 l_parent_key_value2 number;
201 l_parent_key_value3 number;
202 --
203 Cursor C_Sel1 Is
204 select
205 t.vrbl_rt_prfl_id
206 ,t.eligy_prfl_id
207 from BEN_VRBL_RT_ELIG_PRFL_f t
208 where t.vrbl_rt_elig_prfl_id = p_base_key_value
209 and p_effective_date
210 between t.effective_start_date and t.effective_end_date;
211 --
212 Begin
213 hr_utility.set_location('Entering:'||l_proc, 5);
214 Open C_sel1;
215 Fetch C_Sel1 Into
216 l_parent_key_value1
217 ,l_parent_key_value2 ;
218 If C_Sel1%NOTFOUND then
219 Close C_Sel1;
220 fnd_message.set_name('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
221 fnd_message.set_token('PROCEDURE',l_proc);
222 fnd_message.set_token('STEP','10');
223 fnd_message.raise_error;
224 End If;
225 Close C_Sel1;
226 --
227 -- Call the corresponding datetrack api
228 --
229 dt_api.find_dt_del_modes
230 (p_effective_date => p_effective_date
231 ,p_base_table_name => 'BEN_VRBL_RT_ELIG_PRFL_f'
232 ,p_base_key_column => 'VRBL_RT_ELIG_PRFL_ID'
233 ,p_base_key_value => p_base_key_value
234 ,p_parent_table_name1 => 'BEN_VRBL_RT_PRFL_F'
235 ,p_parent_key_column1 => 'VRBL_RT_PRFL_ID'
236 ,p_parent_key_value1 => l_parent_key_value1
237 ,p_parent_table_name2 => 'BEN_ELIGY_PRFL_F'
238 ,p_parent_key_column2 => 'ELIGY_PRFL_ID'
239 ,p_parent_key_value2 => l_parent_key_value2
240 ,p_zap => p_zap
241 ,p_delete => p_delete
242 ,p_future_change => p_future_change
243 ,p_delete_next_change => p_delete_next_change
244 );
245 --
246 hr_utility.set_location(' Leaving:'||l_proc, 10);
247 End find_dt_del_modes;
248 --
249 -- ----------------------------------------------------------------------------
250 -- |-----------------------< upd_effective_end_date >-------------------------|
251 -- ----------------------------------------------------------------------------
252 Procedure upd_effective_end_date
253 (p_effective_date in date
254 ,p_base_key_value in number
255 ,p_new_effective_end_date in date
256 ,p_validation_start_date in date
257 ,p_validation_end_date in date
258 ,p_object_version_number out nocopy number
259 ) is
260 --
261 l_proc varchar2(72) := g_package||'upd_effective_end_date';
262 l_object_version_number number;
263 --
264 Begin
265 hr_utility.set_location('Entering:'||l_proc, 5);
266 --
267 -- Because we are updating a row we must get the next object
268 -- version number.
269 --
270 l_object_version_number :=
271 dt_api.get_object_version_number
272 (p_base_table_name => 'BEN_VRBL_RT_ELIG_PRFL_f'
273 ,p_base_key_column => 'VRBL_RT_ELIG_PRFL_ID'
274 ,p_base_key_value => p_base_key_value
275 );
276 --
277 hr_utility.set_location(l_proc, 10);
278 ben_vep_shd.g_api_dml := true; -- Set the api dml status
279 --
280 -- Update the specified datetrack row setting the effective
281 -- end date to the specified new effective end date.
282 --
283 update BEN_VRBL_RT_ELIG_PRFL_f t
284 set t.effective_end_date = p_new_effective_end_date
285 , t.object_version_number = l_object_version_number
286 where t.vrbl_rt_elig_prfl_id = p_base_key_value
287 and p_effective_date
288 between t.effective_start_date and t.effective_end_date;
289 --
290 ben_vep_shd.g_api_dml := false; -- Unset the api dml status
291 p_object_version_number := l_object_version_number;
292 hr_utility.set_location(' Leaving:'||l_proc, 15);
293 --
294 Exception
295 When Others Then
296 ben_vep_shd.g_api_dml := false; -- Unset the api dml status
297 Raise;
298 --
299 End upd_effective_end_date;
300 --
301 -- ----------------------------------------------------------------------------
302 -- |---------------------------------< lck >----------------------------------|
303 -- ----------------------------------------------------------------------------
304 Procedure lck
305 (p_effective_date in date
306 ,p_datetrack_mode in varchar2
307 ,p_vrbl_rt_elig_prfl_id in number
308 ,p_object_version_number in number
309 ,p_validation_start_date out nocopy date
310 ,p_validation_end_date out nocopy date
311 ) is
312 --
313 l_proc varchar2(72) := g_package||'lck';
314 l_validation_start_date date;
315 l_validation_end_date date;
316 l_argument varchar2(30);
317 --
318 -- Cursor C_Sel1 selects the current locked row as of session date
319 -- ensuring that the object version numbers match.
320 --
321 Cursor C_Sel1 is
322 select
323 vrbl_rt_elig_prfl_id
324 ,effective_start_date
325 ,effective_end_date
326 ,business_group_id
327 ,vrbl_rt_prfl_id
328 ,eligy_prfl_id
329 ,mndtry_flag
330 ,vep_attribute_category
331 ,vep_attribute1
332 ,vep_attribute2
333 ,vep_attribute3
334 ,vep_attribute4
335 ,vep_attribute5
336 ,vep_attribute6
337 ,vep_attribute7
338 ,vep_attribute8
339 ,vep_attribute9
340 ,vep_attribute10
341 ,vep_attribute11
342 ,vep_attribute12
343 ,vep_attribute13
344 ,vep_attribute14
345 ,vep_attribute15
346 ,vep_attribute16
347 ,vep_attribute17
348 ,vep_attribute18
349 ,vep_attribute19
350 ,vep_attribute20
351 ,vep_attribute21
352 ,vep_attribute22
353 ,vep_attribute23
354 ,vep_attribute24
355 ,vep_attribute25
356 ,vep_attribute26
357 ,vep_attribute27
358 ,vep_attribute28
359 ,vep_attribute29
360 ,vep_attribute30
361 ,object_version_number
362 from BEN_VRBL_RT_ELIG_PRFL_f
363 where vrbl_rt_elig_prfl_id = p_vrbl_rt_elig_prfl_id
364 and p_effective_date
365 between effective_start_date and effective_end_date
366 for update nowait;
367 --
368 --
369 --
370 Begin
371 hr_utility.set_location('Entering:'||l_proc, 5);
372 --
373 -- Ensure that all the mandatory arguments are not null
374 --
375 hr_api.mandatory_arg_error(p_api_name => l_proc
376 ,p_argument => 'effective_date'
377 ,p_argument_value => p_effective_date
378 );
379 --
380 hr_api.mandatory_arg_error(p_api_name => l_proc
381 ,p_argument => 'datetrack_mode'
382 ,p_argument_value => p_datetrack_mode
383 );
384 --
385 hr_api.mandatory_arg_error(p_api_name => l_proc
386 ,p_argument => 'VRBL_RT_ELIG_PRFL_ID'
387 ,p_argument_value => p_vrbl_rt_elig_prfl_id
388 );
389 --
393 );
390 hr_api.mandatory_arg_error(p_api_name => l_proc
391 ,p_argument => 'object_version_number'
392 ,p_argument_value => p_object_version_number
394 --
395 -- Check to ensure the datetrack mode is not INSERT.
396 --
397 If (p_datetrack_mode <> hr_api.g_insert) then
398 --
399 -- We must select and lock the current row.
400 --
401 Open C_Sel1;
402 Fetch C_Sel1 Into ben_vep_shd.g_old_rec;
403 If C_Sel1%notfound then
404 Close C_Sel1;
405 --
406 -- The primary key is invalid therefore we must error
407 --
408 fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
409 fnd_message.raise_error;
410 End If;
411 Close C_Sel1;
412 If (p_object_version_number
413 <> ben_vep_shd.g_old_rec.object_version_number) Then
414 fnd_message.set_name('PAY', 'HR_7155_OBJECT_INVALID');
415 fnd_message.raise_error;
416 End If;
417 --
418 --
419 -- Validate the datetrack mode mode getting the validation start
420 -- and end dates for the specified datetrack operation.
421 --
422 dt_api.validate_dt_mode
423 (p_effective_date => p_effective_date
424 ,p_datetrack_mode => p_datetrack_mode
425 ,p_base_table_name => 'BEN_VRBL_RT_ELIG_PRFL_f'
426 ,p_base_key_column => 'VRBL_RT_ELIG_PRFL_ID'
427 ,p_base_key_value => p_vrbl_rt_elig_prfl_id
428 ,p_parent_table_name1 => 'BEN_VRBL_RT_PRFL_F'
429 ,p_parent_key_column1 => 'VRBL_RT_PRFL_ID'
430 ,p_parent_key_value1 => ben_vep_shd.g_old_rec.vrbl_rt_prfl_id
431 ,p_parent_table_name2 => 'BEN_ELIGY_PRFL_F'
432 ,p_parent_key_column2 => 'ELIGY_PRFL_ID'
433 ,p_parent_key_value2 => ben_vep_shd.g_old_rec.eligy_prfl_id
434 ,p_enforce_foreign_locking => false --true
435 ,p_validation_start_date => l_validation_start_date
436 ,p_validation_end_date => l_validation_end_date
437 );
438 Else
439 --
440 -- We are doing a datetrack 'INSERT' which is illegal within this
441 -- procedure therefore we must error (note: to lck on insert the
442 -- private procedure ins_lck should be called).
443 --
444 fnd_message.set_name('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
445 fnd_message.set_token('PROCEDURE', l_proc);
446 fnd_message.set_token('STEP','20');
447 fnd_message.raise_error;
448 End If;
449 --
450 -- Set the validation start and end date OUT arguments
451 --
452 p_validation_start_date := l_validation_start_date;
453 p_validation_end_date := l_validation_end_date;
454 --
455 hr_utility.set_location(' Leaving:'||l_proc, 30);
456 --
457 -- We need to trap the ORA LOCK exception
458 --
459 Exception
460 When HR_Api.Object_Locked then
461 --
462 -- The object is locked therefore we need to supply a meaningful
463 -- error message.
464 --
465 fnd_message.set_name('PAY', 'HR_7165_OBJECT_LOCKED');
466 fnd_message.set_token('TABLE_NAME', 'BEN_VRBL_RT_ELIG_PRFL_f');
467 fnd_message.raise_error;
468 End lck;
469 --
470 -- ----------------------------------------------------------------------------
471 -- |-----------------------------< convert_args >-----------------------------|
472 -- ----------------------------------------------------------------------------
473 Function convert_args
474 (p_vrbl_rt_elig_prfl_id in number
475 ,p_effective_start_date in date
476 ,p_effective_end_date in date
477 ,p_business_group_id in number
478 ,p_vrbl_rt_prfl_id in number
479 ,p_eligy_prfl_id in number
480 ,p_mndtry_flag in varchar2
481 ,p_vep_attribute_category in varchar2
482 ,p_vep_attribute1 in varchar2
483 ,p_vep_attribute2 in varchar2
484 ,p_vep_attribute3 in varchar2
485 ,p_vep_attribute4 in varchar2
486 ,p_vep_attribute5 in varchar2
487 ,p_vep_attribute6 in varchar2
488 ,p_vep_attribute7 in varchar2
489 ,p_vep_attribute8 in varchar2
490 ,p_vep_attribute9 in varchar2
491 ,p_vep_attribute10 in varchar2
492 ,p_vep_attribute11 in varchar2
493 ,p_vep_attribute12 in varchar2
494 ,p_vep_attribute13 in varchar2
495 ,p_vep_attribute14 in varchar2
496 ,p_vep_attribute15 in varchar2
497 ,p_vep_attribute16 in varchar2
498 ,p_vep_attribute17 in varchar2
499 ,p_vep_attribute18 in varchar2
500 ,p_vep_attribute19 in varchar2
501 ,p_vep_attribute20 in varchar2
502 ,p_vep_attribute21 in varchar2
503 ,p_vep_attribute22 in varchar2
504 ,p_vep_attribute23 in varchar2
505 ,p_vep_attribute24 in varchar2
506 ,p_vep_attribute25 in varchar2
507 ,p_vep_attribute26 in varchar2
508 ,p_vep_attribute27 in varchar2
509 ,p_vep_attribute28 in varchar2
510 ,p_vep_attribute29 in varchar2
511 ,p_vep_attribute30 in varchar2
512 ,p_object_version_number in number
513 )
514 Return g_rec_type is
515 --
516 l_rec g_rec_type;
517 --
518 Begin
519 --
520 -- Convert arguments into local l_rec structure.
521 --
522 l_rec.vrbl_rt_elig_prfl_id := p_vrbl_rt_elig_prfl_id;
523 l_rec.effective_start_date := p_effective_start_date;
524 l_rec.effective_end_date := p_effective_end_date;
525 l_rec.business_group_id := p_business_group_id;
526 l_rec.vrbl_rt_prfl_id := p_vrbl_rt_prfl_id;
527 l_rec.eligy_prfl_id := p_eligy_prfl_id;
528 l_rec.mndtry_flag := p_mndtry_flag;
529 l_rec.vep_attribute_category := p_vep_attribute_category;
530 l_rec.vep_attribute1 := p_vep_attribute1;
531 l_rec.vep_attribute2 := p_vep_attribute2;
532 l_rec.vep_attribute3 := p_vep_attribute3;
533 l_rec.vep_attribute4 := p_vep_attribute4;
534 l_rec.vep_attribute5 := p_vep_attribute5;
535 l_rec.vep_attribute6 := p_vep_attribute6;
536 l_rec.vep_attribute7 := p_vep_attribute7;
537 l_rec.vep_attribute8 := p_vep_attribute8;
538 l_rec.vep_attribute9 := p_vep_attribute9;
539 l_rec.vep_attribute10 := p_vep_attribute10;
540 l_rec.vep_attribute11 := p_vep_attribute11;
541 l_rec.vep_attribute12 := p_vep_attribute12;
542 l_rec.vep_attribute13 := p_vep_attribute13;
543 l_rec.vep_attribute14 := p_vep_attribute14;
544 l_rec.vep_attribute15 := p_vep_attribute15;
545 l_rec.vep_attribute16 := p_vep_attribute16;
546 l_rec.vep_attribute17 := p_vep_attribute17;
547 l_rec.vep_attribute18 := p_vep_attribute18;
548 l_rec.vep_attribute19 := p_vep_attribute19;
549 l_rec.vep_attribute20 := p_vep_attribute20;
550 l_rec.vep_attribute21 := p_vep_attribute21;
551 l_rec.vep_attribute22 := p_vep_attribute22;
552 l_rec.vep_attribute23 := p_vep_attribute23;
553 l_rec.vep_attribute24 := p_vep_attribute24;
554 l_rec.vep_attribute25 := p_vep_attribute25;
555 l_rec.vep_attribute26 := p_vep_attribute26;
556 l_rec.vep_attribute27 := p_vep_attribute27;
557 l_rec.vep_attribute28 := p_vep_attribute28;
558 l_rec.vep_attribute29 := p_vep_attribute29;
559 l_rec.vep_attribute30 := p_vep_attribute30;
560 l_rec.object_version_number := p_object_version_number;
561 --
562 -- Return the plsql record structure.
563 --
564 Return(l_rec);
565 --
566 End convert_args;
567 --
568 end ben_vep_shd;