[Home] [Help]
PACKAGE BODY: APPS.PAY_EVENT_VALUE_CHANGES_API
Source
1 Package Body pay_event_value_changes_api as
2 /* $Header: pyevcapi.pkb 120.0 2005/05/29 04:46:18 appldev noship $ */
3 --
4 -- Package Variables
5 --
6 g_package varchar2(33) := ' pay_event_value_changes_api.';
7 --
8 -- ----------------------------------------------------------------------------
9 -- |-----------------------< create_event_value_change> >----------------------|
10 -- ----------------------------------------------------------------------------
11 --
12 procedure create_event_value_change
13 (p_validate in boolean default false
14 ,p_effective_date in date
15 ,p_event_qualifier_id in number
16 ,p_default_event in varchar2
17 ,p_valid_event in varchar2
18 ,p_datetracked_event_id in number default null
19 ,p_business_group_id in number default null
20 ,p_legislation_code in varchar2 default null
21 ,p_from_value in varchar2 default null
22 ,p_to_value in varchar2 default null
23 ,p_proration_style in varchar2 default null
24 ,p_qualifier_value in varchar2 default null
25 ,p_event_value_change_id out nocopy number
26 ,p_object_version_number out nocopy number
27 ,p_effective_start_date out nocopy date
28 ,p_effective_end_date out nocopy date
29 ) is
30 --
31 -- Declare cursors and local variables
32 --
33 l_proc varchar2(72) := g_package||'create_event_value_change';
34 l_effective_date date;
35 l_counter number; --misc number
36 --
37 -- Declare OUT variables
38 --
39 l_event_value_change_id pay_event_value_changes_f.event_value_change_id%TYPE;
40 l_object_version_number pay_event_value_changes_f.object_version_number%TYPE;
41 l_effective_start_date pay_event_value_changes_f.effective_start_date%TYPE;
42 l_effective_end_date pay_event_value_changes_f.effective_end_date%TYPE;
43
44 begin
45 hr_utility.set_location('Entering:'|| l_proc, 10);
46 --
47 -- Issue a savepoint
48 --
49 savepoint create_event_value_change;
50 --
51 -- Truncate the time portion from all IN date parameters
52 --
53 l_effective_date := trunc(p_effective_date);
54 hr_utility.set_location(l_proc, 20);
55
56 --
57 -- Call Before Process User Hook
58 --
59 begin
60 pay_event_value_changes_bk1.create_event_value_change_b
61 (p_effective_date => l_effective_date
62 ,p_event_qualifier_id => p_event_qualifier_id
63 ,p_default_event => p_default_event
64 ,p_valid_event => p_valid_event
65 ,p_datetracked_event_id => p_datetracked_event_id
66 ,p_business_group_id => p_business_group_id
67 ,p_legislation_code => p_legislation_code
68 ,p_from_value => p_from_value
69 ,p_to_value => p_to_value
70 ,p_proration_style => p_proration_style
71 ,p_qualifier_value => p_qualifier_value
72 );
73
74 exception
75 when hr_api.cannot_find_prog_unit then
76 hr_api.cannot_find_prog_unit_error
77 (p_module_name => 'create_event_value_change'
78 ,p_hook_type => 'BP'
79 );
80 end;
81
82 hr_utility.set_location(l_proc, 30);
83 --
84 -- Validation in addition to Row Handlers
85 --
86
87 -- If new event qualifier type, driving first row is attempted creation
88 -- of the evc representing the default value
89 if (p_default_event = 'Y') then
90 --------------------------------------------------------
91 -- Using more than one qualifier on a given event
92 -- IS NOT SUPPORTED. Hence we error if a default row already exists
93 -- eg we are inserting a second qualifier.
94 --------------------------------------------------------
95 select count(*)
96 into l_counter
97 from pay_event_value_changes_f
98 where p_effective_date between effective_start_date and effective_end_date
99 and p_datetracked_event_id = datetracked_event_id
100 and default_event = 'Y';
101
102 if (l_counter <> 0) then --A qualifier type already exists
103 hr_utility.set_message(801, 'HR_449144_QUA_FWK_ID_EXISTS');
104 -- The vague message is: This Qualification Id already exists....
105 hr_utility.raise_error;
106 end if;
107 end if;
108
109 hr_utility.set_location(l_proc, 40);
110
111
112 --
113 -- Process Logic
114 --
115 --
116 -- Call the row handler
117 --
118 pay_evc_ins.ins
119 (p_effective_date => l_effective_date
120 ,p_event_qualifier_id => p_event_qualifier_id
121 ,p_default_event => p_default_event
122 ,p_valid_event => p_valid_event
123 ,p_datetracked_event_id => p_datetracked_event_id
124 ,p_business_group_id => p_business_group_id
125 ,p_legislation_code => p_legislation_code
126 ,p_from_value => p_from_value
127 ,p_to_value => p_to_value
128 ,p_proration_style => p_proration_style
129 ,p_qualifier_value => p_qualifier_value
130 ,p_event_value_change_id => l_event_value_change_id
131 ,p_object_version_number => l_object_version_number
132 ,p_effective_start_date => l_effective_start_date
133 ,p_effective_end_date => l_effective_end_date
134 );
135 --
136 hr_utility.set_location(l_proc, 50);
137
138 --
139 -- Call After Process User Hook
140 --
141 begin
142 pay_event_value_changes_bk1.create_event_value_change_a
143 (p_effective_date => l_effective_date
144 ,p_event_qualifier_id => p_event_qualifier_id
145 ,p_default_event => p_default_event
146 ,p_valid_event => p_valid_event
147 ,p_datetracked_event_id => p_datetracked_event_id
148 ,p_business_group_id => p_business_group_id
149 ,p_legislation_code => p_legislation_code
150 ,p_from_value => p_from_value
151 ,p_to_value => p_to_value
152 ,p_proration_style => p_proration_style
153 ,p_qualifier_value => p_qualifier_value
154 ,p_event_value_change_id => l_event_value_change_id
155 ,p_object_version_number => l_object_version_number
156 ,p_effective_start_date => l_effective_start_date
157 ,p_effective_end_date => l_effective_end_date
158 );
159 exception
160 when hr_api.cannot_find_prog_unit then
161 hr_api.cannot_find_prog_unit_error
162 (p_module_name => 'create_event_value_change'
163 ,p_hook_type => 'AP'
164 );
165 end;
166
167 hr_utility.set_location(l_proc, 60);
168
169 --
170 -- When in validation only mode raise the Validate_Enabled exception
171 --
172 if p_validate then
173 raise hr_api.validate_enabled;
174 end if;
175 --
176 -- Set all output arguments
177 --
178 p_event_value_change_id := l_event_value_change_id;
179 p_effective_start_date := l_effective_start_date;
180 p_effective_end_date := l_effective_end_date;
181 p_object_version_number := l_object_version_number;
182 --
183 hr_utility.set_location(' Leaving:'||l_proc, 70);
184 exception
185 when hr_api.validate_enabled then
186 --
187 -- As the Validate_Enabled exception has been raised
188 -- we must rollback to the savepoint
189 --
190 rollback to create_event_value_change;
191 --
192 -- Only set output warning arguments
193 -- (Any key or derived arguments must be set to null
194 -- when validation only mode is being used.)
195 --
196 p_event_value_change_id := null;
197 p_effective_start_date := null;
198 p_effective_end_date := null;
199 p_object_version_number := null;
200 hr_utility.set_location(' Leaving:'||l_proc, 80);
201 when others then
202 --
203 -- A validation or unexpected error has occured
204 --
205 rollback to create_event_value_change;
206 p_event_value_change_id := null;
207 p_effective_start_date := null;
208 p_effective_end_date := null;
209 p_object_version_number := null;
210 hr_utility.set_location(' Leaving:'||l_proc, 90);
211 raise;
212 end create_event_value_change;
213 --
214
215 --
216 -- ----------------------------------------------------------------------------
217 -- |----------------------< update_event_value_change >-------------------------|
218 -- ----------------------------------------------------------------------------
219 --
220 procedure update_event_value_change
221 (p_validate in boolean default false
222 ,p_effective_date in date
223 ,p_datetrack_mode in varchar2
224 ,p_event_qualifier_id in number
225 ,p_default_event in varchar2
226 ,p_valid_event in varchar2
227 ,p_datetracked_event_id in number default hr_api.g_number
228 ,p_business_group_id in number default hr_api.g_number
229 ,p_legislation_code in varchar2 default hr_api.g_varchar2
230 ,p_from_value in varchar2 default hr_api.g_varchar2
231 ,p_to_value in varchar2 default hr_api.g_varchar2
232 ,p_proration_style in varchar2 default hr_api.g_varchar2
233 ,p_qualifier_value in varchar2 default hr_api.g_varchar2
234 ,p_event_value_change_id in number
235 ,p_object_version_number in out nocopy number
236 ,p_effective_start_date out nocopy date
237 ,p_effective_end_date out nocopy date
238 ) is
239 --
240 -- Declare cursors and local variables
241 --
242
243 l_proc varchar2(72) := g_package||'update_event_value_change';
244 l_effective_date date;
245 --
246 -- Declare OUT variables
247 --
248 l_effective_start_date pay_event_value_changes_f.effective_start_date%TYPE;
249 l_effective_end_date pay_event_value_changes_f.effective_end_date%TYPE;
250 --
251 -- Declare IN OUT variable
252 --
253 l_object_version_number pay_event_value_changes_f.object_version_number%TYPE;
254 --
255 begin
256 hr_utility.set_location('Entering:'|| l_proc, 10);
257 --
258 -- Issue a savepoint and assign in-out parameters to local variable
259 --
260
261 l_object_version_number := p_object_version_number;
262 savepoint update_event_value_change;
263 --
264 --
265 -- Truncate the time portion from all IN date parameters
266 --
267 l_effective_date := trunc(p_effective_date);
268 hr_utility.set_location(l_proc, 20);
269 --
270 -- Call Before Process User Hook
271 --
272 begin
273 pay_event_value_changes_bk2.update_event_value_change_b
274 (p_effective_date => l_effective_date
275 ,p_datetrack_mode => p_datetrack_mode
276 ,p_event_qualifier_id => p_event_qualifier_id
277 ,p_default_event => p_default_event
278 ,p_valid_event => p_valid_event
279 ,p_datetracked_event_id => p_datetracked_event_id
280 ,p_business_group_id => p_business_group_id
281 ,p_legislation_code => p_legislation_code
282 ,p_from_value => p_from_value
283 ,p_to_value => p_to_value
284 ,p_proration_style => p_proration_style
285 ,p_qualifier_value => p_qualifier_value
286 ,p_event_value_change_id => p_event_value_change_id
287 ,p_object_version_number => l_object_version_number
288 );
289
290 exception
291 when hr_api.cannot_find_prog_unit then
292 hr_api.cannot_find_prog_unit_error
293 (p_module_name => 'update_event_value_change'
294 ,p_hook_type => 'BP'
295 );
296 end;
297 hr_utility.set_location(l_proc, 30);
298 --
299 -- Validation in addition to Row Handlers
300 --
301 hr_utility.set_location(l_proc, 40);
302 --
303 -- Process Logic
304 --
305 -- Call the row handler
306 --
307 pay_evc_upd.upd
308 (p_effective_date => l_effective_date
309 ,p_datetrack_mode => p_datetrack_mode
310 ,p_event_value_change_id => p_event_value_change_id
311 ,p_object_version_number => p_object_version_number
312 ,p_from_value => p_from_value
313 ,p_to_value => p_to_value
314 ,p_valid_event => p_valid_event
315 ,p_proration_style => p_proration_style
316 ,p_qualifier_value => p_qualifier_value
317 ,p_effective_start_date => l_effective_start_date
318 ,p_effective_end_date => l_effective_end_date
319 );
320 --
321
322 --
323 hr_utility.set_location(l_proc, 50);
324 --
325 -- Call After Process User Hook
326 --
327 begin
328 pay_event_value_changes_bk2.update_event_value_change_a
329 (p_effective_date => l_effective_date
330 ,p_datetrack_mode => p_datetrack_mode
331 ,p_event_qualifier_id => p_event_qualifier_id
332 ,p_default_event => p_default_event
333 ,p_valid_event => p_valid_event
334 ,p_datetracked_event_id => p_datetracked_event_id
335 ,p_business_group_id => p_business_group_id
336 ,p_legislation_code => p_legislation_code
337 ,p_from_value => p_from_value
338 ,p_to_value => p_to_value
339 ,p_proration_style => p_proration_style
340 ,p_qualifier_value => p_qualifier_value
341 ,p_event_value_change_id => p_event_value_change_id
342 ,p_object_version_number => l_object_version_number
343 ,p_effective_start_date => l_effective_start_date
344 ,p_effective_end_date => l_effective_end_date
345 );
346 exception
347 when hr_api.cannot_find_prog_unit then
348 hr_api.cannot_find_prog_unit_error
349 (p_module_name => 'update_event_value_change_a'
350 ,p_hook_type => 'AP'
351 );
352 end;
353 hr_utility.set_location(l_proc, 60);
354 --
355 -- When in validation only mode raise the Validate_Enabled exception
356 --
357 if p_validate then
358 raise hr_api.validate_enabled;
359 end if;
360 --
361 -- Set all output arguments
362 --
363 p_effective_start_date := l_effective_start_date;
364 p_effective_end_date := l_effective_end_date;
365 p_object_version_number := p_object_version_number;
366 --
367 hr_utility.set_location(' Leaving:'||l_proc, 70);
368 exception
369 when hr_api.validate_enabled then
370 --
371 -- As the Validate_Enabled exception has been raised
372 -- we must rollback to the savepoint
373 --
374 rollback to update_event_value_change;
375 --
376 -- Only set output warning arguments
377 -- (Any key or derived arguments must be set to null
378 -- when validation only mode is being used.)
379 --
380 p_object_version_number := l_object_version_number;
381 p_effective_start_date := null;
382 p_effective_end_date := null;
383 hr_utility.set_location(' Leaving:'||l_proc, 80);
384 when others then
385 --
386 -- A validation or unexpected error has occured
387 --
388 rollback to update_event_value_change;
389 raise;
390 hr_utility.set_location(' Leaving:'||l_proc, 90);
391 raise;
392 end update_event_value_change;
393
394
395
396 -- ----------------------------------------------------------------------------
397 -- |------------------------< delete_event_value_change >-----------------------|
398 -- ----------------------------------------------------------------------------
399 procedure delete_event_value_change
400 (p_validate in boolean default false
401 ,p_effective_date in date
402 ,p_datetrack_mode in varchar2
403 ,p_event_value_change_id in number
404 ,p_object_version_number in out nocopy number
405 ,p_business_group_id in number default hr_api.g_number
406 ,p_legislation_code in varchar2 default hr_api.g_varchar2
407 ,p_effective_start_date out nocopy date
408 ,p_effective_end_date out nocopy date
409 ) is
410 --
411 -- Declare cursors and local variables
412 --
413 l_proc varchar2(72) := g_package||'delete_event_value_change';
414 l_effective_date date;
415 --
416 -- Declare OUT variables
417 --
418 l_effective_start_date pay_event_value_changes_f.effective_start_date%type;
419 l_effective_end_date pay_event_value_changes_f.effective_end_date%type;
420 l_validation_start_date date;
421 l_validation_end_date date;
422 l_object_version_number pay_event_value_changes_f.object_version_number%type;
423 --
424 begin
425 hr_utility.set_location('Entering:'|| l_proc, 5);
426 --
427 -- Issue a savepoint and assign in-out parameters to local variable
428 --
429 savepoint delete_event_value_change;
430 l_object_version_number := p_object_version_number;
431 --
432 hr_utility.set_location(l_proc, 10);
433 --
434 l_effective_date := trunc(p_effective_date);
435 --
436 -- Call Before Process User Hook
437 --
438 begin
439 pay_event_value_changes_bk3.delete_event_value_change_b
440 (p_effective_date => l_effective_date
441 ,p_datetrack_mode => p_datetrack_mode
442 ,p_event_value_change_id => p_event_value_change_id
443 ,p_object_version_number => p_object_version_number
444 ,p_business_group_id => p_business_group_id
445 ,p_legislation_code => p_legislation_code
446 );
447
448 exception
449 when hr_api.cannot_find_prog_unit then
450 hr_api.cannot_find_prog_unit_error
451 (p_module_name => 'delete_event_value_change'
452 ,p_hook_type => 'BP'
453 );
454 end;
455 --
456 hr_utility.set_location(l_proc, 20);
457 --
458 -- Validation in addition to Row Handlers
459 --
460 hr_utility.set_location(l_proc, 30);
461 --
462 -- Lock the non-translated table row handler for ZAP datetrack delete mode
463 --
464 if p_datetrack_mode = hr_api.g_zap then
465 --
466 pay_evc_shd.lck(p_effective_date => l_effective_date
467 ,p_datetrack_mode => p_datetrack_mode
468 ,p_event_value_change_id => p_event_value_change_id
469 ,p_object_version_number => p_object_version_number
470 ,p_validation_start_date => l_validation_start_date
471 ,p_validation_end_date => l_validation_end_date
472 );
473 --
474 end if; -- mode = ZAP
475 --
476 -- Call the row handler to delete the event_qualifier
477 --
478 pay_evc_del.del
479 (p_effective_date => l_effective_date
480 ,p_datetrack_mode => p_datetrack_mode
481 ,p_event_value_change_id => p_event_value_change_id
482 ,p_object_version_number => p_object_version_number
483 ,p_effective_start_date => l_effective_start_date
484 ,p_effective_end_date => l_effective_end_date
485 );
486 --
487 hr_utility.set_location(l_proc, 50);
488 --
489 -- Call After Process User Hook
490 --
491 begin
492 pay_event_value_changes_bk3.delete_event_value_change_a
493 (p_effective_date => l_effective_date
494 ,p_datetrack_mode => p_datetrack_mode
495 ,p_event_value_change_id => p_event_value_change_id
496 ,p_object_version_number => p_object_version_number
497 ,p_business_group_id => p_business_group_id
498 ,p_legislation_code => p_legislation_code
499 ,p_effective_start_date => l_effective_start_date
500 ,p_effective_end_date => l_effective_end_date
501 );
502 --
503 end;
504 hr_utility.set_location(l_proc, 60);
505 --
506 -- When in validation only mode raise the Validate_Enabled exception
507 --
508 if p_validate then
509 raise hr_api.validate_enabled;
510 end if;
511 --
512 -- Set out parameters
513 --
514 p_object_version_number := p_object_version_number;
515 p_effective_start_date := l_effective_start_date;
516 p_effective_end_date := l_effective_end_date;
517 --
518 hr_utility.set_location(l_proc, 70);
519 exception
520 when hr_api.validate_enabled then
521 --
522 -- As the Validate_Enabled exception has been raised
523 -- we must rollback to the savepoint
524 --
525 ROLLBACK TO delete_event_value_change;
526 --
527 -- Only set output warning arguments
528 -- (Any key or derived arguments must be set to null
529 -- when validation only mode is being used.)
530 --
531 p_object_version_number := l_object_version_number;
532 p_effective_start_date := null;
533 p_effective_end_date := null;
534 --
535 when others then
536 --
537 -- A validation or unexpected error has occurred
538 --
539 ROLLBACK TO delete_event_value_change;
540 p_object_version_number := l_object_version_number;
541 p_effective_start_date := null;
542 p_effective_end_date := null;
543 hr_utility.set_location(' Leaving:'||l_proc, 80);
544 raise;
545 --
546 end delete_event_value_change;
547 -- ----------------------------------------------------------------------------
548
549 end pay_event_value_changes_api;