49: -- PURPOSE
50: -- This Procedure will Update the source and target funds and update the fund_request.
51: --
52: -- IN
53: --p_commit IN VARCHAR2 := fnd_api.g_false
54: --p_update_status IN VARCHAR2 := 'Y'
55: --p_fund_request_id IN NUMBER
56: --p_target_fund_id IN NUMBER
57: --p_source_fund_id IN NUMBER
69: ------------------------------------------------------------------------------
70:
71:
72: PROCEDURE approve_request(
73: p_commit IN VARCHAR2 := fnd_api.g_false
74: ,p_update_status IN VARCHAR2 := 'Y'
75: ,p_act_budget_id IN NUMBER
76: ,p_target_fund_id IN NUMBER
77: ,p_source_fund_id IN NUMBER
158: -- Initialize
159: IF G_DEBUG THEN
160: ozf_utility_pvt.debug_message(l_full_name || ': start');
161: END IF;
162: x_return_status := fnd_api.g_ret_sts_success;
163: OPEN c_fund_detail(p_source_fund_id);
164: FETCH c_fund_detail INTO l_source_rec.source_org_budget,
165: l_source_rec.source_trans_in_amt,
166: l_source_rec.source_trans_out_amt,
175: fnd_message.set_name('OZF', 'OZF_API_RECORD_NOT_FOUND');
176: fnd_msg_pub.add;
177: END IF;
178:
179: RAISE fnd_api.g_exc_error;
180: END IF;
181:
182: CLOSE c_fund_detail;
183:
194: fnd_message.set_name('OZF', 'OZF_AMT_UNAVAILABLE');
195: fnd_msg_pub.add;
196: END IF;
197:
198: RAISE fnd_api.g_exc_error;
199: END IF;
200:
201: ----- Convert the approved amount to the to_fund_currency
202: OPEN c_to_fund_currency(p_target_fund_id);
209: fnd_message.set_name('OZF', 'OZF_API_RECORD_NOT_FOUND');
210: fnd_msg_pub.add;
211: END IF;
212:
213: RAISE fnd_api.g_exc_error;
214: END IF;
215:
216: CLOSE c_to_fund_currency;
217:
224: ,p_from_amount => p_approved_amount
225: ,x_to_amount => l_to_curr_approved_amt
226: ,x_rate => l_rate);
227:
228: IF l_return_status = fnd_api.g_ret_sts_error THEN
229: RAISE fnd_api.g_exc_error;
230: ELSIF l_return_status = fnd_api.g_ret_sts_unexp_error THEN
231: RAISE fnd_api.g_exc_unexpected_error;
232: END IF;
225: ,x_to_amount => l_to_curr_approved_amt
226: ,x_rate => l_rate);
227:
228: IF l_return_status = fnd_api.g_ret_sts_error THEN
229: RAISE fnd_api.g_exc_error;
230: ELSIF l_return_status = fnd_api.g_ret_sts_unexp_error THEN
231: RAISE fnd_api.g_exc_unexpected_error;
232: END IF;
233: ELSE
226: ,x_rate => l_rate);
227:
228: IF l_return_status = fnd_api.g_ret_sts_error THEN
229: RAISE fnd_api.g_exc_error;
230: ELSIF l_return_status = fnd_api.g_ret_sts_unexp_error THEN
231: RAISE fnd_api.g_exc_unexpected_error;
232: END IF;
233: ELSE
234: l_to_curr_approved_amt := p_approved_amount;
227:
228: IF l_return_status = fnd_api.g_ret_sts_error THEN
229: RAISE fnd_api.g_exc_error;
230: ELSIF l_return_status = fnd_api.g_ret_sts_unexp_error THEN
231: RAISE fnd_api.g_exc_unexpected_error;
232: END IF;
233: ELSE
234: l_to_curr_approved_amt := p_approved_amount;
235: END IF; --/// end if transfer currency
248: -- Update source fund
249: -- Source record
250: ozf_funds_pvt.update_fund(
251: p_api_version => l_api_version
252: ,p_init_msg_list => fnd_api.g_false
253: ,p_commit => fnd_api.g_false
254: ,x_return_status => l_return_status
255: ,x_msg_count => l_msg_count
256: ,x_msg_data => l_msg_data
249: -- Source record
250: ozf_funds_pvt.update_fund(
251: p_api_version => l_api_version
252: ,p_init_msg_list => fnd_api.g_false
253: ,p_commit => fnd_api.g_false
254: ,x_return_status => l_return_status
255: ,x_msg_count => l_msg_count
256: ,x_msg_data => l_msg_data
257: ,p_fund_rec => l_source_fund_rec
256: ,x_msg_data => l_msg_data
257: ,p_fund_rec => l_source_fund_rec
258: ,p_mode => 'ADJUST');
259:
260: IF l_return_status = fnd_api.g_ret_sts_error THEN
261: RAISE fnd_api.g_exc_error;
262: ELSIF l_return_status = fnd_api.g_ret_sts_unexp_error THEN
263: RAISE fnd_api.g_exc_unexpected_error;
264: END IF;
257: ,p_fund_rec => l_source_fund_rec
258: ,p_mode => 'ADJUST');
259:
260: IF l_return_status = fnd_api.g_ret_sts_error THEN
261: RAISE fnd_api.g_exc_error;
262: ELSIF l_return_status = fnd_api.g_ret_sts_unexp_error THEN
263: RAISE fnd_api.g_exc_unexpected_error;
264: END IF;
265:
258: ,p_mode => 'ADJUST');
259:
260: IF l_return_status = fnd_api.g_ret_sts_error THEN
261: RAISE fnd_api.g_exc_error;
262: ELSIF l_return_status = fnd_api.g_ret_sts_unexp_error THEN
263: RAISE fnd_api.g_exc_unexpected_error;
264: END IF;
265:
266: OPEN c_target_fund_detail(p_target_fund_id);
259:
260: IF l_return_status = fnd_api.g_ret_sts_error THEN
261: RAISE fnd_api.g_exc_error;
262: ELSIF l_return_status = fnd_api.g_ret_sts_unexp_error THEN
263: RAISE fnd_api.g_exc_unexpected_error;
264: END IF;
265:
266: OPEN c_target_fund_detail(p_target_fund_id);
267: FETCH c_target_fund_detail INTO l_target_rec.target_org_budget,
278: fnd_message.set_name('OZF', 'OZF_API_RECORD_NOT_FOUND');
279: fnd_msg_pub.add;
280: END IF;
281:
282: RAISE fnd_api.g_exc_error;
283: END IF;
284:
285: CLOSE c_target_fund_detail;
286: ozf_funds_pvt.init_fund_rec(x_fund_rec => l_target_fund_rec);
291:
292: IF p_child_flag = 'Y' THEN
293: /*
294: l_target_fund_rec.original_budget := NVL(l_to_curr_approved_amt, 0); ---changed 21st JULY to accomodate
295: l_target_fund_rec.transfered_in_amt := fnd_api.g_miss_num;
296: */
297: -- mpande 11/02/2001 changed
298: l_target_fund_rec.original_budget := 0;
299: l_target_fund_rec.transfered_in_amt := NVL(l_to_curr_approved_amt, 0);
306: ELSE
307: l_target_fund_rec.transfered_in_amt :=
308: NVL(l_target_rec.target_trans_in_amt, 0) + l_to_curr_approved_amt;
309: -- Transfered In AMT added in to fund currency
310: --l_target_fund_rec.original_budget := fnd_api.g_miss_num; --bug fix 3579649:rimehrot
311: END IF;
312:
313: IF G_DEBUG THEN
314: ozf_utility_pvt.debug_message(
322: IF p_requestor_owner = 'N' THEN
323: -- Update target fund to active other wise the caller API ( OZF_FUNDRULES_PVT) will update the fund to active
324: ozf_funds_pvt.update_fund(
325: p_api_version => l_api_version
326: ,p_init_msg_list => fnd_api.g_false
327: ,p_commit => fnd_api.g_false
328: ,x_return_status => l_return_status
329: ,x_msg_count => l_msg_count
330: ,x_msg_data => l_msg_data
323: -- Update target fund to active other wise the caller API ( OZF_FUNDRULES_PVT) will update the fund to active
324: ozf_funds_pvt.update_fund(
325: p_api_version => l_api_version
326: ,p_init_msg_list => fnd_api.g_false
327: ,p_commit => fnd_api.g_false
328: ,x_return_status => l_return_status
329: ,x_msg_count => l_msg_count
330: ,x_msg_data => l_msg_data
331: ,p_fund_rec => l_target_fund_rec
343: fnd_message.set_name('OZF', 'OZF_API_RECORD_NOT_FOUND');
344: fnd_msg_pub.add;
345: END IF;
346:
347: RAISE fnd_api.g_exc_error;
348: END IF;
349:
350: CLOSE c_act_budget_detail;
351: --- update th erequest stauts to approved
361: ,l_act_budget_rec.status_code);
362: -- Fund request record
363: ozf_actbudgets_pvt.update_act_budgets(
364: p_api_version => l_api_version
365: ,p_init_msg_list => fnd_api.g_false
366: ,p_commit => fnd_api.g_false
367: ,x_return_status => l_return_status
368: ,x_msg_count => l_msg_count
369: ,x_msg_data => l_msg_data
362: -- Fund request record
363: ozf_actbudgets_pvt.update_act_budgets(
364: p_api_version => l_api_version
365: ,p_init_msg_list => fnd_api.g_false
366: ,p_commit => fnd_api.g_false
367: ,x_return_status => l_return_status
368: ,x_msg_count => l_msg_count
369: ,x_msg_data => l_msg_data
370: ,p_act_budgets_rec => l_act_budget_rec
367: ,x_return_status => l_return_status
368: ,x_msg_count => l_msg_count
369: ,x_msg_data => l_msg_data
370: ,p_act_budgets_rec => l_act_budget_rec
371: ,p_child_approval_flag => FND_API.g_false
372: ,p_requestor_owner_flag => p_requestor_owner
373: );
374:
375: IF l_return_status = fnd_api.g_ret_sts_error THEN
371: ,p_child_approval_flag => FND_API.g_false
372: ,p_requestor_owner_flag => p_requestor_owner
373: );
374:
375: IF l_return_status = fnd_api.g_ret_sts_error THEN
376: RAISE fnd_api.g_exc_error;
377: ELSIF l_return_status = fnd_api.g_ret_sts_unexp_error THEN
378: RAISE fnd_api.g_exc_unexpected_error;
379: END IF;
372: ,p_requestor_owner_flag => p_requestor_owner
373: );
374:
375: IF l_return_status = fnd_api.g_ret_sts_error THEN
376: RAISE fnd_api.g_exc_error;
377: ELSIF l_return_status = fnd_api.g_ret_sts_unexp_error THEN
378: RAISE fnd_api.g_exc_unexpected_error;
379: END IF;
380: */
373: );
374:
375: IF l_return_status = fnd_api.g_ret_sts_error THEN
376: RAISE fnd_api.g_exc_error;
377: ELSIF l_return_status = fnd_api.g_ret_sts_unexp_error THEN
378: RAISE fnd_api.g_exc_unexpected_error;
379: END IF;
380: */
381: NULL;
374:
375: IF l_return_status = fnd_api.g_ret_sts_error THEN
376: RAISE fnd_api.g_exc_error;
377: ELSIF l_return_status = fnd_api.g_ret_sts_unexp_error THEN
378: RAISE fnd_api.g_exc_unexpected_error;
379: END IF;
380: */
381: NULL;
382: END IF;
383: ELSIF p_child_flag = 'N' THEN
384: -- if not a child transfer always update the target fund
385: ozf_funds_pvt.update_fund(
386: p_api_version => l_api_version
387: ,p_init_msg_list => fnd_api.g_false
388: ,p_commit => fnd_api.g_false
389: ,x_return_status => l_return_status
390: ,x_msg_count => l_msg_count
391: ,x_msg_data => l_msg_data
384: -- if not a child transfer always update the target fund
385: ozf_funds_pvt.update_fund(
386: p_api_version => l_api_version
387: ,p_init_msg_list => fnd_api.g_false
388: ,p_commit => fnd_api.g_false
389: ,x_return_status => l_return_status
390: ,x_msg_count => l_msg_count
391: ,x_msg_data => l_msg_data
392: ,p_fund_rec => l_target_fund_rec
392: ,p_fund_rec => l_target_fund_rec
393: ,p_mode => 'ADJUST');
394: END IF;
395:
396: IF l_return_status = fnd_api.g_ret_sts_error THEN
397: RAISE fnd_api.g_exc_error;
398: ELSIF l_return_status = fnd_api.g_ret_sts_unexp_error THEN
399: RAISE fnd_api.g_exc_unexpected_error;
400: END IF;
393: ,p_mode => 'ADJUST');
394: END IF;
395:
396: IF l_return_status = fnd_api.g_ret_sts_error THEN
397: RAISE fnd_api.g_exc_error;
398: ELSIF l_return_status = fnd_api.g_ret_sts_unexp_error THEN
399: RAISE fnd_api.g_exc_unexpected_error;
400: END IF;
401: -- if the fund transfer is being updated from workflow the request record should be approved
394: END IF;
395:
396: IF l_return_status = fnd_api.g_ret_sts_error THEN
397: RAISE fnd_api.g_exc_error;
398: ELSIF l_return_status = fnd_api.g_ret_sts_unexp_error THEN
399: RAISE fnd_api.g_exc_unexpected_error;
400: END IF;
401: -- if the fund transfer is being updated from workflow the request record should be approved
402: -- other wise the caller API will make it approved
395:
396: IF l_return_status = fnd_api.g_ret_sts_error THEN
397: RAISE fnd_api.g_exc_error;
398: ELSIF l_return_status = fnd_api.g_ret_sts_unexp_error THEN
399: RAISE fnd_api.g_exc_unexpected_error;
400: END IF;
401: -- if the fund transfer is being updated from workflow the request record should be approved
402: -- other wise the caller API will make it approved
403: -- mpande 09/06/2001 IF p_child_flag = 'N' AND p_workflow_flag = 'Y' THEN
413: fnd_message.set_name('OZF', 'OZF_API_RECORD_NOT_FOUND');
414: fnd_msg_pub.add;
415: END IF;
416:
417: RAISE fnd_api.g_exc_error;
418: END IF;
419:
420: CLOSE c_act_budget_detail;
421: ozf_actbudgets_pvt.init_act_budgets_rec(l_act_budget_rec);
432: ,l_act_budget_rec.status_code);
433: -- Fund request record
434: ozf_actbudgets_pvt.update_act_budgets(
435: p_api_version => l_api_version
436: ,p_init_msg_list => fnd_api.g_false
437: ,p_commit => fnd_api.g_false
438: ,x_return_status => l_return_status
439: ,x_msg_count => l_msg_count
440: ,x_msg_data => l_msg_data
433: -- Fund request record
434: ozf_actbudgets_pvt.update_act_budgets(
435: p_api_version => l_api_version
436: ,p_init_msg_list => fnd_api.g_false
437: ,p_commit => fnd_api.g_false
438: ,x_return_status => l_return_status
439: ,x_msg_count => l_msg_count
440: ,x_msg_data => l_msg_data
441: ,p_act_budgets_rec => l_act_budget_rec);
440: ,x_msg_data => l_msg_data
441: ,p_act_budgets_rec => l_act_budget_rec);
442:
443: -- Set the return status
444: IF l_return_status = fnd_api.g_ret_sts_error THEN
445: RAISE fnd_api.g_exc_error;
446: ELSIF l_return_status = fnd_api.g_ret_sts_unexp_error THEN
447: RAISE fnd_api.g_exc_unexpected_error;
448: END IF;
441: ,p_act_budgets_rec => l_act_budget_rec);
442:
443: -- Set the return status
444: IF l_return_status = fnd_api.g_ret_sts_error THEN
445: RAISE fnd_api.g_exc_error;
446: ELSIF l_return_status = fnd_api.g_ret_sts_unexp_error THEN
447: RAISE fnd_api.g_exc_unexpected_error;
448: END IF;
449: END IF ;
442:
443: -- Set the return status
444: IF l_return_status = fnd_api.g_ret_sts_error THEN
445: RAISE fnd_api.g_exc_error;
446: ELSIF l_return_status = fnd_api.g_ret_sts_unexp_error THEN
447: RAISE fnd_api.g_exc_unexpected_error;
448: END IF;
449: END IF ;
450: fnd_msg_pub.count_and_get(
443: -- Set the return status
444: IF l_return_status = fnd_api.g_ret_sts_error THEN
445: RAISE fnd_api.g_exc_error;
446: ELSIF l_return_status = fnd_api.g_ret_sts_unexp_error THEN
447: RAISE fnd_api.g_exc_unexpected_error;
448: END IF;
449: END IF ;
450: fnd_msg_pub.count_and_get(
451: p_encoded => fnd_api.g_false
447: RAISE fnd_api.g_exc_unexpected_error;
448: END IF;
449: END IF ;
450: fnd_msg_pub.count_and_get(
451: p_encoded => fnd_api.g_false
452: ,p_count => x_msg_count
453: ,p_data => x_msg_data);
454:
455: -- Conditional commit;
452: ,p_count => x_msg_count
453: ,p_data => x_msg_data);
454:
455: -- Conditional commit;
456: IF fnd_api.to_boolean(p_commit)
457: AND x_return_status = fnd_api.g_ret_sts_success THEN
458: COMMIT WORK;
459: END IF;
460: EXCEPTION
453: ,p_data => x_msg_data);
454:
455: -- Conditional commit;
456: IF fnd_api.to_boolean(p_commit)
457: AND x_return_status = fnd_api.g_ret_sts_success THEN
458: COMMIT WORK;
459: END IF;
460: EXCEPTION
461: WHEN fnd_api.g_exc_error THEN
457: AND x_return_status = fnd_api.g_ret_sts_success THEN
458: COMMIT WORK;
459: END IF;
460: EXCEPTION
461: WHEN fnd_api.g_exc_error THEN
462: ROLLBACK TO approve_request;
463: x_return_status := fnd_api.g_ret_sts_error;
464: fnd_msg_pub.count_and_get(
465: p_encoded => fnd_api.g_false
459: END IF;
460: EXCEPTION
461: WHEN fnd_api.g_exc_error THEN
462: ROLLBACK TO approve_request;
463: x_return_status := fnd_api.g_ret_sts_error;
464: fnd_msg_pub.count_and_get(
465: p_encoded => fnd_api.g_false
466: ,p_count => x_msg_count
467: ,p_data => x_msg_data);
461: WHEN fnd_api.g_exc_error THEN
462: ROLLBACK TO approve_request;
463: x_return_status := fnd_api.g_ret_sts_error;
464: fnd_msg_pub.count_and_get(
465: p_encoded => fnd_api.g_false
466: ,p_count => x_msg_count
467: ,p_data => x_msg_data);
468: WHEN fnd_api.g_exc_unexpected_error THEN
469: ROLLBACK TO approve_request;
464: fnd_msg_pub.count_and_get(
465: p_encoded => fnd_api.g_false
466: ,p_count => x_msg_count
467: ,p_data => x_msg_data);
468: WHEN fnd_api.g_exc_unexpected_error THEN
469: ROLLBACK TO approve_request;
470: x_return_status := fnd_api.g_ret_sts_unexp_error;
471: fnd_msg_pub.count_and_get(
472: p_encoded => fnd_api.g_false
466: ,p_count => x_msg_count
467: ,p_data => x_msg_data);
468: WHEN fnd_api.g_exc_unexpected_error THEN
469: ROLLBACK TO approve_request;
470: x_return_status := fnd_api.g_ret_sts_unexp_error;
471: fnd_msg_pub.count_and_get(
472: p_encoded => fnd_api.g_false
473: ,p_count => x_msg_count
474: ,p_data => x_msg_data);
468: WHEN fnd_api.g_exc_unexpected_error THEN
469: ROLLBACK TO approve_request;
470: x_return_status := fnd_api.g_ret_sts_unexp_error;
471: fnd_msg_pub.count_and_get(
472: p_encoded => fnd_api.g_false
473: ,p_count => x_msg_count
474: ,p_data => x_msg_data);
475: WHEN OTHERS THEN
476: ROLLBACK TO approve_request;
473: ,p_count => x_msg_count
474: ,p_data => x_msg_data);
475: WHEN OTHERS THEN
476: ROLLBACK TO approve_request;
477: x_return_status := fnd_api.g_ret_sts_unexp_error;
478:
479: IF fnd_msg_pub.check_msg_level(fnd_msg_pub.g_msg_lvl_unexp_error) THEN
480: fnd_msg_pub.add_exc_msg(g_pkg_name, l_api_name);
481: END IF;
480: fnd_msg_pub.add_exc_msg(g_pkg_name, l_api_name);
481: END IF;
482:
483: fnd_msg_pub.count_and_get(
484: p_encoded => fnd_api.g_false
485: ,p_count => x_msg_count
486: ,p_data => x_msg_data);
487: END approve_request;
488:
496: -- called only when the request is rejected or error occured in approval process
497: -- for successful approval, approve_request() is called.
498: --
499: -- IN
500: --p_commit IN VARCHAR2 := fnd_api.g_false
501: --p_update_status IN VARCHAR2 := 'Y'
502: --p_fund_request_id IN NUMBER
503: --p_target_fund_id IN NUMBER
504: --p_source_fund_id IN NUMBER
518: ------------------------------------------------------------------------------
519:
520:
521: PROCEDURE negative_request(
522: p_commit IN VARCHAR2 := fnd_api.g_false
523: ,p_act_budget_id IN NUMBER
524: ,p_target_fund_id IN NUMBER
525: ,p_source_fund_id IN NUMBER
526: ,p_requester_id IN NUMBER
607: fnd_message.set_name('OZF', 'OZF_API_RECORD_NOT_FOUND');
608: fnd_msg_pub.add;
609: END IF;
610:
611: RAISE fnd_api.g_exc_error;
612: END IF;
613:
614: CLOSE c_target_fund_detail;
615: ozf_funds_pvt.init_fund_rec(x_fund_rec => l_target_fund_rec);
631: ELSE
632: l_target_fund_rec.transfered_in_amt :=
633: NVL(l_target_rec.target_trans_in_amt, 0) + l_to_curr_approved_amt;
634: -- Transfered In AMT added in to fund currency
635: l_target_fund_rec.original_budget := fnd_api.g_miss_num;
636: END IF;
637: */
638: IF G_DEBUG THEN
639: ozf_utility_pvt.debug_message(
658:
659: -- Update target fund
660: ozf_funds_pvt.update_fund(
661: p_api_version => l_api_version
662: ,p_init_msg_list => fnd_api.g_false
663: ,p_commit => fnd_api.g_false
664: ,x_return_status => l_return_status
665: ,x_msg_count => l_msg_count
666: ,x_msg_data => l_msg_data
659: -- Update target fund
660: ozf_funds_pvt.update_fund(
661: p_api_version => l_api_version
662: ,p_init_msg_list => fnd_api.g_false
663: ,p_commit => fnd_api.g_false
664: ,x_return_status => l_return_status
665: ,x_msg_count => l_msg_count
666: ,x_msg_data => l_msg_data
667: ,p_fund_rec => l_target_fund_rec
678: fnd_message.set_name('OZF', 'OZF_API_RECORD_NOT_FOUND');
679: fnd_msg_pub.add;
680: END IF;
681:
682: RAISE fnd_api.g_exc_error;
683: END IF;
684:
685: CLOSE c_act_budget_detail;
686: --- update th erequest stauts to pending before submitting
695: ,l_act_budget_rec.status_code);
696: -- Fund request record
697: ozf_actbudgets_pvt.update_act_budgets(
698: p_api_version => l_api_version
699: ,p_init_msg_list => fnd_api.g_false
700: ,p_commit => fnd_api.g_false
701: ,x_return_status => l_return_status
702: ,x_msg_count => l_msg_count
703: ,x_msg_data => l_msg_data
696: -- Fund request record
697: ozf_actbudgets_pvt.update_act_budgets(
698: p_api_version => l_api_version
699: ,p_init_msg_list => fnd_api.g_false
700: ,p_commit => fnd_api.g_false
701: ,x_return_status => l_return_status
702: ,x_msg_count => l_msg_count
703: ,x_msg_data => l_msg_data
704: ,p_act_budgets_rec => l_act_budget_rec
701: ,x_return_status => l_return_status
702: ,x_msg_count => l_msg_count
703: ,x_msg_data => l_msg_data
704: ,p_act_budgets_rec => l_act_budget_rec
705: ,p_child_approval_flag => FND_API.g_true
706: );
707:
708: IF l_return_status = fnd_api.g_ret_sts_error THEN
709: RAISE fnd_api.g_exc_error;
704: ,p_act_budgets_rec => l_act_budget_rec
705: ,p_child_approval_flag => FND_API.g_true
706: );
707:
708: IF l_return_status = fnd_api.g_ret_sts_error THEN
709: RAISE fnd_api.g_exc_error;
710: ELSIF l_return_status = fnd_api.g_ret_sts_unexp_error THEN
711: RAISE fnd_api.g_exc_unexpected_error;
712: END IF;
705: ,p_child_approval_flag => FND_API.g_true
706: );
707:
708: IF l_return_status = fnd_api.g_ret_sts_error THEN
709: RAISE fnd_api.g_exc_error;
710: ELSIF l_return_status = fnd_api.g_ret_sts_unexp_error THEN
711: RAISE fnd_api.g_exc_unexpected_error;
712: END IF;
713: END IF;
706: );
707:
708: IF l_return_status = fnd_api.g_ret_sts_error THEN
709: RAISE fnd_api.g_exc_error;
710: ELSIF l_return_status = fnd_api.g_ret_sts_unexp_error THEN
711: RAISE fnd_api.g_exc_unexpected_error;
712: END IF;
713: END IF;
714:
707:
708: IF l_return_status = fnd_api.g_ret_sts_error THEN
709: RAISE fnd_api.g_exc_error;
710: ELSIF l_return_status = fnd_api.g_ret_sts_unexp_error THEN
711: RAISE fnd_api.g_exc_unexpected_error;
712: END IF;
713: END IF;
714:
715: ELSIF p_child_flag = 'N' THEN
714:
715: ELSIF p_child_flag = 'N' THEN
716: ozf_funds_pvt.update_fund(
717: p_api_version => l_api_version
718: ,p_init_msg_list => fnd_api.g_false
719: ,p_commit => fnd_api.g_false
720: ,x_return_status => l_return_status
721: ,x_msg_count => l_msg_count
722: ,x_msg_data => l_msg_data
715: ELSIF p_child_flag = 'N' THEN
716: ozf_funds_pvt.update_fund(
717: p_api_version => l_api_version
718: ,p_init_msg_list => fnd_api.g_false
719: ,p_commit => fnd_api.g_false
720: ,x_return_status => l_return_status
721: ,x_msg_count => l_msg_count
722: ,x_msg_data => l_msg_data
723: ,p_fund_rec => l_target_fund_rec
725: */
726: END IF;
727: END IF;
728:
729: IF l_return_status = fnd_api.g_ret_sts_error THEN
730: RAISE fnd_api.g_exc_error;
731: ELSIF l_return_status = fnd_api.g_ret_sts_unexp_error THEN
732: RAISE fnd_api.g_exc_unexpected_error;
733: END IF;
726: END IF;
727: END IF;
728:
729: IF l_return_status = fnd_api.g_ret_sts_error THEN
730: RAISE fnd_api.g_exc_error;
731: ELSIF l_return_status = fnd_api.g_ret_sts_unexp_error THEN
732: RAISE fnd_api.g_exc_unexpected_error;
733: END IF;
734:
727: END IF;
728:
729: IF l_return_status = fnd_api.g_ret_sts_error THEN
730: RAISE fnd_api.g_exc_error;
731: ELSIF l_return_status = fnd_api.g_ret_sts_unexp_error THEN
732: RAISE fnd_api.g_exc_unexpected_error;
733: END IF;
734:
735: -- Fund Request Detail
728:
729: IF l_return_status = fnd_api.g_ret_sts_error THEN
730: RAISE fnd_api.g_exc_error;
731: ELSIF l_return_status = fnd_api.g_ret_sts_unexp_error THEN
732: RAISE fnd_api.g_exc_unexpected_error;
733: END IF;
734:
735: -- Fund Request Detail
736: OPEN c_act_budget_detail(p_act_budget_id);
743: fnd_message.set_name('OZF', 'OZF_API_RECORD_NOT_FOUND');
744: fnd_msg_pub.add;
745: END IF;
746:
747: RAISE fnd_api.g_exc_error;
748: END IF;
749:
750: CLOSE c_act_budget_detail;
751: ozf_actbudgets_pvt.init_act_budgets_rec(l_act_budget_rec);
762: l_act_budget_rec.comment := p_note;
763: -- Fund request record
764: ozf_actbudgets_pvt.update_act_budgets(
765: p_api_version => l_api_version
766: ,p_init_msg_list => fnd_api.g_false
767: ,p_commit => fnd_api.g_false
768: ,x_return_status => l_return_status
769: ,x_msg_count => l_msg_count
770: ,x_msg_data => l_msg_data
763: -- Fund request record
764: ozf_actbudgets_pvt.update_act_budgets(
765: p_api_version => l_api_version
766: ,p_init_msg_list => fnd_api.g_false
767: ,p_commit => fnd_api.g_false
768: ,x_return_status => l_return_status
769: ,x_msg_count => l_msg_count
770: ,x_msg_data => l_msg_data
771: ,p_act_budgets_rec => l_act_budget_rec);
770: ,x_msg_data => l_msg_data
771: ,p_act_budgets_rec => l_act_budget_rec);
772:
773: -- Set the return status
774: IF l_return_status = fnd_api.g_ret_sts_error THEN
775: RAISE fnd_api.g_exc_error;
776: ELSIF l_return_status = fnd_api.g_ret_sts_unexp_error THEN
777: RAISE fnd_api.g_exc_unexpected_error;
778: END IF;
771: ,p_act_budgets_rec => l_act_budget_rec);
772:
773: -- Set the return status
774: IF l_return_status = fnd_api.g_ret_sts_error THEN
775: RAISE fnd_api.g_exc_error;
776: ELSIF l_return_status = fnd_api.g_ret_sts_unexp_error THEN
777: RAISE fnd_api.g_exc_unexpected_error;
778: END IF;
779:
772:
773: -- Set the return status
774: IF l_return_status = fnd_api.g_ret_sts_error THEN
775: RAISE fnd_api.g_exc_error;
776: ELSIF l_return_status = fnd_api.g_ret_sts_unexp_error THEN
777: RAISE fnd_api.g_exc_unexpected_error;
778: END IF;
779:
780: fnd_msg_pub.count_and_get(
773: -- Set the return status
774: IF l_return_status = fnd_api.g_ret_sts_error THEN
775: RAISE fnd_api.g_exc_error;
776: ELSIF l_return_status = fnd_api.g_ret_sts_unexp_error THEN
777: RAISE fnd_api.g_exc_unexpected_error;
778: END IF;
779:
780: fnd_msg_pub.count_and_get(
781: p_encoded => fnd_api.g_false
777: RAISE fnd_api.g_exc_unexpected_error;
778: END IF;
779:
780: fnd_msg_pub.count_and_get(
781: p_encoded => fnd_api.g_false
782: ,p_count => x_msg_count
783: ,p_data => x_msg_data);
784:
785: -- Conditional commit;
782: ,p_count => x_msg_count
783: ,p_data => x_msg_data);
784:
785: -- Conditional commit;
786: IF fnd_api.to_boolean(p_commit)
787: AND x_return_status = fnd_api.g_ret_sts_success THEN
788: COMMIT WORK;
789: END IF;
790: EXCEPTION
783: ,p_data => x_msg_data);
784:
785: -- Conditional commit;
786: IF fnd_api.to_boolean(p_commit)
787: AND x_return_status = fnd_api.g_ret_sts_success THEN
788: COMMIT WORK;
789: END IF;
790: EXCEPTION
791: WHEN fnd_api.g_exc_error THEN
787: AND x_return_status = fnd_api.g_ret_sts_success THEN
788: COMMIT WORK;
789: END IF;
790: EXCEPTION
791: WHEN fnd_api.g_exc_error THEN
792: ROLLBACK TO negative_request;
793: x_return_status := fnd_api.g_ret_sts_error;
794: fnd_msg_pub.count_and_get(
795: p_encoded => fnd_api.g_false
789: END IF;
790: EXCEPTION
791: WHEN fnd_api.g_exc_error THEN
792: ROLLBACK TO negative_request;
793: x_return_status := fnd_api.g_ret_sts_error;
794: fnd_msg_pub.count_and_get(
795: p_encoded => fnd_api.g_false
796: ,p_count => x_msg_count
797: ,p_data => x_msg_data);
791: WHEN fnd_api.g_exc_error THEN
792: ROLLBACK TO negative_request;
793: x_return_status := fnd_api.g_ret_sts_error;
794: fnd_msg_pub.count_and_get(
795: p_encoded => fnd_api.g_false
796: ,p_count => x_msg_count
797: ,p_data => x_msg_data);
798: WHEN fnd_api.g_exc_unexpected_error THEN
799: ROLLBACK TO negative_request;
794: fnd_msg_pub.count_and_get(
795: p_encoded => fnd_api.g_false
796: ,p_count => x_msg_count
797: ,p_data => x_msg_data);
798: WHEN fnd_api.g_exc_unexpected_error THEN
799: ROLLBACK TO negative_request;
800: x_return_status := fnd_api.g_ret_sts_unexp_error;
801: fnd_msg_pub.count_and_get(
802: p_encoded => fnd_api.g_false
796: ,p_count => x_msg_count
797: ,p_data => x_msg_data);
798: WHEN fnd_api.g_exc_unexpected_error THEN
799: ROLLBACK TO negative_request;
800: x_return_status := fnd_api.g_ret_sts_unexp_error;
801: fnd_msg_pub.count_and_get(
802: p_encoded => fnd_api.g_false
803: ,p_count => x_msg_count
804: ,p_data => x_msg_data);
798: WHEN fnd_api.g_exc_unexpected_error THEN
799: ROLLBACK TO negative_request;
800: x_return_status := fnd_api.g_ret_sts_unexp_error;
801: fnd_msg_pub.count_and_get(
802: p_encoded => fnd_api.g_false
803: ,p_count => x_msg_count
804: ,p_data => x_msg_data);
805: WHEN OTHERS THEN
806: ROLLBACK TO negative_request;
803: ,p_count => x_msg_count
804: ,p_data => x_msg_data);
805: WHEN OTHERS THEN
806: ROLLBACK TO negative_request;
807: x_return_status := fnd_api.g_ret_sts_unexp_error;
808:
809: IF fnd_msg_pub.check_msg_level(fnd_msg_pub.g_msg_lvl_unexp_error) THEN
810: fnd_msg_pub.add_exc_msg(g_pkg_name, l_api_name);
811: END IF;
810: fnd_msg_pub.add_exc_msg(g_pkg_name, l_api_name);
811: END IF;
812:
813: fnd_msg_pub.count_and_get(
814: p_encoded => fnd_api.g_false
815: ,p_count => x_msg_count
816: ,p_data => x_msg_data);
817: END negative_request;
818:
825: -- This Procedure will create the fund request
826: --
827: --
828: -- IN
829: -- p_commit IN VARCHAR2 := fnd_api.g_false
830: -- p_update_status IN VARCHAR2 := 'Y'
831: -- p_approval_for IN VARCHAR2 := 'FUND'
832: -- p_approval_for_id IN NUMBER
833: -- p_requester_id IN NUMBER
836: -- p_approval_fm_id IN NUMBER DEFAULT NULL
837: -- p_transfer_type IN VARCHAR2 := 'TRANSFER' --- 'REQUEST' OR 'TRANSFER'
838: -- p_child_flag IN VARCHAR2 := 'N' -- flag to indicate wether it is a child fund creation
839: -- p_act_budget_id IN NUMBER := NULL -- request_id ( for a child fund it is null)
840: -- p_init_msg_list IN VARCHAR2 := fnd_api.g_false
841: -- p_justification IN VARCHAR2
842: --
843: -- OUT
844: -- x_return_status OUT VARCHAR2
857: -- HISTORY
858: -- 02/20/2001 MUMU PANDE CREATION
859: -- End of Comments
860: PROCEDURE create_fund_request(
861: p_commit IN VARCHAR2 := fnd_api.g_false
862: ,p_update_status IN VARCHAR2 := 'Y'
863: ,p_approval_for IN VARCHAR2 := 'FUND'
864: ,p_approval_for_id IN NUMBER
865: ,p_requester_id IN NUMBER
869: ,p_approval_fm_id IN NUMBER
870: ,p_transfer_type IN VARCHAR2 := 'REQUEST' --- 'REQUEST' OR 'TRANSFER'
871: ,p_child_flag IN VARCHAR2 := 'N' -- flag to indicate whether it is a child fund creation
872: ,p_act_budget_id IN NUMBER := NULL -- request_id ( for a child fund it is null)
873: ,p_init_msg_list IN VARCHAR2 := fnd_api.g_false
874: ,p_justification IN VARCHAR2
875: ,p_allocation_flag IN VARCHAR2 := 'N' -- flag to indicate whether it is an allocation or not
876: ,x_return_status OUT NOCOPY VARCHAR2
877: ,x_msg_count OUT NOCOPY NUMBER
883: IS
884: -- Local variables
885: l_api_version CONSTANT NUMBER := 1.0;
886: l_return_status VARCHAR2(1)
887: := fnd_api.g_ret_sts_success;
888: l_msg_count NUMBER;
889: l_msg_data VARCHAR2(4000);
890: l_api_name CONSTANT VARCHAR2(30)
891: := 'Create_Fund_Request';
949:
950: l_act_budget_appr_rec c_act_budget_rec%ROWTYPE;
951: BEGIN
952: SAVEPOINT create_fund_request;
953: x_return_status := fnd_api.g_ret_sts_success;
954: -- Initialize
955: IF G_DEBUG THEN
956: ozf_utility_pvt.debug_message(l_full_name || ': start');
957: END IF;
982: ,p_act_budgets_rec => l_act_budget_rec
983: ,x_act_budget_id => l_act_budget_id);
984:
985: ------------if no request is created terminate the process
986: IF l_return_status = fnd_api.g_ret_sts_error THEN
987: RAISE fnd_api.g_exc_error;
988: ELSIF l_return_status = fnd_api.g_ret_sts_unexp_error THEN
989: RAISE fnd_api.g_exc_unexpected_error;
990: END IF;
983: ,x_act_budget_id => l_act_budget_id);
984:
985: ------------if no request is created terminate the process
986: IF l_return_status = fnd_api.g_ret_sts_error THEN
987: RAISE fnd_api.g_exc_error;
988: ELSIF l_return_status = fnd_api.g_ret_sts_unexp_error THEN
989: RAISE fnd_api.g_exc_unexpected_error;
990: END IF;
991:
984:
985: ------------if no request is created terminate the process
986: IF l_return_status = fnd_api.g_ret_sts_error THEN
987: RAISE fnd_api.g_exc_error;
988: ELSIF l_return_status = fnd_api.g_ret_sts_unexp_error THEN
989: RAISE fnd_api.g_exc_unexpected_error;
990: END IF;
991:
992: IF G_DEBUG THEN
985: ------------if no request is created terminate the process
986: IF l_return_status = fnd_api.g_ret_sts_error THEN
987: RAISE fnd_api.g_exc_error;
988: ELSIF l_return_status = fnd_api.g_ret_sts_unexp_error THEN
989: RAISE fnd_api.g_exc_unexpected_error;
990: END IF;
991:
992: IF G_DEBUG THEN
993: ozf_utility_pvt.debug_message(l_full_name || ': end creating request');
1005: fnd_message.set_name('OZF', 'OZF_API_RECORD_NOT_FOUND');
1006: fnd_msg_pub.add;
1007: END IF;
1008:
1009: RAISE fnd_api.g_exc_error;
1010: END IF;
1011:
1012: CLOSE c_parent_fund_owner;
1013:
1023: fnd_message.set_name('OZF', 'OZF_API_RECORD_NOT_FOUND');
1024: fnd_msg_pub.add;
1025: END IF;
1026:
1027: RAISE fnd_api.g_exc_error;
1028: END IF;
1029:
1030: CLOSE c_parent_fund_owner;
1031: -- 10/22/2001 mpande Changed code different owner allocation bug
1052: fnd_message.set_name('OZF', 'OZF_API_RECORD_NOT_FOUND');
1053: fnd_msg_pub.add;
1054: END IF;
1055:
1056: RAISE fnd_api.g_exc_error;
1057: END IF;
1058:
1059: CLOSE c_fm_fund_currency;
1060: OPEN c_to_fund_currency(p_approval_for_id);
1067: fnd_message.set_name('OZF', 'OZF_API_RECORD_NOT_FOUND');
1068: fnd_msg_pub.add;
1069: END IF;
1070:
1071: RAISE fnd_api.g_exc_error;
1072: END IF;
1073:
1074: CLOSE c_to_fund_currency;
1075:
1082: ,p_from_amount => p_requested_amount
1083: ,x_to_amount => l_fm_curr_requested_amount
1084: ,x_rate => l_rate);
1085:
1086: IF l_return_status = fnd_api.g_ret_sts_error THEN
1087: RAISE fnd_api.g_exc_error;
1088: ELSIF l_return_status = fnd_api.g_ret_sts_unexp_error THEN
1089: RAISE fnd_api.g_exc_unexpected_error;
1090: END IF;
1083: ,x_to_amount => l_fm_curr_requested_amount
1084: ,x_rate => l_rate);
1085:
1086: IF l_return_status = fnd_api.g_ret_sts_error THEN
1087: RAISE fnd_api.g_exc_error;
1088: ELSIF l_return_status = fnd_api.g_ret_sts_unexp_error THEN
1089: RAISE fnd_api.g_exc_unexpected_error;
1090: END IF;
1091: ELSE
1084: ,x_rate => l_rate);
1085:
1086: IF l_return_status = fnd_api.g_ret_sts_error THEN
1087: RAISE fnd_api.g_exc_error;
1088: ELSIF l_return_status = fnd_api.g_ret_sts_unexp_error THEN
1089: RAISE fnd_api.g_exc_unexpected_error;
1090: END IF;
1091: ELSE
1092: l_fm_curr_requested_amount := NVL(p_requested_amount, 0); -- when currencies are the same the
1085:
1086: IF l_return_status = fnd_api.g_ret_sts_error THEN
1087: RAISE fnd_api.g_exc_error;
1088: ELSIF l_return_status = fnd_api.g_ret_sts_unexp_error THEN
1089: RAISE fnd_api.g_exc_unexpected_error;
1090: END IF;
1091: ELSE
1092: l_fm_curr_requested_amount := NVL(p_requested_amount, 0); -- when currencies are the same the
1093: END IF; -- end if transfer currency
1103: fnd_message.set_name('OZF', 'OZF_API_RECORD_NOT_FOUND');
1104: fnd_msg_pub.add;
1105: END IF;
1106:
1107: RAISE fnd_api.g_exc_error;
1108: END IF;
1109:
1110: CLOSE c_act_budget_rec;
1111:
1126: ,l_act_budget_rec.status_code);
1127: -- Fund request record
1128: ozf_actbudgets_pvt.update_act_budgets(
1129: p_api_version => l_api_version
1130: ,p_init_msg_list => fnd_api.g_false
1131: ,p_commit => fnd_api.g_false
1132: ,x_return_status => l_return_status
1133: ,x_msg_count => l_msg_count
1134: ,x_msg_data => l_msg_data
1127: -- Fund request record
1128: ozf_actbudgets_pvt.update_act_budgets(
1129: p_api_version => l_api_version
1130: ,p_init_msg_list => fnd_api.g_false
1131: ,p_commit => fnd_api.g_false
1132: ,x_return_status => l_return_status
1133: ,x_msg_count => l_msg_count
1134: ,x_msg_data => l_msg_data
1135: ,p_act_budgets_rec => l_act_budget_rec
1132: ,x_return_status => l_return_status
1133: ,x_msg_count => l_msg_count
1134: ,x_msg_data => l_msg_data
1135: ,p_act_budgets_rec => l_act_budget_rec
1136: ,p_child_approval_flag => FND_API.g_true
1137: -- 10/22/2001 mpande Changed code different owner allocation bug
1138: ,p_requestor_owner_flag =>x_is_requester_owner );
1139:
1140: IF l_return_status = fnd_api.g_ret_sts_error THEN
1136: ,p_child_approval_flag => FND_API.g_true
1137: -- 10/22/2001 mpande Changed code different owner allocation bug
1138: ,p_requestor_owner_flag =>x_is_requester_owner );
1139:
1140: IF l_return_status = fnd_api.g_ret_sts_error THEN
1141: RAISE fnd_api.g_exc_error;
1142: ELSIF l_return_status = fnd_api.g_ret_sts_unexp_error THEN
1143: RAISE fnd_api.g_exc_unexpected_error;
1144: END IF;
1137: -- 10/22/2001 mpande Changed code different owner allocation bug
1138: ,p_requestor_owner_flag =>x_is_requester_owner );
1139:
1140: IF l_return_status = fnd_api.g_ret_sts_error THEN
1141: RAISE fnd_api.g_exc_error;
1142: ELSIF l_return_status = fnd_api.g_ret_sts_unexp_error THEN
1143: RAISE fnd_api.g_exc_unexpected_error;
1144: END IF;
1145: -- if child fund the object veriosn number is +1
1138: ,p_requestor_owner_flag =>x_is_requester_owner );
1139:
1140: IF l_return_status = fnd_api.g_ret_sts_error THEN
1141: RAISE fnd_api.g_exc_error;
1142: ELSIF l_return_status = fnd_api.g_ret_sts_unexp_error THEN
1143: RAISE fnd_api.g_exc_unexpected_error;
1144: END IF;
1145: -- if child fund the object veriosn number is +1
1146: l_act_budget_appr_rec.object_version_number := l_act_budget_appr_rec.object_version_number +1 ;
1139:
1140: IF l_return_status = fnd_api.g_ret_sts_error THEN
1141: RAISE fnd_api.g_exc_error;
1142: ELSIF l_return_status = fnd_api.g_ret_sts_unexp_error THEN
1143: RAISE fnd_api.g_exc_unexpected_error;
1144: END IF;
1145: -- if child fund the object veriosn number is +1
1146: l_act_budget_appr_rec.object_version_number := l_act_budget_appr_rec.object_version_number +1 ;
1147: END IF; -- end if for child fund
1150: -- else trigger the workflow
1151: IF x_is_requester_owner = 'Y' THEN
1152: -- apporve it directly if requester and owner is the same
1153: approve_request(
1154: p_commit => fnd_api.g_false
1155: ,p_update_status => p_update_status
1156: ,p_act_budget_id => l_act_budget_id
1157: ,p_target_fund_id => p_approval_for_id
1158: ,p_source_fund_id => p_approval_fm_id
1166: ,x_return_status => l_return_status
1167: ,x_msg_count => l_msg_count
1168: ,x_msg_data => l_msg_data);
1169:
1170: IF l_return_status = fnd_api.g_ret_sts_error THEN
1171: RAISE fnd_api.g_exc_error;
1172: ELSIF l_return_status = fnd_api.g_ret_sts_unexp_error THEN
1173: RAISE fnd_api.g_exc_unexpected_error;
1174: END IF;
1167: ,x_msg_count => l_msg_count
1168: ,x_msg_data => l_msg_data);
1169:
1170: IF l_return_status = fnd_api.g_ret_sts_error THEN
1171: RAISE fnd_api.g_exc_error;
1172: ELSIF l_return_status = fnd_api.g_ret_sts_unexp_error THEN
1173: RAISE fnd_api.g_exc_unexpected_error;
1174: END IF;
1175: ELSIF x_is_requester_owner = 'N' THEN
1168: ,x_msg_data => l_msg_data);
1169:
1170: IF l_return_status = fnd_api.g_ret_sts_error THEN
1171: RAISE fnd_api.g_exc_error;
1172: ELSIF l_return_status = fnd_api.g_ret_sts_unexp_error THEN
1173: RAISE fnd_api.g_exc_unexpected_error;
1174: END IF;
1175: ELSIF x_is_requester_owner = 'N' THEN
1176:
1169:
1170: IF l_return_status = fnd_api.g_ret_sts_error THEN
1171: RAISE fnd_api.g_exc_error;
1172: ELSIF l_return_status = fnd_api.g_ret_sts_unexp_error THEN
1173: RAISE fnd_api.g_exc_unexpected_error;
1174: END IF;
1175: ELSIF x_is_requester_owner = 'N' THEN
1176:
1177: l_new_status_id :=
1200:
1201: END IF; -- ENDIF x_is_requester_owner
1202:
1203: -- Conditional commit;
1204: IF fnd_api.to_boolean(p_commit)
1205: AND x_return_status = fnd_api.g_ret_sts_success THEN
1206: COMMIT WORK;
1207: END IF;
1208:
1201: END IF; -- ENDIF x_is_requester_owner
1202:
1203: -- Conditional commit;
1204: IF fnd_api.to_boolean(p_commit)
1205: AND x_return_status = fnd_api.g_ret_sts_success THEN
1206: COMMIT WORK;
1207: END IF;
1208:
1209: fnd_msg_pub.count_and_get(
1206: COMMIT WORK;
1207: END IF;
1208:
1209: fnd_msg_pub.count_and_get(
1210: p_encoded => fnd_api.g_false
1211: ,p_count => x_msg_count
1212: ,p_data => x_msg_data);
1213: EXCEPTION
1214: WHEN fnd_api.g_exc_error THEN
1210: p_encoded => fnd_api.g_false
1211: ,p_count => x_msg_count
1212: ,p_data => x_msg_data);
1213: EXCEPTION
1214: WHEN fnd_api.g_exc_error THEN
1215: ROLLBACK TO create_fund_request;
1216: x_return_status := fnd_api.g_ret_sts_error;
1217: fnd_msg_pub.count_and_get(
1218: p_encoded => fnd_api.g_false
1212: ,p_data => x_msg_data);
1213: EXCEPTION
1214: WHEN fnd_api.g_exc_error THEN
1215: ROLLBACK TO create_fund_request;
1216: x_return_status := fnd_api.g_ret_sts_error;
1217: fnd_msg_pub.count_and_get(
1218: p_encoded => fnd_api.g_false
1219: ,p_count => x_msg_count
1220: ,p_data => x_msg_data);
1214: WHEN fnd_api.g_exc_error THEN
1215: ROLLBACK TO create_fund_request;
1216: x_return_status := fnd_api.g_ret_sts_error;
1217: fnd_msg_pub.count_and_get(
1218: p_encoded => fnd_api.g_false
1219: ,p_count => x_msg_count
1220: ,p_data => x_msg_data);
1221: WHEN fnd_api.g_exc_unexpected_error THEN
1222: ROLLBACK TO create_fund_request;
1217: fnd_msg_pub.count_and_get(
1218: p_encoded => fnd_api.g_false
1219: ,p_count => x_msg_count
1220: ,p_data => x_msg_data);
1221: WHEN fnd_api.g_exc_unexpected_error THEN
1222: ROLLBACK TO create_fund_request;
1223: x_return_status := fnd_api.g_ret_sts_unexp_error;
1224: fnd_msg_pub.count_and_get(
1225: p_encoded => fnd_api.g_false
1219: ,p_count => x_msg_count
1220: ,p_data => x_msg_data);
1221: WHEN fnd_api.g_exc_unexpected_error THEN
1222: ROLLBACK TO create_fund_request;
1223: x_return_status := fnd_api.g_ret_sts_unexp_error;
1224: fnd_msg_pub.count_and_get(
1225: p_encoded => fnd_api.g_false
1226: ,p_count => x_msg_count
1227: ,p_data => x_msg_data);
1221: WHEN fnd_api.g_exc_unexpected_error THEN
1222: ROLLBACK TO create_fund_request;
1223: x_return_status := fnd_api.g_ret_sts_unexp_error;
1224: fnd_msg_pub.count_and_get(
1225: p_encoded => fnd_api.g_false
1226: ,p_count => x_msg_count
1227: ,p_data => x_msg_data);
1228: WHEN OTHERS THEN
1229: ROLLBACK TO create_fund_request;
1226: ,p_count => x_msg_count
1227: ,p_data => x_msg_data);
1228: WHEN OTHERS THEN
1229: ROLLBACK TO create_fund_request;
1230: x_return_status := fnd_api.g_ret_sts_unexp_error;
1231:
1232: IF fnd_msg_pub.check_msg_level(fnd_msg_pub.g_msg_lvl_unexp_error) THEN
1233: fnd_msg_pub.add_exc_msg(g_pkg_name, l_api_name);
1234: END IF;
1233: fnd_msg_pub.add_exc_msg(g_pkg_name, l_api_name);
1234: END IF;
1235:
1236: fnd_msg_pub.count_and_get(
1237: p_encoded => fnd_api.g_false
1238: ,p_count => x_msg_count
1239: ,p_data => x_msg_data);
1240: END create_fund_request;
1241:
2307: fnd_message.set_name('OZF', 'OZF_API_RECORD_NOT_FOUND');
2308: fnd_msg_pub.add;
2309: END IF;
2310:
2311: RAISE fnd_api.g_exc_error;
2312: END IF;
2313: CLOSE c_act_budget_rec;
2314: OPEN c_fund_rec(l_fund_id);
2315: FETCH c_fund_rec INTO l_object_details.name,
2329: fnd_message.set_name('OZF', 'OZF_API_RECORD_NOT_FOUND');
2330: fnd_msg_pub.add;
2331: END IF;
2332:
2333: RAISE fnd_api.g_exc_error;
2334: END IF;
2335: CLOSE c_fund_rec;
2336: ELSE
2337: OPEN c_transfer_rec(l_activity_id);
2351: fnd_message.set_name('OZF', 'OZF_API_RECORD_NOT_FOUND');
2352: fnd_msg_pub.add;
2353: END IF;
2354:
2355: RAISE fnd_api.g_exc_error;
2356: END IF;
2357: CLOSE c_transfer_rec;
2358:
2359: END IF;
2369: fnd_message.set_name('OZF', 'OZF_API_RECORD_NOT_FOUND');
2370: fnd_msg_pub.add;
2371: END IF;
2372:
2373: RAISE fnd_api.g_exc_error;
2374: END IF;
2375: CLOSE c_budget_src_rec;
2376:
2377: /*Fix for Bug 7290977*/
2396: ,x_approval_detail_id => l_approval_detail_id
2397: ,x_approver_seq => l_approver_seq
2398: ,x_return_status => l_return_status);
2399:
2400: IF l_return_status = fnd_api.g_ret_sts_success THEN
2401: wf_engine.setitemattrnumber(
2402: itemtype => itemtype
2403: ,itemkey => itemkey
2404: ,aname => 'AMS_APPROVAL_DETAIL_ID'
2503:
2504: resultout := 'COMPLETE:SUCCESS';
2505: ELSE
2506: fnd_msg_pub.count_and_get(
2507: p_encoded => fnd_api.g_false
2508: ,p_count => l_msg_count
2509: ,p_data => l_msg_data);
2510: ams_gen_approval_pvt.handle_err(
2511: p_itemtype => itemtype
2521: ,itemtype
2522: ,itemkey
2523: ,actid
2524: ,l_error_msg);
2525: -- RAISE FND_API.G_EXC_ERROR;
2526: resultout := 'COMPLETE:ERROR';
2527: END IF;
2528: END IF;
2529:
2544: END IF;
2545: --
2546:
2547: EXCEPTION
2548: WHEN fnd_api.g_exc_error THEN
2549: wf_core.context(
2550: 'ozf_fund_request_apr_pvt'
2551: ,'Set_trans_Activity_Detail'
2552: ,itemtype
2556: ,l_error_msg);
2557: RAISE;
2558: WHEN OTHERS THEN
2559: fnd_msg_pub.count_and_get(
2560: p_encoded => fnd_api.g_false
2561: ,p_count => l_msg_count
2562: ,p_data => l_msg_data);
2563: ams_gen_approval_pvt.handle_err(
2564: p_itemtype => itemtype
2696: ,resultout OUT NOCOPY VARCHAR2)
2697: IS
2698: l_status_code VARCHAR2(30);
2699: l_api_version CONSTANT NUMBER := 1.0;
2700: l_return_status VARCHAR2(1) := fnd_api.g_ret_sts_success;
2701: l_msg_count NUMBER;
2702: l_msg_data VARCHAR2(4000);
2703: l_api_name CONSTANT VARCHAR2(30) := 'Update_ParBudget_Status';
2704: l_full_name CONSTANT VARCHAR2(60) := g_pkg_name || '.' || l_api_name;
2862: fnd_message.set_name('OZF', 'OZF_API_RECORD_NOT_FOUND');
2863: fnd_msg_pub.add;
2864: END IF;
2865:
2866: RAISE fnd_api.g_exc_error;
2867: END IF;
2868: CLOSE c_act_budget_rec;
2869:
2870: -- [BEGIN OF BUG 2750841(same as 2741039) FIXING by yzhao 01/10/2003]
2883: ,p_from_amount=> l_approved_amount
2884: ,x_to_amount=> l_approved_amt_in_from_curr
2885: );
2886:
2887: IF l_return_status = fnd_api.g_ret_sts_unexp_error THEN
2888: RAISE fnd_api.g_exc_unexpected_error;
2889: ELSIF l_return_status = fnd_api.g_ret_sts_error THEN
2890: RAISE fnd_api.g_exc_error;
2891: END IF;
2884: ,x_to_amount=> l_approved_amt_in_from_curr
2885: );
2886:
2887: IF l_return_status = fnd_api.g_ret_sts_unexp_error THEN
2888: RAISE fnd_api.g_exc_unexpected_error;
2889: ELSIF l_return_status = fnd_api.g_ret_sts_error THEN
2890: RAISE fnd_api.g_exc_error;
2891: END IF;
2892:
2885: );
2886:
2887: IF l_return_status = fnd_api.g_ret_sts_unexp_error THEN
2888: RAISE fnd_api.g_exc_unexpected_error;
2889: ELSIF l_return_status = fnd_api.g_ret_sts_error THEN
2890: RAISE fnd_api.g_exc_error;
2891: END IF;
2892:
2893: ELSE
2886:
2887: IF l_return_status = fnd_api.g_ret_sts_unexp_error THEN
2888: RAISE fnd_api.g_exc_unexpected_error;
2889: ELSIF l_return_status = fnd_api.g_ret_sts_error THEN
2890: RAISE fnd_api.g_exc_error;
2891: END IF;
2892:
2893: ELSE
2894: l_approved_amt_in_from_curr := l_approved_amount;
2893: ELSE
2894: l_approved_amt_in_from_curr := l_approved_amount;
2895: END IF;
2896:
2897: -- x_return_status := fnd_api.g_ret_sts_success;
2898: l_status_code := ozf_utility_pvt.get_system_status_code(l_next_status_id);
2899:
2900: IF l_update_status = 'APPROVED' THEN
2901: approve_request(
2898: l_status_code := ozf_utility_pvt.get_system_status_code(l_next_status_id);
2899:
2900: IF l_update_status = 'APPROVED' THEN
2901: approve_request(
2902: p_commit => fnd_api.g_false
2903: ,p_update_status => 'Y'
2904: ,p_act_budget_id => l_act_budget_id
2905: ,p_target_fund_id => l_approval_for_id
2906: ,p_source_fund_id => l_approval_fm_id
2917: ,p_note => l_note);
2918: ELSE
2919: -- 6/14/2002 mpande changed for implementaion of ENH#2352621
2920: negative_request(
2921: p_commit => fnd_api.g_false
2922: ,p_act_budget_id => l_act_budget_id
2923: ,p_target_fund_id => l_approval_for_id
2924: ,p_source_fund_id => l_approval_fm_id
2925: ,p_requester_id => l_requester_id
2935: ,x_msg_count => l_msg_count
2936: ,x_msg_data => l_msg_data);
2937: END IF;
2938:
2939: IF l_return_status <> fnd_api.g_ret_sts_success THEN
2940: ams_gen_approval_pvt.handle_err(
2941: p_itemtype => itemtype
2942: ,p_itemkey => itemkey
2943: ,p_msg_count => l_msg_count
2968: RETURN;
2969: END IF;
2970:
2971: fnd_msg_pub.count_and_get(
2972: p_encoded => fnd_api.g_false
2973: ,p_count => l_msg_count
2974: ,p_data => l_msg_data);
2975: IF G_DEBUG THEN
2976: ozf_utility_pvt.debug_message(l_full_name || ': l_return_status' || l_return_status);
2976: ozf_utility_pvt.debug_message(l_full_name || ': l_return_status' || l_return_status);
2977: END IF;
2978: EXCEPTION
2979: WHEN OTHERS THEN
2980: -- x_return_status := fnd_api.g_ret_sts_error;
2981: fnd_msg_pub.count_and_get(
2982: p_encoded => fnd_api.g_false
2983: ,p_count => l_msg_count
2984: ,p_data => l_msg_data);
2978: EXCEPTION
2979: WHEN OTHERS THEN
2980: -- x_return_status := fnd_api.g_ret_sts_error;
2981: fnd_msg_pub.count_and_get(
2982: p_encoded => fnd_api.g_false
2983: ,p_count => l_msg_count
2984: ,p_data => l_msg_data);
2985: ams_gen_approval_pvt.handle_err(
2986: p_itemtype => itemtype
3026: --
3027: -- End of Comments
3028:
3029: PROCEDURE approve_holdback(
3030: p_commit IN VARCHAR2 := fnd_api.g_false
3031: ,p_act_budget_id IN NUMBER
3032: ,p_transfer_type IN VARCHAR2
3033: ,p_transac_fund_id IN NUMBER
3034: ,p_requester_id IN NUMBER
3045: l_api_version CONSTANT NUMBER := 1.0;
3046: l_msg_count NUMBER;
3047: l_msg_data VARCHAR2(4000);
3048: l_return_status VARCHAR2(1)
3049: := fnd_api.g_ret_sts_success;
3050: l_object_version_number NUMBER;
3051: -- Record variables for creating the fund request.
3052: l_fund_rec ozf_funds_pvt.fund_rec_type; -- transaction fund record
3053: l_act_budget_rec ozf_actbudgets_pvt.act_budgets_rec_type; -- fund request record
3086: l_request_id NUMBER;
3087: l_req_user_status_id NUMBER;
3088: l_req_object_version_number NUMBER;
3089: BEGIN
3090: x_return_status := fnd_api.g_ret_sts_success;
3091: -- Initialize
3092: IF G_DEBUG THEN
3093: ozf_utility_pvt.debug_message(l_full_name || ': start');
3094: END IF;
3103: fnd_message.set_name('OZF', 'OZF_API_RECORD_NOT_FOUND');
3104: fnd_msg_pub.add;
3105: END IF;
3106:
3107: RAISE fnd_api.g_exc_error;
3108: END IF;
3109:
3110: CLOSE c_fund_detail;
3111: -- Check to see whether the fund has sufficient available amount to reserve/release
3118: fnd_message.set_name('OZF', 'OZF_AMT_UNAVAILABLE');
3119: fnd_msg_pub.add;
3120: END IF;
3121:
3122: RAISE fnd_api.g_exc_error;
3123: END IF;
3124:
3125: l_fund_rec.holdback_amt := NVL(l_holdback_amt, 0) + NVL(p_requested_amount, 0); -- HOLDBACK AMT
3126: ELSIF p_transfer_type = 'RELEASE' THEN
3129: fnd_message.set_name('OZF', 'OZF_AMT_UNAVAILABLE');
3130: fnd_msg_pub.add;
3131: END IF;
3132:
3133: RAISE fnd_api.g_exc_error;
3134: END IF;
3135:
3136: l_fund_rec.holdback_amt := NVL(l_holdback_amt, 0) - NVL(p_requested_amount, 0); -- HOLDBACK AMT
3137: END IF;
3144: l_fund_rec.object_version_number := l_obj_number;
3145: -- Update source fund
3146: ozf_funds_pvt.update_fund(
3147: p_api_version => l_api_version
3148: ,p_commit => fnd_api.g_false
3149: ,x_return_status => l_return_status
3150: ,x_msg_count => l_msg_count
3151: ,x_msg_data => l_msg_data
3152: ,p_fund_rec => l_fund_rec
3151: ,x_msg_data => l_msg_data
3152: ,p_fund_rec => l_fund_rec
3153: ,p_mode => 'ADJUST');
3154:
3155: IF l_return_status = fnd_api.g_ret_sts_unexp_error THEN
3156: RAISE fnd_api.g_exc_unexpected_error;
3157: ELSIF l_return_status = fnd_api.g_ret_sts_error THEN
3158: RAISE fnd_api.g_exc_error;
3159: END IF;
3152: ,p_fund_rec => l_fund_rec
3153: ,p_mode => 'ADJUST');
3154:
3155: IF l_return_status = fnd_api.g_ret_sts_unexp_error THEN
3156: RAISE fnd_api.g_exc_unexpected_error;
3157: ELSIF l_return_status = fnd_api.g_ret_sts_error THEN
3158: RAISE fnd_api.g_exc_error;
3159: END IF;
3160:
3153: ,p_mode => 'ADJUST');
3154:
3155: IF l_return_status = fnd_api.g_ret_sts_unexp_error THEN
3156: RAISE fnd_api.g_exc_unexpected_error;
3157: ELSIF l_return_status = fnd_api.g_ret_sts_error THEN
3158: RAISE fnd_api.g_exc_error;
3159: END IF;
3160:
3161: -- Conditional commit
3154:
3155: IF l_return_status = fnd_api.g_ret_sts_unexp_error THEN
3156: RAISE fnd_api.g_exc_unexpected_error;
3157: ELSIF l_return_status = fnd_api.g_ret_sts_error THEN
3158: RAISE fnd_api.g_exc_error;
3159: END IF;
3160:
3161: -- Conditional commit
3162: IF fnd_api.to_boolean(p_commit)
3158: RAISE fnd_api.g_exc_error;
3159: END IF;
3160:
3161: -- Conditional commit
3162: IF fnd_api.to_boolean(p_commit)
3163: AND l_return_status = fnd_api.g_ret_sts_success THEN
3164: COMMIT WORK;
3165: END IF;
3166:
3159: END IF;
3160:
3161: -- Conditional commit
3162: IF fnd_api.to_boolean(p_commit)
3163: AND l_return_status = fnd_api.g_ret_sts_success THEN
3164: COMMIT WORK;
3165: END IF;
3166:
3167: fnd_msg_pub.count_and_get(
3164: COMMIT WORK;
3165: END IF;
3166:
3167: fnd_msg_pub.count_and_get(
3168: p_encoded => fnd_api.g_false
3169: ,p_count => x_msg_count
3170: ,p_data => x_msg_data);
3171: EXCEPTION
3172: WHEN fnd_api.g_exc_error THEN
3168: p_encoded => fnd_api.g_false
3169: ,p_count => x_msg_count
3170: ,p_data => x_msg_data);
3171: EXCEPTION
3172: WHEN fnd_api.g_exc_error THEN
3173: x_return_status := fnd_api.g_ret_sts_error;
3174: fnd_msg_pub.count_and_get(
3175: p_encoded => fnd_api.g_false
3176: ,p_count => x_msg_count
3169: ,p_count => x_msg_count
3170: ,p_data => x_msg_data);
3171: EXCEPTION
3172: WHEN fnd_api.g_exc_error THEN
3173: x_return_status := fnd_api.g_ret_sts_error;
3174: fnd_msg_pub.count_and_get(
3175: p_encoded => fnd_api.g_false
3176: ,p_count => x_msg_count
3177: ,p_data => x_msg_data);
3171: EXCEPTION
3172: WHEN fnd_api.g_exc_error THEN
3173: x_return_status := fnd_api.g_ret_sts_error;
3174: fnd_msg_pub.count_and_get(
3175: p_encoded => fnd_api.g_false
3176: ,p_count => x_msg_count
3177: ,p_data => x_msg_data);
3178: WHEN fnd_api.g_exc_unexpected_error THEN
3179: x_return_status := fnd_api.g_ret_sts_unexp_error;
3174: fnd_msg_pub.count_and_get(
3175: p_encoded => fnd_api.g_false
3176: ,p_count => x_msg_count
3177: ,p_data => x_msg_data);
3178: WHEN fnd_api.g_exc_unexpected_error THEN
3179: x_return_status := fnd_api.g_ret_sts_unexp_error;
3180: fnd_msg_pub.count_and_get(
3181: p_encoded => fnd_api.g_false
3182: ,p_count => x_msg_count
3175: p_encoded => fnd_api.g_false
3176: ,p_count => x_msg_count
3177: ,p_data => x_msg_data);
3178: WHEN fnd_api.g_exc_unexpected_error THEN
3179: x_return_status := fnd_api.g_ret_sts_unexp_error;
3180: fnd_msg_pub.count_and_get(
3181: p_encoded => fnd_api.g_false
3182: ,p_count => x_msg_count
3183: ,p_data => x_msg_data);
3177: ,p_data => x_msg_data);
3178: WHEN fnd_api.g_exc_unexpected_error THEN
3179: x_return_status := fnd_api.g_ret_sts_unexp_error;
3180: fnd_msg_pub.count_and_get(
3181: p_encoded => fnd_api.g_false
3182: ,p_count => x_msg_count
3183: ,p_data => x_msg_data);
3184: WHEN OTHERS THEN
3185: x_return_status := fnd_api.g_ret_sts_unexp_error;
3181: p_encoded => fnd_api.g_false
3182: ,p_count => x_msg_count
3183: ,p_data => x_msg_data);
3184: WHEN OTHERS THEN
3185: x_return_status := fnd_api.g_ret_sts_unexp_error;
3186:
3187: IF fnd_msg_pub.check_msg_level(fnd_msg_pub.g_msg_lvl_unexp_error) THEN
3188: fnd_msg_pub.add_exc_msg(g_pkg_name, l_api_name);
3189: END IF;
3188: fnd_msg_pub.add_exc_msg(g_pkg_name, l_api_name);
3189: END IF;
3190:
3191: fnd_msg_pub.count_and_get(
3192: p_encoded => fnd_api.g_false
3193: ,p_count => x_msg_count
3194: ,p_data => x_msg_data);
3195: END approve_holdback;
3196: END ozf_fund_request_apr_pvt;