[Home] [Help]
PACKAGE BODY: APPS.PAY_BALANCE_FEEDS_API
Source
1 Package Body PAY_BALANCE_FEEDS_API as
2 /* $Header: pypbfapi.pkb 115.3 2004/02/26 04:29:54 tvankayl noship $ */
3 --
4 -- Package Variables
5 --
6 g_package varchar2(33) := ' PAY_BALANCE_FEEDS_API.';
7 --
8 -- ----------------------------------------------------------------------------
9 -- |--------------------------< create_balance_feed >-------------------------|
10 -- ----------------------------------------------------------------------------
11 --
12 procedure create_balance_feed
13 (p_validate in boolean default false
14 ,p_effective_date in date
15 ,p_balance_type_id in number
16 ,p_input_value_id in number
17 ,p_scale in varchar2
18 ,p_business_group_id in number default null
19 ,p_legislation_code in varchar2 default null
20 ,p_legislation_subgroup in varchar2 default null
21 ,p_initial_feed in boolean default false
22 ,p_balance_feed_id out nocopy number
23 ,p_effective_start_date out nocopy date
24 ,p_effective_end_date out nocopy date
25 ,p_object_version_number out nocopy number
26 ,p_exist_run_result_warning out nocopy boolean
27 ) is
28 --
29 -- Declare cursors and local variables
30 --
31
32 l_proc varchar2(72) := g_package||'create_balance_feed';
33 l_effective_date date;
34
35 --Declare OUT variables
36 l_balance_feed_id pay_balance_feeds_f.balance_feed_id%type;
37 l_effective_start_date pay_balance_feeds_f.effective_start_date%type;
38 l_effective_end_date pay_balance_feeds_f.effective_end_date%type;
39 l_object_version_number pay_balance_feeds_f.object_version_number%type;
40 l_exist_run_result_warning boolean;
41
42 begin
43 hr_utility.set_location('Entering:'|| l_proc, 10);
44 --
45 -- Issue a savepoint
46 --
47 savepoint create_balance_feed;
48 --
49 -- Truncate the time portion from all IN date parameters
50 --
51 l_effective_date := trunc(p_effective_date);
52 --
53 -- Lookup validation added here so that there are no numeric or value
54 -- errors for scale.
55 --
56 if p_scale is not null
57 and hr_api.NOT_EXISTS_IN_HR_LOOKUPS
58 (p_effective_date => p_effective_date
59 ,p_lookup_type => 'ADD_SUBTRACT'
60 ,p_lookup_code => p_scale
61 ) then
62 --
63 fnd_message.set_name(801,'HR_52966_INVALID_LOOKUP');
64 fnd_message.raise_error;
65 --
66 end if;
67 --
68 -- Call Before Process User Hook
69 --
70 begin
71 PAY_BALANCE_FEEDS_BK1.create_balance_feed_b
72 (p_effective_date => l_effective_date
73 ,p_business_group_id => p_business_group_id
74 ,p_legislation_code => p_legislation_code
75 ,p_balance_type_id => p_balance_type_id
76 ,p_input_value_id => p_input_value_id
77 ,p_scale => p_scale
78 ,p_legislation_subgroup => p_legislation_subgroup
79 );
80 exception
81 when hr_api.cannot_find_prog_unit then
82 hr_api.cannot_find_prog_unit_error
83 (p_module_name => 'create_balance_feed'
84 ,p_hook_type => 'BP'
85 );
86 end;
87 --
88 -- Validation in addition to Row Handlers
89 --
90 --
91 -- Process Logic
92 --
93 pay_pbf_ins.ins
94 (p_effective_date => l_effective_date
95 ,p_balance_type_id => p_balance_type_id
96 ,p_input_value_id => p_input_value_id
97 ,p_scale => p_scale
98 ,p_business_group_id => p_business_group_id
99 ,p_legislation_code => p_legislation_code
100 ,p_legislation_subgroup => p_legislation_subgroup
101 ,p_initial_feed => p_initial_feed
102 ,p_balance_feed_id => l_balance_feed_id
103 ,p_object_version_number => l_object_version_number
104 ,p_effective_start_date => l_effective_start_date
105 ,p_effective_end_date => l_effective_end_date
106 ,p_exist_run_result_warning => l_exist_run_result_warning
107 );
108 --
109 -- Call After Process User Hook
110 --
111 begin
112 PAY_BALANCE_FEEDS_BK1.create_balance_feed_a
113 (p_effective_date => l_effective_date
114 ,p_business_group_id => p_business_group_id
115 ,p_legislation_code => p_legislation_code
116 ,p_balance_type_id => p_balance_type_id
117 ,p_input_value_id => p_input_value_id
118 ,p_scale => p_scale
119 ,p_legislation_subgroup => p_legislation_subgroup
120 ,p_balance_feed_id => l_balance_feed_id
121 ,p_effective_start_date => l_effective_start_date
122 ,p_effective_end_date => l_effective_end_date
123 ,p_object_version_number => l_object_version_number
124 ,p_exist_run_result_warning => l_exist_run_result_warning
125 );
126 exception
127 when hr_api.cannot_find_prog_unit then
128 hr_api.cannot_find_prog_unit_error
129 (p_module_name => 'create_balance_feed'
130 ,p_hook_type => 'AP'
131 );
132 end;
133 --
134 -- When in validation only mode raise the Validate_Enabled exception
135 --
136 if p_validate then
137 raise hr_api.validate_enabled;
138 end if;
139 --
140 -- Set all output arguments
141 --
142 p_balance_feed_id := l_balance_feed_id;
143 p_effective_start_date := l_effective_start_date;
144 p_effective_end_date := l_effective_end_date;
145 p_object_version_number := l_object_version_number;
146 p_exist_run_result_warning := l_exist_run_result_warning;
147 --
148 hr_utility.set_location(' Leaving:'||l_proc, 70);
149 exception
150 when hr_api.validate_enabled then
151 --
152 -- As the Validate_Enabled exception has been raised
153 -- we must rollback to the savepoint
154 --
155 rollback to create_balance_feed;
156 --
157 -- Only set output warning arguments
158 -- (Any key or derived arguments must be set to null
159 -- when validation only mode is being used.)
160 --
161 p_balance_feed_id := null;
162 p_effective_start_date := null;
163 p_effective_end_date := null;
164 p_object_version_number := null;
165 p_exist_run_result_warning := l_exist_run_result_warning;
166
167 hr_utility.set_location(' Leaving:'||l_proc, 80);
168 when others then
169 --
170 -- A validation or unexpected error has occured
171 --
172 rollback to create_balance_feed;
173
174 p_balance_feed_id := null;
175 p_effective_start_date := null;
176 p_effective_end_date := null;
177 p_object_version_number := null;
178 p_exist_run_result_warning := null;
179
180 hr_utility.set_location(' Leaving:'||l_proc, 90);
181 raise;
182 end create_balance_feed;
183 --
184 -- ----------------------------------------------------------------------------
185 -- |--------------------------< update_balance_feed >-------------------------|
186 -- ----------------------------------------------------------------------------
187 --
188 procedure update_balance_feed
189 (p_validate in boolean default false
190 ,p_effective_date in date
191 ,p_datetrack_update_mode in varchar2
192 ,p_balance_feed_id in number
193 ,p_scale in varchar2 default hr_api.g_number
194 ,p_object_version_number in out nocopy number
195 ,p_effective_start_date out nocopy date
196 ,p_effective_end_date out nocopy date
197 ,p_exist_run_result_warning out nocopy boolean
198 ) is
199 --
200 -- Declare cursors and local variables
201 --
202
203 cursor csr_sel is
204 select balance_type_id,input_value_id,legislation_code,
205 business_group_id,legislation_subgroup
206 from pay_balance_feeds_f
207 where balance_feed_id =p_balance_feed_id
208 and p_effective_date between effective_start_date and effective_end_date;
209
210 l_proc varchar2(72) := g_package||'update_balance_feed';
211 l_effective_date date;
212
213 --Declare OUT variables
214 l_effective_start_date pay_balance_feeds_f.effective_start_date%type;
215 l_effective_end_date pay_balance_feeds_f.effective_end_date%type;
216 l_object_version_number pay_balance_feeds_f.object_version_number%type;
217 l_exist_run_result_warning boolean;
218
219 l_balance_type_id pay_balance_feeds_f.balance_type_id%type;
220 l_input_value_id pay_balance_feeds_f.input_value_id%type;
221 l_legislation_code pay_balance_feeds_f.legislation_code%type;
222 l_business_group_id pay_balance_feeds_f.business_group_id%type;
223 l_legislation_subgroup pay_balance_feeds_f.legislation_subgroup%type;
224
225 begin
226 hr_utility.set_location('Entering:'|| l_proc, 10);
227 --
228 -- Issue a savepoint
229 --
230 savepoint update_balance_feed;
231 --
232 -- Truncate the time portion from all IN date parameters
233 --
234 l_effective_date := trunc(p_effective_date);
235 l_object_version_number := p_object_version_number;
239 --
236 --
237 -- Lookup validation added here so that there are no numeric or value
238 -- errors for scale.
240 if nvl(p_scale, hr_api.g_number) <> hr_api.g_number
241 and hr_api.NOT_EXISTS_IN_HR_LOOKUPS
242 (p_effective_date => p_effective_date
243 ,p_lookup_type => 'ADD_SUBTRACT'
244 ,p_lookup_code => p_scale
245 ) then
246 --
247 fnd_message.set_name(801,'HR_52966_INVALID_LOOKUP');
248 fnd_message.raise_error;
249 --
250 end if;
251 --
252 -- Call Before Process User Hook
253 --
254 begin
255 PAY_BALANCE_FEEDS_BK2.update_balance_feed_b
256 (p_effective_date => l_effective_date
257 ,p_datetrack_update_mode => p_datetrack_update_mode
258 ,p_balance_feed_id => p_balance_feed_id
259 ,p_scale => p_scale
260 );
261 exception
262 when hr_api.cannot_find_prog_unit then
263 hr_api.cannot_find_prog_unit_error
264 (p_module_name => 'update_balance_feed'
265 ,p_hook_type => 'BP'
266 );
267 end;
268 --
269 -- Validation in addition to Row Handlers
270 --
271 open csr_sel;
272 fetch csr_sel into l_balance_type_id, l_input_value_id, l_legislation_code,
273 l_business_group_id, l_legislation_subgroup;
274 if(csr_sel%notfound) then
275 close csr_sel;
276 fnd_message.set_name('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
277 fnd_message.raise_error;
278 else
279 close csr_sel;
280 end if;
281 --
282 --
283 -- Process Logic
284 pay_pbf_upd.upd
285 (p_effective_date => l_effective_date
286 ,p_datetrack_mode => p_datetrack_update_mode
287 ,p_balance_feed_id => p_balance_feed_id
288 ,p_object_version_number => l_object_version_number
289 ,p_balance_type_id => l_balance_type_id
290 ,p_input_value_id => l_input_value_id
291 ,p_scale => p_scale
292 ,p_business_group_id => l_business_group_id
293 ,p_legislation_code => l_legislation_code
294 ,p_legislation_subgroup => l_legislation_subgroup
295 ,p_effective_start_date => l_effective_start_date
296 ,p_effective_end_date => l_effective_end_date
297 ,p_exist_run_result_warning => l_exist_run_result_warning
298 );
299 --
300 -- Call After Process User Hook
301 --
302 begin
303 PAY_BALANCE_FEEDS_BK2.update_balance_feed_a
304 (p_effective_date => l_effective_date
305 ,p_datetrack_update_mode => p_datetrack_update_mode
306 ,p_balance_feed_id => p_balance_feed_id
307 ,p_scale => p_scale
308 ,p_effective_start_date => l_effective_start_date
309 ,p_effective_end_date => l_effective_end_date
310 ,p_object_version_number => l_object_version_number
311 ,p_exist_run_result_warning => l_exist_run_result_warning
312 );
313
314 exception
315 when hr_api.cannot_find_prog_unit then
316 hr_api.cannot_find_prog_unit_error
317 (p_module_name => 'update_balance_feed'
318 ,p_hook_type => 'AP'
319 );
320 end;
321 --
322 -- When in validation only mode raise the Validate_Enabled exception
323 --
324 if p_validate then
325 raise hr_api.validate_enabled;
326 end if;
327 --
328 -- Set all output arguments
329 --
330 p_effective_start_date := l_effective_start_date;
331 p_effective_end_date := l_effective_end_date;
332 p_object_version_number := l_object_version_number;
333 p_exist_run_result_warning := l_exist_run_result_warning;
334 --
335 hr_utility.set_location(' Leaving:'||l_proc, 70);
336 exception
337 when hr_api.validate_enabled then
338 --
339 -- As the Validate_Enabled exception has been raised
340 -- we must rollback to the savepoint
341 --
342 rollback to update_balance_feed;
343 --
344 -- Only set output warning arguments
345 -- (Any key or derived arguments must be set to null
346 -- when validation only mode is being used.)
347 --
348 p_effective_start_date := null;
349 p_effective_end_date := null;
350 p_object_version_number := l_object_version_number;
351 p_exist_run_result_warning := l_exist_run_result_warning;
352
353 hr_utility.set_location(' Leaving:'||l_proc, 80);
354 when others then
355 --
356 -- A validation or unexpected error has occured
357 --
358 rollback to update_balance_feed;
359
360 p_effective_start_date := null;
361 p_effective_end_date := null;
362 p_object_version_number := l_object_version_number;
363 p_exist_run_result_warning := null;
364
365 hr_utility.set_location(' Leaving:'||l_proc, 90);
366 raise;
367 end update_balance_feed;
368 --
369 -- ----------------------------------------------------------------------------
370 -- |--------------------------< delete_balance_feed >-------------------------|
371 -- ----------------------------------------------------------------------------
372 --
373 procedure delete_balance_feed
374 (p_validate in boolean default false
375 ,p_effective_date in date
376 ,p_datetrack_delete_mode in varchar2
377 ,p_balance_feed_id in number
378 ,p_object_version_number in out nocopy number
379 ,p_effective_start_date out nocopy date
380 ,p_effective_end_date out nocopy date
381 ,p_exist_run_result_warning out nocopy boolean
382 ) is
383 --
387 l_proc varchar2(72) := g_package||'delete_balance_feed';
384 -- Declare cursors and local variables
385 --
386
388 l_effective_date date;
389
390 --Declare OUT variables
391 l_effective_start_date pay_balance_feeds_f.effective_start_date%type;
392 l_effective_end_date pay_balance_feeds_f.effective_end_date%type;
393 l_object_version_number pay_balance_feeds_f.object_version_number%type;
394 l_exist_run_result_warning boolean;
395
396 begin
397 hr_utility.set_location('Entering:'|| l_proc, 10);
398 --
399 -- Issue a savepoint
400 --
401 savepoint delete_balance_feed;
402 --
403 -- Truncate the time portion from all IN date parameters
404 --
405 l_effective_date := trunc(p_effective_date);
406 l_object_version_number := p_object_version_number;
407 --
408 -- Call Before Process User Hook
409 --
410 begin
411 PAY_BALANCE_FEEDS_BK3.delete_balance_feed_b
412 (p_effective_date => l_effective_date
413 ,p_datetrack_delete_mode => p_datetrack_delete_mode
414 ,p_balance_feed_id => p_balance_feed_id
415 ,p_object_version_number => l_object_version_number
416 );
417 exception
418 when hr_api.cannot_find_prog_unit then
419 hr_api.cannot_find_prog_unit_error
420 (p_module_name => 'delete_balance_feed'
421 ,p_hook_type => 'BP'
422 );
423 end;
424 --
425 -- Validation in addition to Row Handlers
426 --
427 --
428 -- Process Logic
429 pay_pbf_del.del
430 (p_effective_date => l_effective_date
431 ,p_datetrack_mode => p_datetrack_delete_mode
432 ,p_balance_feed_id => p_balance_feed_id
433 ,p_object_version_number => l_object_version_number
434 ,p_effective_start_date => l_effective_start_date
435 ,p_effective_end_date => l_effective_end_date
436 ,p_exist_run_result_warning => l_exist_run_result_warning
437 );
438 --
439 -- Call After Process User Hook
440 --
441 begin
442 PAY_BALANCE_FEEDS_BK3.delete_balance_feed_a
443 (p_effective_date => l_effective_date
444 ,p_datetrack_delete_mode => p_datetrack_delete_mode
445 ,p_balance_feed_id => p_balance_feed_id
446 ,p_object_version_number => l_object_version_number
447 ,p_effective_start_date => l_effective_start_date
448 ,p_effective_end_date => l_effective_end_date
449 ,p_exist_run_result_warning => l_exist_run_result_warning
450 );
451 exception
452 when hr_api.cannot_find_prog_unit then
453 hr_api.cannot_find_prog_unit_error
454 (p_module_name => 'delete_balance_feed'
455 ,p_hook_type => 'AP'
456 );
457 end;
458 --
459 -- When in validation only mode raise the Validate_Enabled exception
460 --
461 if p_validate then
462 raise hr_api.validate_enabled;
463 end if;
464 --
465 -- Set all output arguments
466 --
467 p_effective_start_date := l_effective_start_date;
468 p_effective_end_date := l_effective_end_date;
469 p_object_version_number := l_object_version_number;
470 p_exist_run_result_warning := l_exist_run_result_warning;
471 --
472 hr_utility.set_location(' Leaving:'||l_proc, 70);
473 exception
474 when hr_api.validate_enabled then
475 --
476 -- As the Validate_Enabled exception has been raised
477 -- we must rollback to the savepoint
478 --
479 rollback to delete_balance_feed;
480 --
481 -- Only set output warning arguments
482 -- (Any key or derived arguments must be set to null
483 -- when validation only mode is being used.)
484 --
485 p_effective_start_date := null;
486 p_effective_end_date := null;
487 p_object_version_number := l_object_version_number;
488 p_exist_run_result_warning := l_exist_run_result_warning;
489
490 hr_utility.set_location(' Leaving:'||l_proc, 80);
491 when others then
492 --
493 -- A validation or unexpected error has occured
494 --
495 rollback to delete_balance_feed;
496
497 p_effective_start_date := null;
498 p_effective_end_date := null;
499 p_object_version_number := l_object_version_number;
500 p_exist_run_result_warning := null;
501
502 hr_utility.set_location(' Leaving:'||l_proc, 90);
503 raise;
504 end delete_balance_feed;
505 --
506 end PAY_BALANCE_FEEDS_API;