[Home] [Help]
PACKAGE BODY: APPS.BEN_BUR_SHD
Source
1 Package Body ben_bur_shd as
2 /* $Header: beburrhi.pkb 120.0.12010000.2 2008/08/05 14:14:03 ubhat ship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- | Private Global Definitions |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package varchar2(33) := ' ben_bur_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_BRGNG_UNIT_RTS_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_brgng_unit_rt_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 brgng_unit_rt_id,
66 effective_start_date,
67 effective_end_date,
68 vrbl_rt_prfl_id,
69 excld_flag,
70 ordr_num,
71 brgng_unit_cd,
72 business_group_id,
73 bur_attribute_category,
74 bur_attribute1,
75 bur_attribute2,
76 bur_attribute3,
77 bur_attribute4,
78 bur_attribute5,
79 bur_attribute6,
80 bur_attribute7,
81 bur_attribute8,
82 bur_attribute9,
83 bur_attribute10,
84 bur_attribute11,
85 bur_attribute12,
86 bur_attribute13,
87 bur_attribute14,
88 bur_attribute15,
89 bur_attribute16,
90 bur_attribute17,
91 bur_attribute18,
92 bur_attribute19,
93 bur_attribute20,
94 bur_attribute21,
95 bur_attribute22,
96 bur_attribute23,
97 bur_attribute24,
98 bur_attribute25,
99 bur_attribute26,
100 bur_attribute27,
101 bur_attribute28,
102 bur_attribute29,
103 bur_attribute30,
104 object_version_number
105 from ben_brgng_unit_rt_f
106 where brgng_unit_rt_id = p_brgng_unit_rt_id
107 and p_effective_date
108 between effective_start_date and effective_end_date;
109 --
110 l_proc varchar2(72) := g_package||'api_updating';
111 l_fct_ret boolean;
112 --
113 Begin
114 hr_utility.set_location('Entering:'||l_proc, 5);
115 --
116 If (p_effective_date is null or
117 p_brgng_unit_rt_id is null or
118 p_object_version_number is null) Then
119 --
120 -- One of the primary key arguments is null therefore we must
121 -- set the returning function value to false
122 --
123 l_fct_ret := false;
124 Else
125 If (p_brgng_unit_rt_id = g_old_rec.brgng_unit_rt_id and
126 p_object_version_number = g_old_rec.object_version_number) Then
127 hr_utility.set_location(l_proc, 10);
128 --
129 -- The g_old_rec is current therefore we must
130 -- set the returning function to true
131 --
132 l_fct_ret := true;
133 Else
134 --
135 -- Select the current row
136 --
137 Open C_Sel1;
138 Fetch C_Sel1 Into g_old_rec;
139 If C_Sel1%notfound Then
140 Close C_Sel1;
141 --
142 -- The primary key is invalid therefore we must error
143 --
144 hr_utility.set_message(801, 'HR_7220_INVALID_PRIMARY_KEY');
145 hr_utility.raise_error;
146 End If;
147 Close C_Sel1;
148 If (p_object_version_number <> g_old_rec.object_version_number) Then
149 hr_utility.set_message(801, 'HR_7155_OBJECT_INVALID');
150 hr_utility.raise_error;
151 End If;
152 hr_utility.set_location(l_proc, 15);
153 l_fct_ret := true;
154 End If;
155 End If;
156 hr_utility.set_location(' Leaving:'||l_proc, 20);
157 Return (l_fct_ret);
158 --
159 End api_updating;
160 --
161 -- ----------------------------------------------------------------------------
162 -- |--------------------------< find_dt_del_modes >---------------------------|
163 -- ----------------------------------------------------------------------------
164 Procedure find_dt_del_modes
165 (p_effective_date in date,
166 p_base_key_value in number,
167 p_zap out nocopy boolean,
168 p_delete out nocopy boolean,
169 p_future_change out nocopy boolean,
170 p_delete_next_change out nocopy boolean) is
171 --
172 l_proc varchar2(72) := g_package||'find_dt_del_modes';
173 --
174 l_parent_key_value1 number;
175 --
176 Cursor C_Sel1 Is
177 select t.vrbl_rt_prfl_id
178 from ben_brgng_unit_rt_f t
179 where t.brgng_unit_rt_id = p_base_key_value
180 and p_effective_date
181 between t.effective_start_date and t.effective_end_date;
182 --
183 Begin
184 hr_utility.set_location('Entering:'||l_proc, 5);
185 --
186 Open C_Sel1;
187 Fetch C_Sel1 Into l_parent_key_value1;
188 If C_Sel1%notfound then
189 Close C_Sel1;
190 hr_utility.set_message(801, 'HR_6153_ALL_PROCEDURE_FAIL');
191 hr_utility.set_message_token('PROCEDURE', l_proc);
192 hr_utility.set_message_token('STEP','10');
193 hr_utility.raise_error;
194 End If;
195 Close C_Sel1;
196 --
197 -- Call the corresponding datetrack api
198 --
199 dt_api.find_dt_del_modes
200 (p_effective_date => p_effective_date,
201 p_base_table_name => 'ben_brgng_unit_rt_f',
202 p_base_key_column => 'brgng_unit_rt_id',
203 p_base_key_value => p_base_key_value,
204 p_parent_table_name1 => 'ben_vrbl_rt_prfl_f',
205 p_parent_key_column1 => 'vrbl_rt_prfl_id',
206 p_parent_key_value1 => l_parent_key_value1,
207 p_zap => p_zap,
208 p_delete => p_delete,
209 p_future_change => p_future_change,
210 p_delete_next_change => p_delete_next_change);
211 --
212 hr_utility.set_location(' Leaving:'||l_proc, 10);
213 End find_dt_del_modes;
214 --
215 -- ----------------------------------------------------------------------------
216 -- |--------------------------< find_dt_upd_modes >---------------------------|
217 -- ----------------------------------------------------------------------------
218 Procedure find_dt_upd_modes
219 (p_effective_date in date,
220 p_base_key_value in number,
221 p_correction out nocopy boolean,
222 p_update out nocopy boolean,
223 p_update_override out nocopy boolean,
224 p_update_change_insert out nocopy boolean) is
225 --
226 l_proc varchar2(72) := g_package||'find_dt_upd_modes';
227 --
228 Begin
229 hr_utility.set_location('Entering:'||l_proc, 5);
230 --
231 -- Call the corresponding datetrack api
232 --
233 dt_api.find_dt_upd_modes
234 (p_effective_date => p_effective_date,
235 p_base_table_name => 'ben_brgng_unit_rt_f',
236 p_base_key_column => 'brgng_unit_rt_id',
237 p_base_key_value => p_base_key_value,
238 p_correction => p_correction,
239 p_update => p_update,
240 p_update_override => p_update_override,
241 p_update_change_insert => p_update_change_insert);
242 --
243 hr_utility.set_location(' Leaving:'||l_proc, 10);
244 End find_dt_upd_modes;
245 --
246 -- ----------------------------------------------------------------------------
247 -- |------------------------< upd_effective_end_date >------------------------|
248 -- ----------------------------------------------------------------------------
249 Procedure upd_effective_end_date
250 (p_effective_date in date,
251 p_base_key_value in number,
252 p_new_effective_end_date in date,
253 p_validation_start_date in date,
254 p_validation_end_date in date,
255 p_object_version_number out nocopy number) is
256 --
257 l_proc varchar2(72) := g_package||'upd_effective_end_date';
258 l_object_version_number number;
259 --
260 Begin
261 hr_utility.set_location('Entering:'||l_proc, 5);
262 --
263 -- Because we are updating a row we must get the next object
264 -- version number.
265 --
266 l_object_version_number :=
267 dt_api.get_object_version_number
268 (p_base_table_name => 'ben_brgng_unit_rt_f',
269 p_base_key_column => 'brgng_unit_rt_id',
270 p_base_key_value => p_base_key_value);
271 --
272 hr_utility.set_location(l_proc, 10);
273 g_api_dml := true; -- Set the api dml status
274 --
275 -- Update the specified datetrack row setting the effective
276 -- end date to the specified new effective end date.
277 --
278 update ben_brgng_unit_rt_f t
279 set t.effective_end_date = p_new_effective_end_date,
280 t.object_version_number = l_object_version_number
281 where t.brgng_unit_rt_id = p_base_key_value
282 and p_effective_date
283 between t.effective_start_date and t.effective_end_date;
284 --
285 g_api_dml := false; -- Unset the api dml status
286 p_object_version_number := l_object_version_number;
287 hr_utility.set_location(' Leaving:'||l_proc, 15);
288 --
289 Exception
290 When Others Then
291 g_api_dml := false; -- Unset the api dml status
292 Raise;
293 End upd_effective_end_date;
294 --
295 -- ----------------------------------------------------------------------------
296 -- |---------------------------------< lck >----------------------------------|
297 -- ----------------------------------------------------------------------------
298 Procedure lck
299 (p_effective_date in date,
300 p_datetrack_mode in varchar2,
301 p_brgng_unit_rt_id in number,
302 p_object_version_number in number,
303 p_validation_start_date out nocopy date,
304 p_validation_end_date out nocopy date) is
305 --
306 l_proc varchar2(72) := g_package||'lck';
307 l_validation_start_date date;
308 l_validation_end_date date;
309 l_object_invalid exception;
310 l_argument varchar2(30);
311 --
312 -- Cursor C_Sel1 selects the current locked row as of session date
313 -- ensuring that the object version numbers match.
314 --
315 Cursor C_Sel1 is
316 select
317 brgng_unit_rt_id,
318 effective_start_date,
319 effective_end_date,
320 vrbl_rt_prfl_id,
321 excld_flag,
322 ordr_num,
323 brgng_unit_cd,
324 business_group_id,
325 bur_attribute_category,
326 bur_attribute1,
327 bur_attribute2,
328 bur_attribute3,
329 bur_attribute4,
330 bur_attribute5,
331 bur_attribute6,
332 bur_attribute7,
333 bur_attribute8,
334 bur_attribute9,
335 bur_attribute10,
336 bur_attribute11,
337 bur_attribute12,
338 bur_attribute13,
339 bur_attribute14,
340 bur_attribute15,
341 bur_attribute16,
342 bur_attribute17,
343 bur_attribute18,
344 bur_attribute19,
345 bur_attribute20,
346 bur_attribute21,
347 bur_attribute22,
348 bur_attribute23,
349 bur_attribute24,
350 bur_attribute25,
351 bur_attribute26,
352 bur_attribute27,
353 bur_attribute28,
354 bur_attribute29,
355 bur_attribute30,
356 object_version_number
357 from ben_brgng_unit_rt_f
358 where brgng_unit_rt_id = p_brgng_unit_rt_id
359 and p_effective_date
360 between effective_start_date and effective_end_date
361 for update nowait;
362 --
363 --
364 --
365 Begin
366 hr_utility.set_location('Entering:'||l_proc, 5);
367 --
368 -- Ensure that all the mandatory arguments are not null
369 --
370 hr_api.mandatory_arg_error(p_api_name => l_proc,
371 p_argument => 'effective_date',
372 p_argument_value => p_effective_date);
373 --
374 hr_api.mandatory_arg_error(p_api_name => l_proc,
375 p_argument => 'datetrack_mode',
376 p_argument_value => p_datetrack_mode);
377 --
378 hr_api.mandatory_arg_error(p_api_name => l_proc,
379 p_argument => 'brgng_unit_rt_id',
380 p_argument_value => p_brgng_unit_rt_id);
381 --
382 hr_api.mandatory_arg_error(p_api_name => l_proc,
383 p_argument => 'object_version_number',
384 p_argument_value => p_object_version_number);
385 --
386 -- Check to ensure the datetrack mode is not INSERT.
387 --
388 If (p_datetrack_mode <> 'INSERT') then
389 --
390 -- We must select and lock the current row.
391 --
392 Open C_Sel1;
393 Fetch C_Sel1 Into g_old_rec;
394 If C_Sel1%notfound then
395 Close C_Sel1;
396 --
397 -- The primary key is invalid therefore we must error
398 --
399 hr_utility.set_message(801, 'HR_7220_INVALID_PRIMARY_KEY');
400 hr_utility.raise_error;
401 End If;
402 Close C_Sel1;
403 If (p_object_version_number <> g_old_rec.object_version_number) Then
404 hr_utility.set_message(801, 'HR_7155_OBJECT_INVALID');
405 hr_utility.raise_error;
406 End If;
407 hr_utility.set_location(l_proc, 15);
408 --
409 --
410 -- Validate the datetrack mode mode getting the validation start
411 -- and end dates for the specified datetrack operation.
412 --
413 dt_api.validate_dt_mode
414 (p_effective_date => p_effective_date,
415 p_datetrack_mode => p_datetrack_mode,
416 p_base_table_name => 'ben_brgng_unit_rt_f',
417 p_base_key_column => 'brgng_unit_rt_id',
418 p_base_key_value => p_brgng_unit_rt_id,
419 p_parent_table_name1 => 'ben_vrbl_rt_prfl_f',
420 p_parent_key_column1 => 'vrbl_rt_prfl_id',
421 p_parent_key_value1 => g_old_rec.vrbl_rt_prfl_id,
422 p_enforce_foreign_locking => false, --true,
423 p_validation_start_date => l_validation_start_date,
424 p_validation_end_date => l_validation_end_date);
425 Else
426 --
427 -- We are doing a datetrack 'INSERT' which is illegal within this
428 -- procedure therefore we must error (note: to lck on insert the
429 -- private procedure ins_lck should be called).
430 --
431 hr_utility.set_message(801, 'HR_6153_ALL_PROCEDURE_FAIL');
432 hr_utility.set_message_token('PROCEDURE', l_proc);
433 hr_utility.set_message_token('STEP','20');
434 hr_utility.raise_error;
435 End If;
436 --
437 -- Set the validation start and end date OUT arguments
438 --
439 p_validation_start_date := l_validation_start_date;
443 --
440 p_validation_end_date := l_validation_end_date;
441 --
442 hr_utility.set_location(' Leaving:'||l_proc, 30);
444 -- We need to trap the ORA LOCK exception
445 --
446 Exception
447 When HR_Api.Object_Locked then
448 --
449 -- The object is locked therefore we need to supply a meaningful
450 -- error message.
451 --
452 hr_utility.set_message(801, 'HR_7165_OBJECT_LOCKED');
453 hr_utility.set_message_token('TABLE_NAME', 'ben_brgng_unit_rt_f');
454 hr_utility.raise_error;
455 When l_object_invalid then
456 --
457 -- The object doesn't exist or is invalid
458 --
459 hr_utility.set_message(801, 'HR_7155_OBJECT_INVALID');
460 hr_utility.set_message_token('TABLE_NAME', 'ben_brgng_unit_rt_f');
461 hr_utility.raise_error;
462 End lck;
463 --
464 -- ----------------------------------------------------------------------------
465 -- |-----------------------------< convert_args >-----------------------------|
466 -- ----------------------------------------------------------------------------
467 Function convert_args
468 (
469 p_brgng_unit_rt_id in number,
470 p_effective_start_date in date,
471 p_effective_end_date in date,
472 p_vrbl_rt_prfl_id in number,
473 p_excld_flag in varchar2,
474 p_ordr_num in number,
475 p_brgng_unit_cd in varchar2,
476 p_business_group_id in number,
477 p_bur_attribute_category in varchar2,
478 p_bur_attribute1 in varchar2,
479 p_bur_attribute2 in varchar2,
480 p_bur_attribute3 in varchar2,
481 p_bur_attribute4 in varchar2,
482 p_bur_attribute5 in varchar2,
483 p_bur_attribute6 in varchar2,
484 p_bur_attribute7 in varchar2,
485 p_bur_attribute8 in varchar2,
486 p_bur_attribute9 in varchar2,
487 p_bur_attribute10 in varchar2,
488 p_bur_attribute11 in varchar2,
489 p_bur_attribute12 in varchar2,
490 p_bur_attribute13 in varchar2,
491 p_bur_attribute14 in varchar2,
492 p_bur_attribute15 in varchar2,
493 p_bur_attribute16 in varchar2,
494 p_bur_attribute17 in varchar2,
495 p_bur_attribute18 in varchar2,
496 p_bur_attribute19 in varchar2,
497 p_bur_attribute20 in varchar2,
498 p_bur_attribute21 in varchar2,
499 p_bur_attribute22 in varchar2,
500 p_bur_attribute23 in varchar2,
501 p_bur_attribute24 in varchar2,
502 p_bur_attribute25 in varchar2,
503 p_bur_attribute26 in varchar2,
504 p_bur_attribute27 in varchar2,
505 p_bur_attribute28 in varchar2,
506 p_bur_attribute29 in varchar2,
507 p_bur_attribute30 in varchar2,
508 p_object_version_number in number
509 )
510 Return g_rec_type is
511 --
512 l_rec g_rec_type;
513 l_proc varchar2(72) := g_package||'convert_args';
514 --
515 Begin
516 --
517 hr_utility.set_location('Entering:'||l_proc, 5);
518 --
519 -- Convert arguments into local l_rec structure.
520 --
521 l_rec.brgng_unit_rt_id := p_brgng_unit_rt_id;
522 l_rec.effective_start_date := p_effective_start_date;
523 l_rec.effective_end_date := p_effective_end_date;
524 l_rec.vrbl_rt_prfl_id := p_vrbl_rt_prfl_id;
525 l_rec.excld_flag := p_excld_flag;
526 l_rec.ordr_num := p_ordr_num;
527 l_rec.brgng_unit_cd := p_brgng_unit_cd;
528 l_rec.business_group_id := p_business_group_id;
529 l_rec.bur_attribute_category := p_bur_attribute_category;
530 l_rec.bur_attribute1 := p_bur_attribute1;
531 l_rec.bur_attribute2 := p_bur_attribute2;
532 l_rec.bur_attribute3 := p_bur_attribute3;
533 l_rec.bur_attribute4 := p_bur_attribute4;
534 l_rec.bur_attribute5 := p_bur_attribute5;
535 l_rec.bur_attribute6 := p_bur_attribute6;
536 l_rec.bur_attribute7 := p_bur_attribute7;
537 l_rec.bur_attribute8 := p_bur_attribute8;
538 l_rec.bur_attribute9 := p_bur_attribute9;
539 l_rec.bur_attribute10 := p_bur_attribute10;
540 l_rec.bur_attribute11 := p_bur_attribute11;
541 l_rec.bur_attribute12 := p_bur_attribute12;
542 l_rec.bur_attribute13 := p_bur_attribute13;
543 l_rec.bur_attribute14 := p_bur_attribute14;
544 l_rec.bur_attribute15 := p_bur_attribute15;
545 l_rec.bur_attribute16 := p_bur_attribute16;
546 l_rec.bur_attribute17 := p_bur_attribute17;
547 l_rec.bur_attribute18 := p_bur_attribute18;
548 l_rec.bur_attribute19 := p_bur_attribute19;
549 l_rec.bur_attribute20 := p_bur_attribute20;
550 l_rec.bur_attribute21 := p_bur_attribute21;
551 l_rec.bur_attribute22 := p_bur_attribute22;
552 l_rec.bur_attribute23 := p_bur_attribute23;
553 l_rec.bur_attribute24 := p_bur_attribute24;
554 l_rec.bur_attribute25 := p_bur_attribute25;
555 l_rec.bur_attribute26 := p_bur_attribute26;
556 l_rec.bur_attribute27 := p_bur_attribute27;
557 l_rec.bur_attribute28 := p_bur_attribute28;
558 l_rec.bur_attribute29 := p_bur_attribute29;
559 l_rec.bur_attribute30 := p_bur_attribute30;
560 l_rec.object_version_number := p_object_version_number;
561 --
562 -- Return the plsql record structure.
563 --
564 hr_utility.set_location(' Leaving:'||l_proc, 10);
565 Return(l_rec);
566 --
567 End convert_args;
568 --
569 end ben_bur_shd;