[Home] [Help]
PACKAGE BODY: APPS.BEN_ECY_SHD
Source
1 Package Body ben_ecy_shd as
2 /* $Header: beecyrhi.pkb 120.0 2005/05/28 01:55:37 appldev noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- | Private Global Definitions |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package varchar2(33) := ' ben_ecy_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_COMPTNCY_PRTE_FK1') 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 Elsif (p_constraint_name = 'BEN_ELIG_COMPTNCY_PRTE_FK2') Then
42 fnd_message.set_name('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
43 fnd_message.set_token('PROCEDURE', l_proc);
44 fnd_message.set_token('STEP','7');
45 fnd_message.raise_error;
46 ElsIf (p_constraint_name = 'BEN_ELIG_COMPTNCY_PRTE_PK') Then
47 fnd_message.set_name('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
48 fnd_message.set_token('PROCEDURE', l_proc);
49 fnd_message.set_token('STEP','10');
50 fnd_message.raise_error;
51 Else
52 fnd_message.set_name('PAY', 'HR_7877_API_INVALID_CONSTRAINT');
53 fnd_message.set_token('PROCEDURE', l_proc);
54 fnd_message.set_token('CONSTRAINT_NAME', p_constraint_name);
55 fnd_message.raise_error;
56 End If;
57 --
58 hr_utility.set_location(' Leaving:'||l_proc, 10);
59 End constraint_error;
60 --
61 -- ----------------------------------------------------------------------------
62 -- |-----------------------------< api_updating >-----------------------------|
63 -- ----------------------------------------------------------------------------
64 Function api_updating
65 (p_effective_date in date,
66 p_ELIG_COMPTNCY_PRTE_id in number,
67 p_object_version_number in number
68 ) Return Boolean Is
69 --
70 --
71 -- Cursor selects the 'current' row from the HR Schema
72 --
73 Cursor C_Sel1 is
74 select
75 ELIG_COMPTNCY_PRTE_id,
76 effective_start_date,
77 effective_end_date,
78 excld_flag,
79 ordr_num,
80 competence_id,
81 rating_level_id,
82 eligy_prfl_id,
83 business_group_id,
84 ecy_attribute_category,
85 ecy_attribute1,
86 ecy_attribute2,
87 ecy_attribute3,
88 ecy_attribute4,
89 ecy_attribute5,
90 ecy_attribute6,
91 ecy_attribute7,
92 ecy_attribute8,
93 ecy_attribute9,
94 ecy_attribute10,
95 ecy_attribute11,
96 ecy_attribute12,
97 ecy_attribute13,
98 ecy_attribute14,
99 ecy_attribute15,
100 ecy_attribute16,
101 ecy_attribute17,
102 ecy_attribute18,
103 ecy_attribute19,
104 ecy_attribute20,
105 ecy_attribute21,
106 ecy_attribute22,
107 ecy_attribute23,
108 ecy_attribute24,
109 ecy_attribute25,
110 ecy_attribute26,
111 ecy_attribute27,
112 ecy_attribute28,
113 ecy_attribute29,
114 ecy_attribute30,
115 object_version_number,
116 criteria_score,
117 criteria_weight
118 from ben_ELIG_COMPTNCY_PRTE_f
119 where ELIG_COMPTNCY_PRTE_id = p_ELIG_COMPTNCY_PRTE_id
120 and p_effective_date
121 between effective_start_date and effective_end_date;
122 --
123 l_proc varchar2(72) := g_package||'api_updating';
124 l_fct_ret boolean;
125 --
126 Begin
127 hr_utility.set_location('Entering:'||l_proc, 5);
128 --
129 If (p_effective_date is null or
130 p_ELIG_COMPTNCY_PRTE_id is null or
131 p_object_version_number is null) Then
132 --
133 -- One of the primary key arguments is null therefore we must
134 -- set the returning function value to false
135 --
136 l_fct_ret := false;
137 Else
138 If (p_ELIG_COMPTNCY_PRTE_id = g_old_rec.ELIG_COMPTNCY_PRTE_id and
139 p_object_version_number = g_old_rec.object_version_number) Then
140 hr_utility.set_location(l_proc, 10);
141 --
142 -- The g_old_rec is current therefore we must
143 -- set the returning function to true
144 --
145 l_fct_ret := true;
146 Else
147 --
148 -- Select the current row
149 --
150 Open C_Sel1;
151 Fetch C_Sel1 Into g_old_rec;
152 If C_Sel1%notfound Then
153 Close C_Sel1;
154 --
155 -- The primary key is invalid therefore we must error
156 --
157 fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
158 fnd_message.raise_error;
159 End If;
160 Close C_Sel1;
161 If (p_object_version_number <> g_old_rec.object_version_number) Then
162 fnd_message.set_name('PAY', 'HR_7155_OBJECT_INVALID');
163 fnd_message.raise_error;
164 End If;
165 hr_utility.set_location(l_proc, 15);
166 l_fct_ret := true;
167 End If;
168 End If;
169 hr_utility.set_location(' Leaving:'||l_proc, 20);
170 Return (l_fct_ret);
171 --
172 End api_updating;
173 --
174 -- ----------------------------------------------------------------------------
175 -- |--------------------------< find_dt_del_modes >---------------------------|
176 -- ----------------------------------------------------------------------------
177 Procedure find_dt_del_modes
178 (p_effective_date in date,
179 p_base_key_value in number,
180 p_zap out nocopy boolean,
181 p_delete out nocopy boolean,
182 p_future_change out nocopy boolean,
183 p_delete_next_change out nocopy boolean) is
184 --
185 l_proc varchar2(72) := g_package||'find_dt_del_modes';
186 --
187 --
188 --
189 --
190 Begin
191 hr_utility.set_location('Entering:'||l_proc, 5);
192 --
193 --
194 -- Call the corresponding datetrack api
195 --
196 dt_api.find_dt_del_modes
197 (p_effective_date => p_effective_date,
198 p_base_table_name => 'ben_ELIG_COMPTNCY_PRTE_f',
199 p_base_key_column => 'ELIG_COMPTNCY_PRTE_id',
200 p_base_key_value => p_base_key_value,
201 p_zap => p_zap,
202 p_delete => p_delete,
203 p_future_change => p_future_change,
204 p_delete_next_change => p_delete_next_change);
205 --
206 hr_utility.set_location(' Leaving:'||l_proc, 10);
207 End find_dt_del_modes;
208 --
209 -- ----------------------------------------------------------------------------
210 -- |--------------------------< find_dt_upd_modes >---------------------------|
211 -- ----------------------------------------------------------------------------
212 Procedure find_dt_upd_modes
213 (p_effective_date in date,
214 p_base_key_value in number,
215 p_correction out nocopy boolean,
216 p_update out nocopy boolean,
217 p_update_override out nocopy boolean,
218 p_update_change_insert out nocopy boolean) is
219 --
220 l_proc varchar2(72) := g_package||'find_dt_upd_modes';
221 --
222 Begin
223 hr_utility.set_location('Entering:'||l_proc, 5);
224 --
225 -- Call the corresponding datetrack api
226 --
227 dt_api.find_dt_upd_modes
228 (p_effective_date => p_effective_date,
229 p_base_table_name => 'ben_ELIG_COMPTNCY_PRTE_f',
230 p_base_key_column => 'ELIG_COMPTNCY_PRTE_id',
231 p_base_key_value => p_base_key_value,
232 p_correction => p_correction,
233 p_update => p_update,
234 p_update_override => p_update_override,
235 p_update_change_insert => p_update_change_insert);
236 --
237 hr_utility.set_location(' Leaving:'||l_proc, 10);
238 End find_dt_upd_modes;
239 --
240 -- ----------------------------------------------------------------------------
241 -- |------------------------< upd_effective_end_date >------------------------|
242 -- ----------------------------------------------------------------------------
243 Procedure upd_effective_end_date
244 (p_effective_date in date,
245 p_base_key_value in number,
246 p_new_effective_end_date in date,
247 p_validation_start_date in date,
248 p_validation_end_date in date,
249 p_object_version_number out nocopy number) is
250 --
251 l_proc varchar2(72) := g_package||'upd_effective_end_date';
252 l_object_version_number number;
253 --
254 Begin
255 hr_utility.set_location('Entering:'||l_proc, 5);
256 --
257 -- Because we are updating a row we must get the next object
258 -- version number.
259 --
260 l_object_version_number :=
261 dt_api.get_object_version_number
262 (p_base_table_name => 'ben_ELIG_COMPTNCY_PRTE_f',
263 p_base_key_column => 'ELIG_COMPTNCY_PRTE_id',
264 p_base_key_value => p_base_key_value);
265 --
266 hr_utility.set_location(l_proc, 10);
267 g_api_dml := true; -- Set the api dml status
268 --
269 -- Update the specified datetrack row setting the effective
270 -- end date to the specified new effective end date.
271 --
272 update ben_ELIG_COMPTNCY_PRTE_f t
273 set t.effective_end_date = p_new_effective_end_date,
274 t.object_version_number = l_object_version_number
275 where t.ELIG_COMPTNCY_PRTE_id = p_base_key_value
276 and p_effective_date
277 between t.effective_start_date and t.effective_end_date;
278 --
279 g_api_dml := false; -- Unset the api dml status
280 p_object_version_number := l_object_version_number;
281 hr_utility.set_location(' Leaving:'||l_proc, 15);
282 --
283 Exception
284 When Others Then
285 g_api_dml := false; -- Unset the api dml status
286 Raise;
287 End upd_effective_end_date;
288 --
289 -- ----------------------------------------------------------------------------
290 -- |---------------------------------< lck >----------------------------------|
291 -- ----------------------------------------------------------------------------
292 Procedure lck
293 (p_effective_date in date,
294 p_datetrack_mode in varchar2,
295 p_ELIG_COMPTNCY_PRTE_id in number,
296 p_object_version_number in number,
297 p_validation_start_date out nocopy date,
298 p_validation_end_date out nocopy date) is
299 --
300 l_proc varchar2(72) := g_package||'lck';
301 l_validation_start_date date;
302 l_validation_end_date date;
303 l_object_invalid exception;
304 l_argument varchar2(30);
305 --
306 -- Cursor C_Sel1 selects the current locked row as of session date
307 -- ensuring that the object version numbers match.
308 --
309 Cursor C_Sel1 is
310 select
311 ELIG_COMPTNCY_PRTE_id,
312 effective_start_date,
313 effective_end_date,
314 excld_flag,
315 ordr_num,
316 competence_id,
317 rating_level_id,
318 eligy_prfl_id,
319 business_group_id,
320 ecy_attribute_category,
321 ecy_attribute1,
322 ecy_attribute2,
323 ecy_attribute3,
324 ecy_attribute4,
325 ecy_attribute5,
326 ecy_attribute6,
327 ecy_attribute7,
328 ecy_attribute8,
329 ecy_attribute9,
330 ecy_attribute10,
331 ecy_attribute11,
332 ecy_attribute12,
333 ecy_attribute13,
334 ecy_attribute14,
335 ecy_attribute15,
336 ecy_attribute16,
337 ecy_attribute17,
338 ecy_attribute18,
339 ecy_attribute19,
340 ecy_attribute20,
341 ecy_attribute21,
342 ecy_attribute22,
343 ecy_attribute23,
344 ecy_attribute24,
345 ecy_attribute25,
346 ecy_attribute26,
347 ecy_attribute27,
348 ecy_attribute28,
349 ecy_attribute29,
350 ecy_attribute30,
351 object_version_number,
352 criteria_score,
353 criteria_weight
354 from ben_ELIG_COMPTNCY_PRTE_f
355 where ELIG_COMPTNCY_PRTE_id = p_ELIG_COMPTNCY_PRTE_id
356 and p_effective_date
357 between effective_start_date and effective_end_date
358 for update nowait;
359 --
360 --
361 --
362 Begin
363 hr_utility.set_location('Entering:'||l_proc, 5);
364 --
365 -- Ensure that all the mandatory arguments are not null
366 --
367 hr_api.mandatory_arg_error(p_api_name => l_proc,
368 p_argument => 'effective_date',
369 p_argument_value => p_effective_date);
370 --
371 hr_api.mandatory_arg_error(p_api_name => l_proc,
372 p_argument => 'datetrack_mode',
373 p_argument_value => p_datetrack_mode);
374 --
375 hr_api.mandatory_arg_error(p_api_name => l_proc,
376 p_argument => 'ELIG_COMPTNCY_PRTE_id',
377 p_argument_value => p_ELIG_COMPTNCY_PRTE_id);
378 --
379 hr_api.mandatory_arg_error(p_api_name => l_proc,
380 p_argument => 'object_version_number',
381 p_argument_value => p_object_version_number);
382 --
383 -- Check to ensure the datetrack mode is not INSERT.
384 --
385 If (p_datetrack_mode <> 'INSERT') then
386 --
387 -- We must select and lock the current row.
388 --
389 Open C_Sel1;
390 Fetch C_Sel1 Into g_old_rec;
391 If C_Sel1%notfound then
392 Close C_Sel1;
393 --
394 -- The primary key is invalid therefore we must error
395 --
396 fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
397 fnd_message.raise_error;
398 End If;
399 Close C_Sel1;
400 If (p_object_version_number <> g_old_rec.object_version_number) Then
401 fnd_message.set_name('PAY', 'HR_7155_OBJECT_INVALID');
402 fnd_message.raise_error;
403 End If;
404 hr_utility.set_location(l_proc, 15);
405 --
406 --
407 -- Validate the datetrack mode mode getting the validation start
408 -- and end dates for the specified datetrack operation.
409 --
410 dt_api.validate_dt_mode
411 (p_effective_date => p_effective_date,
412 p_datetrack_mode => p_datetrack_mode,
413 p_base_table_name => 'ben_ELIG_COMPTNCY_PRTE_f',
414 p_base_key_column => 'ELIG_COMPTNCY_PRTE_id',
415 p_base_key_value => p_ELIG_COMPTNCY_PRTE_id,
416
417 p_enforce_foreign_locking => true,
418 p_validation_start_date => l_validation_start_date,
419 p_validation_end_date => l_validation_end_date);
420 Else
421 --
422 -- We are doing a datetrack 'INSERT' which is illegal within this
423 -- procedure therefore we must error (note: to lck on insert the
424 -- private procedure ins_lck should be called).
425 --
426 fnd_message.set_name('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
427 fnd_message.set_token('PROCEDURE', l_proc);
428 fnd_message.set_token('STEP','20');
429 fnd_message.raise_error;
430 End If;
431 --
432 -- Set the validation start and end date OUT arguments
436 --
433 --
434 p_validation_start_date := l_validation_start_date;
435 p_validation_end_date := l_validation_end_date;
437 hr_utility.set_location(' Leaving:'||l_proc, 30);
438 --
439 -- We need to trap the ORA LOCK exception
440 --
441 Exception
442 When HR_Api.Object_Locked then
443 --
444 -- The object is locked therefore we need to supply a meaningful
445 -- error message.
446 --
447 fnd_message.set_name('PAY', 'HR_7165_OBJECT_LOCKED');
448 fnd_message.set_token('TABLE_NAME', 'ben_ELIG_COMPTNCY_PRTE_f');
449 fnd_message.raise_error;
450 When l_object_invalid then
451 --
452 -- The object doesn't exist or is invalid
453 --
454 fnd_message.set_name('PAY', 'HR_7155_OBJECT_INVALID');
455 fnd_message.set_token('TABLE_NAME', 'ben_ELIG_COMPTNCY_PRTE_f');
456 fnd_message.raise_error;
457 End lck;
458 --
459 -- ----------------------------------------------------------------------------
460 -- |-----------------------------< convert_args >-----------------------------|
461 -- ----------------------------------------------------------------------------
462 Function convert_args
463 (
464 p_ELIG_COMPTNCY_PRTE_id in number,
465 p_effective_start_date in date,
466 p_effective_end_date in date,
467 p_excld_flag in varchar2,
468 p_ordr_num in number,
469 p_competence_id in number,
470 p_rating_level_id in number,
471 p_eligy_prfl_id in number,
472 p_business_group_id in number,
473 p_ecy_attribute_category in varchar2,
474 p_ecy_attribute1 in varchar2,
475 p_ecy_attribute2 in varchar2,
476 p_ecy_attribute3 in varchar2,
477 p_ecy_attribute4 in varchar2,
478 p_ecy_attribute5 in varchar2,
479 p_ecy_attribute6 in varchar2,
480 p_ecy_attribute7 in varchar2,
481 p_ecy_attribute8 in varchar2,
482 p_ecy_attribute9 in varchar2,
483 p_ecy_attribute10 in varchar2,
484 p_ecy_attribute11 in varchar2,
485 p_ecy_attribute12 in varchar2,
486 p_ecy_attribute13 in varchar2,
487 p_ecy_attribute14 in varchar2,
488 p_ecy_attribute15 in varchar2,
489 p_ecy_attribute16 in varchar2,
490 p_ecy_attribute17 in varchar2,
491 p_ecy_attribute18 in varchar2,
492 p_ecy_attribute19 in varchar2,
493 p_ecy_attribute20 in varchar2,
494 p_ecy_attribute21 in varchar2,
495 p_ecy_attribute22 in varchar2,
496 p_ecy_attribute23 in varchar2,
497 p_ecy_attribute24 in varchar2,
498 p_ecy_attribute25 in varchar2,
499 p_ecy_attribute26 in varchar2,
500 p_ecy_attribute27 in varchar2,
501 p_ecy_attribute28 in varchar2,
502 p_ecy_attribute29 in varchar2,
503 p_ecy_attribute30 in varchar2,
504 p_object_version_number in number,
505 p_criteria_score in number,
506 p_criteria_weight in number
507 )
508 Return g_rec_type is
509 --
510 l_rec g_rec_type;
511 l_proc varchar2(72) := g_package||'convert_args';
512 --
513 Begin
514 --
515 hr_utility.set_location('Entering:'||l_proc, 5);
516 --
517 -- Convert arguments into local l_rec structure.
518 --
519 l_rec.ELIG_COMPTNCY_PRTE_id := p_ELIG_COMPTNCY_PRTE_id;
520 l_rec.effective_start_date := p_effective_start_date;
521 l_rec.effective_end_date := p_effective_end_date;
522 l_rec.excld_flag := p_excld_flag;
523 l_rec.ordr_num := p_ordr_num;
524 l_rec.competence_id := p_competence_id;
525 l_rec.rating_level_id := p_rating_level_id;
526 l_rec.eligy_prfl_id := p_eligy_prfl_id;
527 l_rec.business_group_id := p_business_group_id;
528 l_rec.ecy_attribute_category := p_ecy_attribute_category;
529 l_rec.ecy_attribute1 := p_ecy_attribute1;
530 l_rec.ecy_attribute2 := p_ecy_attribute2;
531 l_rec.ecy_attribute3 := p_ecy_attribute3;
532 l_rec.ecy_attribute4 := p_ecy_attribute4;
533 l_rec.ecy_attribute5 := p_ecy_attribute5;
534 l_rec.ecy_attribute6 := p_ecy_attribute6;
535 l_rec.ecy_attribute7 := p_ecy_attribute7;
536 l_rec.ecy_attribute8 := p_ecy_attribute8;
537 l_rec.ecy_attribute9 := p_ecy_attribute9;
538 l_rec.ecy_attribute10 := p_ecy_attribute10;
539 l_rec.ecy_attribute11 := p_ecy_attribute11;
540 l_rec.ecy_attribute12 := p_ecy_attribute12;
541 l_rec.ecy_attribute13 := p_ecy_attribute13;
542 l_rec.ecy_attribute14 := p_ecy_attribute14;
543 l_rec.ecy_attribute15 := p_ecy_attribute15;
544 l_rec.ecy_attribute16 := p_ecy_attribute16;
545 l_rec.ecy_attribute17 := p_ecy_attribute17;
546 l_rec.ecy_attribute18 := p_ecy_attribute18;
547 l_rec.ecy_attribute19 := p_ecy_attribute19;
548 l_rec.ecy_attribute20 := p_ecy_attribute20;
549 l_rec.ecy_attribute21 := p_ecy_attribute21;
550 l_rec.ecy_attribute22 := p_ecy_attribute22;
551 l_rec.ecy_attribute23 := p_ecy_attribute23;
552 l_rec.ecy_attribute24 := p_ecy_attribute24;
553 l_rec.ecy_attribute25 := p_ecy_attribute25;
554 l_rec.ecy_attribute26 := p_ecy_attribute26;
555 l_rec.ecy_attribute27 := p_ecy_attribute27;
556 l_rec.ecy_attribute28 := p_ecy_attribute28;
557 l_rec.ecy_attribute29 := p_ecy_attribute29;
558 l_rec.ecy_attribute30 := p_ecy_attribute30;
559 l_rec.object_version_number := p_object_version_number;
560 l_rec.criteria_score := p_criteria_score;
561 l_rec.criteria_weight := p_criteria_weight;
562
563 --
564 -- Return the plsql record structure.
565 --
566 hr_utility.set_location(' Leaving:'||l_proc, 10);
567 Return(l_rec);
568 --
569 End convert_args;
570 --
571 end ben_ecy_shd;