[Home] [Help]
PACKAGE BODY: APPS.BEN_ETU_SHD
Source
1 Package Body ben_etu_shd as
2 /* $Header: beeturhi.pkb 120.0 2005/05/28 03:03:15 appldev noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- | Private Global Definitions |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package varchar2(33) := ' ben_etu_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_ELIG_TBCO_USE_PRTE_F_PK') Then
37 hr_utility.set_message(801, 'HR_6153_ALL_PROCEDURE_FAIL');
38 hr_utility.set_message_token('PROCEDURE', l_proc);
39 hr_utility.set_message_token('STEP','5');
40 hr_utility.raise_error;
41 Else
42 hr_utility.set_message(801, 'HR_7877_API_INVALID_CONSTRAINT');
43 hr_utility.set_message_token('PROCEDURE', l_proc);
44 hr_utility.set_message_token('CONSTRAINT_NAME', p_constraint_name);
45 hr_utility.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_elig_tbco_use_prte_id in number,
57 p_object_version_number in number
58 ) Return Boolean Is
59 --
60 --
61 -- Cursor selects the 'current' row from the HR Schema
62 --
63 Cursor C_Sel1 is
64 select
65 elig_tbco_use_prte_id,
66 effective_start_date,
67 effective_end_date,
68 business_group_id,
69 eligy_prfl_id,
70 excld_flag,
71 ordr_num,
72 uses_tbco_flag,
73 etu_attribute_category,
74 etu_attribute1,
75 etu_attribute2,
76 etu_attribute3,
77 etu_attribute4,
78 etu_attribute5,
79 etu_attribute6,
80 etu_attribute7,
81 etu_attribute8,
82 etu_attribute9,
83 etu_attribute10,
84 etu_attribute11,
85 etu_attribute12,
86 etu_attribute13,
87 etu_attribute14,
88 etu_attribute15,
89 etu_attribute16,
90 etu_attribute17,
91 etu_attribute18,
92 etu_attribute19,
93 etu_attribute20,
94 etu_attribute21,
95 etu_attribute22,
96 etu_attribute23,
97 etu_attribute24,
98 etu_attribute25,
99 etu_attribute26,
100 etu_attribute27,
101 etu_attribute28,
102 etu_attribute29,
103 etu_attribute30,
104 object_version_number,
105 criteria_score,
106 criteria_weight
107 from ben_elig_tbco_use_prte_f
108 where elig_tbco_use_prte_id = p_elig_tbco_use_prte_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_elig_tbco_use_prte_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_elig_tbco_use_prte_id = g_old_rec.elig_tbco_use_prte_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 hr_utility.set_message(801, 'HR_7220_INVALID_PRIMARY_KEY');
147 hr_utility.raise_error;
148 End If;
149 Close C_Sel1;
150 If (p_object_version_number <> g_old_rec.object_version_number) Then
151 hr_utility.set_message(801, 'HR_7155_OBJECT_INVALID');
152 hr_utility.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 --
178 Cursor C_Sel1 Is
179 select t.eligy_prfl_id
180 from ben_elig_tbco_use_prte_f t
181 where t.elig_tbco_use_prte_id = p_base_key_value
182 and p_effective_date
183 between t.effective_start_date and t.effective_end_date;
184 --
185 Begin
186 hr_utility.set_location('Entering:'||l_proc, 5);
187 --
188 Open C_Sel1;
189 Fetch C_Sel1 Into l_parent_key_value1;
190 If C_Sel1%notfound then
191 Close C_Sel1;
192 hr_utility.set_message(801, 'HR_6153_ALL_PROCEDURE_FAIL');
193 hr_utility.set_message_token('PROCEDURE', l_proc);
194 hr_utility.set_message_token('STEP','10');
195 hr_utility.raise_error;
196 End If;
197 Close C_Sel1;
198 --
199 -- Call the corresponding datetrack api
200 --
201 dt_api.find_dt_del_modes
202 (p_effective_date => p_effective_date,
203 p_base_table_name => 'ben_elig_tbco_use_prte_f',
204 p_base_key_column => 'elig_tbco_use_prte_id',
205 p_base_key_value => p_base_key_value,
206 p_parent_table_name1 => 'ben_eligy_prfl_f',
207 p_parent_key_column1 => 'eligy_prfl_id',
208 p_parent_key_value1 => l_parent_key_value1,
209 p_zap => p_zap,
210 p_delete => p_delete,
211 p_future_change => p_future_change,
212 p_delete_next_change => p_delete_next_change);
213 --
214 hr_utility.set_location(' Leaving:'||l_proc, 10);
215 End find_dt_del_modes;
216 --
217 -- ----------------------------------------------------------------------------
218 -- |--------------------------< find_dt_upd_modes >---------------------------|
219 -- ----------------------------------------------------------------------------
220 Procedure find_dt_upd_modes
221 (p_effective_date in date,
222 p_base_key_value in number,
223 p_correction out nocopy boolean,
224 p_update out nocopy boolean,
225 p_update_override out nocopy boolean,
226 p_update_change_insert out nocopy boolean) is
227 --
228 l_proc varchar2(72) := g_package||'find_dt_upd_modes';
229 --
230 Begin
231 hr_utility.set_location('Entering:'||l_proc, 5);
232 --
233 -- Call the corresponding datetrack api
234 --
235 dt_api.find_dt_upd_modes
236 (p_effective_date => p_effective_date,
237 p_base_table_name => 'ben_elig_tbco_use_prte_f',
238 p_base_key_column => 'elig_tbco_use_prte_id',
239 p_base_key_value => p_base_key_value,
240 p_correction => p_correction,
241 p_update => p_update,
242 p_update_override => p_update_override,
243 p_update_change_insert => p_update_change_insert);
244 --
245 hr_utility.set_location(' Leaving:'||l_proc, 10);
246 End find_dt_upd_modes;
247 --
248 -- ----------------------------------------------------------------------------
249 -- |------------------------< upd_effective_end_date >------------------------|
250 -- ----------------------------------------------------------------------------
251 Procedure upd_effective_end_date
252 (p_effective_date in date,
253 p_base_key_value in number,
254 p_new_effective_end_date in date,
255 p_validation_start_date in date,
256 p_validation_end_date in date,
257 p_object_version_number out nocopy number) is
258 --
259 l_proc varchar2(72) := g_package||'upd_effective_end_date';
260 l_object_version_number number;
261 --
262 Begin
263 hr_utility.set_location('Entering:'||l_proc, 5);
264 --
265 -- Because we are updating a row we must get the next object
266 -- version number.
267 --
268 l_object_version_number :=
269 dt_api.get_object_version_number
270 (p_base_table_name => 'ben_elig_tbco_use_prte_f',
271 p_base_key_column => 'elig_tbco_use_prte_id',
272 p_base_key_value => p_base_key_value);
273 --
274 hr_utility.set_location(l_proc, 10);
275 g_api_dml := true; -- Set the api dml status
276 --
277 -- Update the specified datetrack row setting the effective
278 -- end date to the specified new effective end date.
279 --
280 update ben_elig_tbco_use_prte_f t
281 set t.effective_end_date = p_new_effective_end_date,
282 t.object_version_number = l_object_version_number
283 where t.elig_tbco_use_prte_id = p_base_key_value
284 and p_effective_date
285 between t.effective_start_date and t.effective_end_date;
286 --
287 g_api_dml := false; -- Unset the api dml status
288 p_object_version_number := l_object_version_number;
289 hr_utility.set_location(' Leaving:'||l_proc, 15);
290 --
291 Exception
292 When Others Then
293 g_api_dml := false; -- Unset the api dml status
294 Raise;
295 End upd_effective_end_date;
296 --
297 -- ----------------------------------------------------------------------------
298 -- |---------------------------------< lck >----------------------------------|
299 -- ----------------------------------------------------------------------------
300 Procedure lck
301 (p_effective_date in date,
302 p_datetrack_mode in varchar2,
303 p_elig_tbco_use_prte_id in number,
304 p_object_version_number in number,
305 p_validation_start_date out nocopy date,
306 p_validation_end_date out nocopy date) is
307 --
308 l_proc varchar2(72) := g_package||'lck';
309 l_validation_start_date date;
310 l_validation_end_date date;
311 l_object_invalid exception;
312 l_argument varchar2(30);
313 --
314 -- Cursor C_Sel1 selects the current locked row as of session date
315 -- ensuring that the object version numbers match.
316 --
317 Cursor C_Sel1 is
318 select
319 elig_tbco_use_prte_id,
320 effective_start_date,
321 effective_end_date,
322 business_group_id,
323 eligy_prfl_id,
324 excld_flag,
325 ordr_num,
326 uses_tbco_flag,
327 etu_attribute_category,
328 etu_attribute1,
329 etu_attribute2,
330 etu_attribute3,
331 etu_attribute4,
332 etu_attribute5,
333 etu_attribute6,
334 etu_attribute7,
335 etu_attribute8,
336 etu_attribute9,
337 etu_attribute10,
338 etu_attribute11,
339 etu_attribute12,
340 etu_attribute13,
341 etu_attribute14,
342 etu_attribute15,
343 etu_attribute16,
344 etu_attribute17,
345 etu_attribute18,
346 etu_attribute19,
347 etu_attribute20,
348 etu_attribute21,
349 etu_attribute22,
350 etu_attribute23,
351 etu_attribute24,
352 etu_attribute25,
353 etu_attribute26,
354 etu_attribute27,
355 etu_attribute28,
356 etu_attribute29,
357 etu_attribute30,
358 object_version_number,
359 criteria_score,
360 criteria_weight
361 from ben_elig_tbco_use_prte_f
362 where elig_tbco_use_prte_id = p_elig_tbco_use_prte_id
363 and p_effective_date
364 between effective_start_date and effective_end_date
365 for update nowait;
366 --
367 --
368 --
369 Begin
370 hr_utility.set_location('Entering:'||l_proc, 5);
371 --
372 -- Ensure that all the mandatory arguments are not null
373 --
374 hr_api.mandatory_arg_error(p_api_name => l_proc,
375 p_argument => 'effective_date',
376 p_argument_value => p_effective_date);
377 --
378 hr_api.mandatory_arg_error(p_api_name => l_proc,
379 p_argument => 'datetrack_mode',
380 p_argument_value => p_datetrack_mode);
381 --
382 hr_api.mandatory_arg_error(p_api_name => l_proc,
383 p_argument => 'elig_tbco_use_prte_id',
384 p_argument_value => p_elig_tbco_use_prte_id);
385 --
386 hr_api.mandatory_arg_error(p_api_name => l_proc,
387 p_argument => 'object_version_number',
388 p_argument_value => p_object_version_number);
389 --
393 --
390 -- Check to ensure the datetrack mode is not INSERT.
391 --
392 If (p_datetrack_mode <> 'INSERT') then
394 -- We must select and lock the current row.
395 --
396 Open C_Sel1;
397 Fetch C_Sel1 Into g_old_rec;
398 If C_Sel1%notfound then
399 Close C_Sel1;
400 --
401 -- The primary key is invalid therefore we must error
402 --
403 hr_utility.set_message(801, 'HR_7220_INVALID_PRIMARY_KEY');
404 hr_utility.raise_error;
405 End If;
406 Close C_Sel1;
407 If (p_object_version_number <> g_old_rec.object_version_number) Then
408 hr_utility.set_message(801, 'HR_7155_OBJECT_INVALID');
409 hr_utility.raise_error;
410 End If;
411 hr_utility.set_location(l_proc, 15);
412 --
413 --
414 -- Validate the datetrack mode mode getting the validation start
415 -- and end dates for the specified datetrack operation.
416 --
417 dt_api.validate_dt_mode
418 (p_effective_date => p_effective_date,
419 p_datetrack_mode => p_datetrack_mode,
420 p_base_table_name => 'ben_elig_tbco_use_prte_f',
421 p_base_key_column => 'elig_tbco_use_prte_id',
422 p_base_key_value => p_elig_tbco_use_prte_id,
423 p_parent_table_name1 => 'ben_eligy_prfl_f',
424 p_parent_key_column1 => 'eligy_prfl_id',
425 p_parent_key_value1 => g_old_rec.eligy_prfl_id,
426 p_enforce_foreign_locking => true,
427 p_validation_start_date => l_validation_start_date,
428 p_validation_end_date => l_validation_end_date);
429 Else
430 --
431 -- We are doing a datetrack 'INSERT' which is illegal within this
432 -- procedure therefore we must error (note: to lck on insert the
433 -- private procedure ins_lck should be called).
434 --
435 hr_utility.set_message(801, 'HR_6153_ALL_PROCEDURE_FAIL');
436 hr_utility.set_message_token('PROCEDURE', l_proc);
437 hr_utility.set_message_token('STEP','20');
438 hr_utility.raise_error;
439 End If;
440 --
441 -- Set the validation start and end date OUT arguments
442 --
443 p_validation_start_date := l_validation_start_date;
444 p_validation_end_date := l_validation_end_date;
445 --
446 hr_utility.set_location(' Leaving:'||l_proc, 30);
447 --
448 -- We need to trap the ORA LOCK exception
449 --
450 Exception
451 When HR_Api.Object_Locked then
452 --
453 -- The object is locked therefore we need to supply a meaningful
454 -- error message.
455 --
456 hr_utility.set_message(801, 'HR_7165_OBJECT_LOCKED');
457 hr_utility.set_message_token('TABLE_NAME', 'ben_elig_tbco_use_prte_f');
458 hr_utility.raise_error;
459 When l_object_invalid then
460 --
461 -- The object doesn't exist or is invalid
462 --
463 hr_utility.set_message(801, 'HR_7155_OBJECT_INVALID');
464 hr_utility.set_message_token('TABLE_NAME', 'ben_elig_tbco_use_prte_f');
465 hr_utility.raise_error;
466 End lck;
467 --
468 -- ----------------------------------------------------------------------------
469 -- |-----------------------------< convert_args >-----------------------------|
470 -- ----------------------------------------------------------------------------
471 Function convert_args
472 (
473 p_elig_tbco_use_prte_id in number,
474 p_effective_start_date in date,
475 p_effective_end_date in date,
476 p_business_group_id in number,
477 p_eligy_prfl_id in number,
478 p_excld_flag in varchar2,
479 p_ordr_num in number,
480 p_uses_tbco_flag in varchar2,
481 p_etu_attribute_category in varchar2,
482 p_etu_attribute1 in varchar2,
483 p_etu_attribute2 in varchar2,
484 p_etu_attribute3 in varchar2,
485 p_etu_attribute4 in varchar2,
486 p_etu_attribute5 in varchar2,
487 p_etu_attribute6 in varchar2,
488 p_etu_attribute7 in varchar2,
489 p_etu_attribute8 in varchar2,
490 p_etu_attribute9 in varchar2,
491 p_etu_attribute10 in varchar2,
492 p_etu_attribute11 in varchar2,
493 p_etu_attribute12 in varchar2,
494 p_etu_attribute13 in varchar2,
495 p_etu_attribute14 in varchar2,
496 p_etu_attribute15 in varchar2,
497 p_etu_attribute16 in varchar2,
498 p_etu_attribute17 in varchar2,
499 p_etu_attribute18 in varchar2,
500 p_etu_attribute19 in varchar2,
501 p_etu_attribute20 in varchar2,
502 p_etu_attribute21 in varchar2,
503 p_etu_attribute22 in varchar2,
504 p_etu_attribute23 in varchar2,
505 p_etu_attribute24 in varchar2,
506 p_etu_attribute25 in varchar2,
507 p_etu_attribute26 in varchar2,
508 p_etu_attribute27 in varchar2,
509 p_etu_attribute28 in varchar2,
510 p_etu_attribute29 in varchar2,
511 p_etu_attribute30 in varchar2,
515
512 p_object_version_number in number,
513 p_criteria_score in number,
514 p_criteria_weight in number
516 )
517 Return g_rec_type is
518 --
519 l_rec g_rec_type;
520 l_proc varchar2(72) := g_package||'convert_args';
521 --
522 Begin
523 --
524 hr_utility.set_location('Entering:'||l_proc, 5);
525 --
526 -- Convert arguments into local l_rec structure.
527 --
528 l_rec.elig_tbco_use_prte_id := p_elig_tbco_use_prte_id;
529 l_rec.effective_start_date := p_effective_start_date;
530 l_rec.effective_end_date := p_effective_end_date;
531 l_rec.business_group_id := p_business_group_id;
532 l_rec.eligy_prfl_id := p_eligy_prfl_id;
533 l_rec.excld_flag := p_excld_flag;
534 l_rec.ordr_num := p_ordr_num;
535 l_rec.uses_tbco_flag := p_uses_tbco_flag;
536 l_rec.etu_attribute_category := p_etu_attribute_category;
537 l_rec.etu_attribute1 := p_etu_attribute1;
538 l_rec.etu_attribute2 := p_etu_attribute2;
539 l_rec.etu_attribute3 := p_etu_attribute3;
540 l_rec.etu_attribute4 := p_etu_attribute4;
541 l_rec.etu_attribute5 := p_etu_attribute5;
542 l_rec.etu_attribute6 := p_etu_attribute6;
543 l_rec.etu_attribute7 := p_etu_attribute7;
544 l_rec.etu_attribute8 := p_etu_attribute8;
545 l_rec.etu_attribute9 := p_etu_attribute9;
546 l_rec.etu_attribute10 := p_etu_attribute10;
547 l_rec.etu_attribute11 := p_etu_attribute11;
548 l_rec.etu_attribute12 := p_etu_attribute12;
549 l_rec.etu_attribute13 := p_etu_attribute13;
550 l_rec.etu_attribute14 := p_etu_attribute14;
551 l_rec.etu_attribute15 := p_etu_attribute15;
552 l_rec.etu_attribute16 := p_etu_attribute16;
553 l_rec.etu_attribute17 := p_etu_attribute17;
554 l_rec.etu_attribute18 := p_etu_attribute18;
555 l_rec.etu_attribute19 := p_etu_attribute19;
556 l_rec.etu_attribute20 := p_etu_attribute20;
557 l_rec.etu_attribute21 := p_etu_attribute21;
558 l_rec.etu_attribute22 := p_etu_attribute22;
559 l_rec.etu_attribute23 := p_etu_attribute23;
560 l_rec.etu_attribute24 := p_etu_attribute24;
561 l_rec.etu_attribute25 := p_etu_attribute25;
562 l_rec.etu_attribute26 := p_etu_attribute26;
563 l_rec.etu_attribute27 := p_etu_attribute27;
564 l_rec.etu_attribute28 := p_etu_attribute28;
565 l_rec.etu_attribute29 := p_etu_attribute29;
566 l_rec.etu_attribute30 := p_etu_attribute30;
567 l_rec.object_version_number := p_object_version_number;
568 l_rec.criteria_score := p_criteria_score;
569 l_rec.criteria_weight := p_criteria_weight;
570
571 --
572 -- Return the plsql record structure.
573 --
574 hr_utility.set_location(' Leaving:'||l_proc, 10);
575 Return(l_rec);
576 --
577 End convert_args;
578 --
579 end ben_etu_shd;