[Home] [Help]
PACKAGE BODY: APPS.BEN_DCO_SHD
Source
1 Package Body ben_dco_shd as
2 /* $Header: bedcorhi.pkb 120.2 2006/03/30 23:58:46 gsehgal noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- | Private Global Definitions |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package varchar2(33) := ' ben_dco_shd.'; -- Global package name
9 --
10 -- ----------------------------------------------------------------------------
11 -- |------------------------< return_api_dml_status >-------------------------|
12 -- ----------------------------------------------------------------------------
13 Function return_api_dml_status Return Boolean Is
14 --
15 l_proc varchar2(72) := g_package||'return_api_dml_status';
16 --
17 Begin
18 hr_utility.set_location('Entering:'||l_proc, 5);
19 --
20 Return (nvl(g_api_dml, false));
21 --
22 hr_utility.set_location(' Leaving:'||l_proc, 10);
23 End return_api_dml_status;
24 --
25 -- ----------------------------------------------------------------------------
26 -- |---------------------------< constraint_error >---------------------------|
27 -- ----------------------------------------------------------------------------
28 Procedure constraint_error
29 (p_constraint_name in all_constraints.constraint_name%TYPE) Is
30 --
31 l_proc varchar2(72) := g_package||'constraint_error';
32 --
33 Begin
34 hr_utility.set_location('Entering:'||l_proc, 5);
35 --
36 If (p_constraint_name = 'BEN_DPNT_CVRD_OTHR_PTIP_F_PK') Then
37 fnd_message.set_name('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
38 fnd_message.set_token('PROCEDURE', l_proc);
39 fnd_message.set_token('STEP','5');
40 fnd_message.raise_error;
41 Else
42 fnd_message.set_name('PAY', 'HR_7877_API_INVALID_CONSTRAINT');
43 fnd_message.set_token('PROCEDURE', l_proc);
44 fnd_message.set_token('CONSTRAINT_NAME', p_constraint_name);
45 fnd_message.raise_error;
46 End If;
47 --
48 hr_utility.set_location(' Leaving:'||l_proc, 10);
49 End constraint_error;
50 --
51 -- ----------------------------------------------------------------------------
52 -- |-----------------------------< api_updating >-----------------------------|
53 -- ----------------------------------------------------------------------------
54 Function api_updating
55 (p_effective_date in date,
56 p_dpnt_cvrd_othr_ptip_rt_id in number,
60 --
57 p_object_version_number in number
58 ) Return Boolean Is
59 --
61 -- Cursor selects the 'current' row from the HR Schema
62 --
63 Cursor C_Sel1 is
64 select
65 dpnt_cvrd_othr_ptip_rt_id,
66 effective_start_date,
67 effective_end_date,
68 excld_flag,
69 ordr_num,
70 enrl_det_dt_cd,
71 only_pls_subj_cobra_flag,
72 ptip_id,
73 vrbl_rt_prfl_id,
74 business_group_id,
75 dco_attribute_category,
76 dco_attribute1,
77 dco_attribute2,
78 dco_attribute3,
79 dco_attribute4,
80 dco_attribute5,
81 dco_attribute6,
82 dco_attribute7,
83 dco_attribute8,
84 dco_attribute9,
85 dco_attribute10,
86 dco_attribute11,
87 dco_attribute12,
88 dco_attribute13,
89 dco_attribute14,
90 dco_attribute15,
91 dco_attribute16,
92 dco_attribute17,
93 dco_attribute18,
94 dco_attribute19,
95 dco_attribute20,
96 dco_attribute21,
97 dco_attribute22,
98 dco_attribute23,
99 dco_attribute24,
100 dco_attribute25,
101 dco_attribute26,
102 dco_attribute27,
103 dco_attribute28,
104 dco_attribute29,
105 dco_attribute30,
106 object_version_number
107 from ben_dpnt_cvrd_othr_ptip_rt_f
108 where dpnt_cvrd_othr_ptip_rt_id = p_dpnt_cvrd_othr_ptip_rt_id
109 and p_effective_date
110 between effective_start_date and effective_end_date;
111 --
112 l_proc varchar2(72) := g_package||'api_updating';
113 l_fct_ret boolean;
114 --
115 Begin
116 hr_utility.set_location('Entering:'||l_proc, 5);
117 --
118 If (p_effective_date is null or
119 p_dpnt_cvrd_othr_ptip_rt_id is null or
120 p_object_version_number is null) Then
121 --
122 -- One of the primary key arguments is null therefore we must
123 -- set the returning function value to false
124 --
125 l_fct_ret := false;
126 Else
127 If (p_dpnt_cvrd_othr_ptip_rt_id = g_old_rec.dpnt_cvrd_othr_ptip_rt_id and
128 p_object_version_number = g_old_rec.object_version_number) Then
129 hr_utility.set_location(l_proc, 10);
130 --
131 -- The g_old_rec is current therefore we must
132 -- set the returning function to true
133 --
134 l_fct_ret := true;
135 Else
136 --
137 -- Select the current row
138 --
139 Open C_Sel1;
140 Fetch C_Sel1 Into g_old_rec;
141 If C_Sel1%notfound Then
142 Close C_Sel1;
143 --
144 -- The primary key is invalid therefore we must error
145 --
146 fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
147 fnd_message.raise_error;
148 End If;
149 Close C_Sel1;
150 If (p_object_version_number <> g_old_rec.object_version_number) Then
151 fnd_message.set_name('PAY', 'HR_7155_OBJECT_INVALID');
152 fnd_message.raise_error;
153 End If;
154 hr_utility.set_location(l_proc, 15);
155 l_fct_ret := true;
156 End If;
157 End If;
158 hr_utility.set_location(' Leaving:'||l_proc, 20);
159 Return (l_fct_ret);
160 --
161 End api_updating;
162 --
163 -- ----------------------------------------------------------------------------
164 -- |--------------------------< find_dt_del_modes >---------------------------|
165 -- ----------------------------------------------------------------------------
166 Procedure find_dt_del_modes
167 (p_effective_date in date,
168 p_base_key_value in number,
169 p_zap out nocopy boolean,
170 p_delete out nocopy boolean,
171 p_future_change out nocopy boolean,
172 p_delete_next_change out nocopy boolean) is
173 --
174 l_proc varchar2(72) := g_package||'find_dt_del_modes';
175 --
176 l_parent_key_value1 number;
177 l_parent_key_value2 number;
178 --
179 Cursor C_Sel1 Is
180 select t.vrbl_rt_prfl_id,
181 t.ptip_id
182 from ben_dpnt_cvrd_othr_ptip_rt_f t
183 where t.dpnt_cvrd_othr_ptip_rt_id = p_base_key_value
184 and p_effective_date
185 between t.effective_start_date and t.effective_end_date;
186 --
187 Begin
188 hr_utility.set_location('Entering:'||l_proc, 5);
189 Open C_Sel1;
190 Fetch C_Sel1 Into l_parent_key_value1,
191 l_parent_key_value2;
192 If C_Sel1%notfound then
193 Close C_Sel1;
194 fnd_message.set_name('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
195 fnd_message.set_token('PROCEDURE', l_proc);
196 fnd_message.set_token('STEP','10');
197 fnd_message.raise_error;
198 End If;
199 Close C_Sel1;
200 --
201 -- Call the corresponding datetrack api
202 --
203 dt_api.find_dt_del_modes
204 (p_effective_date => p_effective_date,
205 p_base_table_name => 'ben_dpnt_cvrd_othr_ptip_rt_f',
206 p_base_key_column => 'dpnt_cvrd_othr_ptip_rt_id',
207 p_base_key_value => p_base_key_value,
208 p_parent_table_name1 => 'ben_vrbl_rt_prfl_f',
209 p_parent_key_column1 => 'vrbl_rt_prfl_id',
210 p_parent_key_value1 => l_parent_key_value1,
211 p_parent_table_name2 => 'ben_ptip_f',
212 p_parent_key_column2 => 'ptip_id',
213 p_parent_key_value2 => l_parent_key_value2,
214 p_zap => p_zap,
215 p_delete => p_delete,
216 p_future_change => p_future_change,
217 p_delete_next_change => p_delete_next_change);
218 --
219 hr_utility.set_location(' Leaving:'||l_proc, 10);
220 End find_dt_del_modes;
221 --
225 Procedure find_dt_upd_modes
222 -- ----------------------------------------------------------------------------
223 -- |--------------------------< find_dt_upd_modes >---------------------------|
224 -- ----------------------------------------------------------------------------
226 (p_effective_date in date,
227 p_base_key_value in number,
228 p_correction out nocopy boolean,
229 p_update out nocopy boolean,
230 p_update_override out nocopy boolean,
231 p_update_change_insert out nocopy boolean) is
232 --
233 l_proc varchar2(72) := g_package||'find_dt_upd_modes';
234 --
235 Begin
236 hr_utility.set_location('Entering:'||l_proc, 5);
237 --
238 -- Call the corresponding datetrack api
239 --
240 dt_api.find_dt_upd_modes
241 (p_effective_date => p_effective_date,
242 p_base_table_name => 'ben_dpnt_cvrd_othr_ptip_rt_f',
243 p_base_key_column => 'dpnt_cvrd_othr_ptip_rt_id',
244 p_base_key_value => p_base_key_value,
245 p_correction => p_correction,
246 p_update => p_update,
247 p_update_override => p_update_override,
248 p_update_change_insert => p_update_change_insert);
249 --
250 hr_utility.set_location(' Leaving:'||l_proc, 10);
251 End find_dt_upd_modes;
252 --
253 -- ----------------------------------------------------------------------------
254 -- |------------------------< upd_effective_end_date >------------------------|
255 -- ----------------------------------------------------------------------------
256 Procedure upd_effective_end_date
257 (p_effective_date in date,
258 p_base_key_value in number,
259 p_new_effective_end_date in date,
260 p_validation_start_date in date,
261 p_validation_end_date in date,
262 p_object_version_number out nocopy number) is
263 --
264 l_proc varchar2(72) := g_package||'upd_effective_end_date';
265 l_object_version_number number;
266 --
267 Begin
268 hr_utility.set_location('Entering:'||l_proc, 5);
269 --
270 -- Because we are updating a row we must get the next object
271 -- version number.
272 --
273 l_object_version_number :=
274 dt_api.get_object_version_number
275 (p_base_table_name => 'ben_dpnt_cvrd_othr_ptip_rt_f',
276 p_base_key_column => 'dpnt_cvrd_othr_ptip_rt_id',
277 p_base_key_value => p_base_key_value);
278 --
279 hr_utility.set_location(l_proc, 10);
280 g_api_dml := true; -- Set the api dml status
281 --
282 -- Update the specified datetrack row setting the effective
283 -- end date to the specified new effective end date.
284 --
285 update ben_dpnt_cvrd_othr_ptip_rt_f t
286 set t.effective_end_date = p_new_effective_end_date,
287 t.object_version_number = l_object_version_number
288 where t.dpnt_cvrd_othr_ptip_rt_id = p_base_key_value
289 and p_effective_date
290 between t.effective_start_date and t.effective_end_date;
291 --
292 g_api_dml := false; -- Unset the api dml status
293 p_object_version_number := l_object_version_number;
294 hr_utility.set_location(' Leaving:'||l_proc, 15);
295 --
296 Exception
297 When Others Then
298 g_api_dml := false; -- Unset the api dml status
299 Raise;
300 End upd_effective_end_date;
301 --
302 -- ----------------------------------------------------------------------------
303 -- |---------------------------------< lck >----------------------------------|
304 -- ----------------------------------------------------------------------------
305 Procedure lck
306 (p_effective_date in date,
307 p_datetrack_mode in varchar2,
308 p_dpnt_cvrd_othr_ptip_rt_id in number,
309 p_object_version_number in number,
310 p_validation_start_date out nocopy date,
311 p_validation_end_date out nocopy date) is
312 --
313 l_proc varchar2(72) := g_package||'lck';
314 l_validation_start_date date;
315 l_validation_end_date date;
316 l_object_invalid exception;
317 l_argument varchar2(30);
318 --
319 -- Cursor C_Sel1 selects the current locked row as of session date
320 -- ensuring that the object version numbers match.
321 --
322 Cursor C_Sel1 is
323 select
324 dpnt_cvrd_othr_ptip_rt_id,
325 effective_start_date,
326 effective_end_date,
327 excld_flag,
328 ordr_num,
329 enrl_det_dt_cd,
330 only_pls_subj_cobra_flag,
331 ptip_id,
332 vrbl_rt_prfl_id,
333 business_group_id,
334 dco_attribute_category,
335 dco_attribute1,
336 dco_attribute2,
337 dco_attribute3,
338 dco_attribute4,
339 dco_attribute5,
340 dco_attribute6,
341 dco_attribute7,
342 dco_attribute8,
343 dco_attribute9,
344 dco_attribute10,
345 dco_attribute11,
346 dco_attribute12,
347 dco_attribute13,
348 dco_attribute14,
349 dco_attribute15,
350 dco_attribute16,
351 dco_attribute17,
352 dco_attribute18,
353 dco_attribute19,
354 dco_attribute20,
355 dco_attribute21,
356 dco_attribute22,
357 dco_attribute23,
358 dco_attribute24,
359 dco_attribute25,
360 dco_attribute26,
361 dco_attribute27,
362 dco_attribute28,
363 dco_attribute29,
364 dco_attribute30,
365 object_version_number
366 from ben_dpnt_cvrd_othr_ptip_rt_f
367 where dpnt_cvrd_othr_ptip_rt_id = p_dpnt_cvrd_othr_ptip_rt_id
368 and p_effective_date
369 between effective_start_date and effective_end_date
370 for update nowait;
371 --
372 --
373 --
377 -- Ensure that all the mandatory arguments are not null
374 Begin
375 hr_utility.set_location('Entering:'||l_proc, 5);
376 --
378 --
379 hr_api.mandatory_arg_error(p_api_name => l_proc,
380 p_argument => 'effective_date',
381 p_argument_value => p_effective_date);
382 --
383 hr_api.mandatory_arg_error(p_api_name => l_proc,
384 p_argument => 'datetrack_mode',
385 p_argument_value => p_datetrack_mode);
386 --
387 hr_api.mandatory_arg_error(p_api_name => l_proc,
388 p_argument => 'dpnt_cvrd_othr_ptip_rt_id',
389 p_argument_value => p_dpnt_cvrd_othr_ptip_rt_id);
390 --
391 hr_api.mandatory_arg_error(p_api_name => l_proc,
392 p_argument => 'object_version_number',
393 p_argument_value => p_object_version_number);
394 --
395 -- Check to ensure the datetrack mode is not INSERT.
396 --
397 If (p_datetrack_mode <> 'INSERT') then
398 --
399 -- We must select and lock the current row.
400 --
401 Open C_Sel1;
402 Fetch C_Sel1 Into 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 <> g_old_rec.object_version_number) Then
413 fnd_message.set_name('PAY', 'HR_7155_OBJECT_INVALID');
414 fnd_message.raise_error;
415 End If;
416 hr_utility.set_location(l_proc, 15);
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_dpnt_cvrd_othr_ptip_rt_f',
426 p_base_key_column => 'dpnt_cvrd_othr_ptip_rt_id',
427 p_base_key_value => p_dpnt_cvrd_othr_ptip_rt_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 => g_old_rec.vrbl_rt_prfl_id,
431 p_parent_table_name2 => 'ben_ptip_f',
432 p_parent_key_column2 => 'ptip_id',
433 p_parent_key_value2 => g_old_rec.ptip_id,
434 p_enforce_foreign_locking => true,
435 p_validation_start_date => l_validation_start_date,
436 p_validation_end_date => l_validation_end_date);
437 Else
438 --
439 -- We are doing a datetrack 'INSERT' which is illegal within this
440 -- procedure therefore we must error (note: to lck on insert the
441 -- private procedure ins_lck should be called).
442 --
443 fnd_message.set_name('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
444 fnd_message.set_token('PROCEDURE', l_proc);
445 fnd_message.set_token('STEP','20');
446 fnd_message.raise_error;
447 End If;
448 --
449 -- Set the validation start and end date OUT arguments
450 --
451 p_validation_start_date := l_validation_start_date;
452 p_validation_end_date := l_validation_end_date;
453 --
454 hr_utility.set_location(' Leaving:'||l_proc, 30);
455 --
456 -- We need to trap the ORA LOCK exception
457 --
458 Exception
459 When HR_Api.Object_Locked then
460 --
461 -- The object is locked therefore we need to supply a meaningful
462 -- error message.
463 --
464 fnd_message.set_name('PAY', 'HR_7165_OBJECT_LOCKED');
465 fnd_message.set_token('TABLE_NAME', 'ben_dpnt_cvrd_othr_ptip_rt_f');
466 fnd_message.raise_error;
467 When l_object_invalid then
468 --
469 -- The object doesn't exist or is invalid
470 --
471 fnd_message.set_name('PAY', 'HR_7155_OBJECT_INVALID');
472 fnd_message.set_token('TABLE_NAME', 'ben_dpnt_cvrd_othr_ptip_rt_f');
473 fnd_message.raise_error;
474 End lck;
475 --
476 -- ----------------------------------------------------------------------------
477 -- |-----------------------------< convert_args >-----------------------------|
478 -- ----------------------------------------------------------------------------
479 Function convert_args
480 (
481 p_dpnt_cvrd_othr_ptip_rt_id in number,
482 p_effective_start_date in date,
483 p_effective_end_date in date,
484 p_excld_flag in varchar2,
485 p_ordr_num in number,
486 p_enrl_det_dt_cd in varchar2,
487 p_only_pls_subj_cobra_flag in varchar2,
488 p_ptip_id in number,
489 p_vrbl_rt_prfl_id in number,
490 p_business_group_id in number,
491 p_dco_attribute_category in varchar2,
492 p_dco_attribute1 in varchar2,
493 p_dco_attribute2 in varchar2,
494 p_dco_attribute3 in varchar2,
495 p_dco_attribute4 in varchar2,
496 p_dco_attribute5 in varchar2,
497 p_dco_attribute6 in varchar2,
498 p_dco_attribute7 in varchar2,
499 p_dco_attribute8 in varchar2,
500 p_dco_attribute9 in varchar2,
501 p_dco_attribute10 in varchar2,
502 p_dco_attribute11 in varchar2,
503 p_dco_attribute12 in varchar2,
504 p_dco_attribute13 in varchar2,
505 p_dco_attribute14 in varchar2,
506 p_dco_attribute15 in varchar2,
507 p_dco_attribute16 in varchar2,
508 p_dco_attribute17 in varchar2,
509 p_dco_attribute18 in varchar2,
510 p_dco_attribute19 in varchar2,
511 p_dco_attribute20 in varchar2,
512 p_dco_attribute21 in varchar2,
513 p_dco_attribute22 in varchar2,
514 p_dco_attribute23 in varchar2,
515 p_dco_attribute24 in varchar2,
516 p_dco_attribute25 in varchar2,
517 p_dco_attribute26 in varchar2,
518 p_dco_attribute27 in varchar2,
519 p_dco_attribute28 in varchar2,
520 p_dco_attribute29 in varchar2,
521 p_dco_attribute30 in varchar2,
522 p_object_version_number in number
523 )
524 Return g_rec_type is
525 --
526 l_rec g_rec_type;
527 l_proc varchar2(72) := g_package||'convert_args';
528 --
529 Begin
530 --
531 hr_utility.set_location('Entering:'||l_proc, 5);
532 --
533 -- Convert arguments into local l_rec structure.
534 --
535 l_rec.dpnt_cvrd_othr_ptip_rt_id := p_dpnt_cvrd_othr_ptip_rt_id;
536 l_rec.effective_start_date := p_effective_start_date;
537 l_rec.effective_end_date := p_effective_end_date;
538 l_rec.excld_flag := p_excld_flag;
539 l_rec.ordr_num := p_ordr_num;
540 l_rec.enrl_det_dt_cd := p_enrl_det_dt_cd;
541 l_rec.only_pls_subj_cobra_flag := p_only_pls_subj_cobra_flag;
542 l_rec.ptip_id := p_ptip_id;
543 l_rec.vrbl_rt_prfl_id := p_vrbl_rt_prfl_id;
544 l_rec.business_group_id := p_business_group_id;
545 l_rec.dco_attribute_category := p_dco_attribute_category;
546 l_rec.dco_attribute1 := p_dco_attribute1;
547 l_rec.dco_attribute2 := p_dco_attribute2;
548 l_rec.dco_attribute3 := p_dco_attribute3;
549 l_rec.dco_attribute4 := p_dco_attribute4;
550 l_rec.dco_attribute5 := p_dco_attribute5;
551 l_rec.dco_attribute6 := p_dco_attribute6;
552 l_rec.dco_attribute7 := p_dco_attribute7;
553 l_rec.dco_attribute8 := p_dco_attribute8;
554 l_rec.dco_attribute9 := p_dco_attribute9;
555 l_rec.dco_attribute10 := p_dco_attribute10;
556 l_rec.dco_attribute11 := p_dco_attribute11;
557 l_rec.dco_attribute12 := p_dco_attribute12;
558 l_rec.dco_attribute13 := p_dco_attribute13;
559 l_rec.dco_attribute14 := p_dco_attribute14;
560 l_rec.dco_attribute15 := p_dco_attribute15;
561 l_rec.dco_attribute16 := p_dco_attribute16;
562 l_rec.dco_attribute17 := p_dco_attribute17;
563 l_rec.dco_attribute18 := p_dco_attribute18;
564 l_rec.dco_attribute19 := p_dco_attribute19;
565 l_rec.dco_attribute20 := p_dco_attribute20;
566 l_rec.dco_attribute21 := p_dco_attribute21;
567 l_rec.dco_attribute22 := p_dco_attribute22;
568 l_rec.dco_attribute23 := p_dco_attribute23;
569 l_rec.dco_attribute24 := p_dco_attribute24;
570 l_rec.dco_attribute25 := p_dco_attribute25;
571 l_rec.dco_attribute26 := p_dco_attribute26;
572 l_rec.dco_attribute27 := p_dco_attribute27;
573 l_rec.dco_attribute28 := p_dco_attribute28;
574 l_rec.dco_attribute29 := p_dco_attribute29;
575 l_rec.dco_attribute30 := p_dco_attribute30;
576 l_rec.object_version_number := p_object_version_number;
577 --
578 -- Return the plsql record structure.
579 --
580 hr_utility.set_location(' Leaving:'||l_proc, 10);
581 Return(l_rec);
582 --
583 End convert_args;
584 --
585 end ben_dco_shd;