47: -- PURPOSE
48: -- This Procedure will Update the source and target funds and update the fund_request.
49: --
50: -- IN
51: --p_commit IN VARCHAR2 := fnd_api.g_false
52: --p_update_status IN VARCHAR2 := 'Y'
53: --p_fund_request_id IN NUMBER
54: --p_target_fund_id IN NUMBER
55: --p_source_fund_id IN NUMBER
67: ------------------------------------------------------------------------------
68:
69:
70: PROCEDURE approve_request(
71: p_commit IN VARCHAR2 := fnd_api.g_false
72: ,p_update_status IN VARCHAR2 := 'Y'
73: ,p_act_budget_id IN NUMBER
74: ,p_target_fund_id IN NUMBER
75: ,p_source_fund_id IN NUMBER
156: -- Initialize
157: IF G_DEBUG THEN
158: ozf_utility_pvt.debug_message(l_full_name || ': start');
159: END IF;
160: x_return_status := fnd_api.g_ret_sts_success;
161: OPEN c_fund_detail(p_source_fund_id);
162: FETCH c_fund_detail INTO l_source_rec.source_org_budget,
163: l_source_rec.source_trans_in_amt,
164: l_source_rec.source_trans_out_amt,
173: fnd_message.set_name('OZF', 'OZF_API_RECORD_NOT_FOUND');
174: fnd_msg_pub.add;
175: END IF;
176:
177: RAISE fnd_api.g_exc_error;
178: END IF;
179:
180: CLOSE c_fund_detail;
181:
192: fnd_message.set_name('OZF', 'OZF_AMT_UNAVAILABLE');
193: fnd_msg_pub.add;
194: END IF;
195:
196: RAISE fnd_api.g_exc_error;
197: END IF;
198:
199: ----- Convert the approved amount to the to_fund_currency
200: OPEN c_to_fund_currency(p_target_fund_id);
207: fnd_message.set_name('OZF', 'OZF_API_RECORD_NOT_FOUND');
208: fnd_msg_pub.add;
209: END IF;
210:
211: RAISE fnd_api.g_exc_error;
212: END IF;
213:
214: CLOSE c_to_fund_currency;
215:
222: ,p_from_amount => p_approved_amount
223: ,x_to_amount => l_to_curr_approved_amt
224: ,x_rate => l_rate);
225:
226: IF l_return_status = fnd_api.g_ret_sts_error THEN
227: RAISE fnd_api.g_exc_error;
228: ELSIF l_return_status = fnd_api.g_ret_sts_unexp_error THEN
229: RAISE fnd_api.g_exc_unexpected_error;
230: END IF;
223: ,x_to_amount => l_to_curr_approved_amt
224: ,x_rate => l_rate);
225:
226: IF l_return_status = fnd_api.g_ret_sts_error THEN
227: RAISE fnd_api.g_exc_error;
228: ELSIF l_return_status = fnd_api.g_ret_sts_unexp_error THEN
229: RAISE fnd_api.g_exc_unexpected_error;
230: END IF;
231: ELSE
224: ,x_rate => l_rate);
225:
226: IF l_return_status = fnd_api.g_ret_sts_error THEN
227: RAISE fnd_api.g_exc_error;
228: ELSIF l_return_status = fnd_api.g_ret_sts_unexp_error THEN
229: RAISE fnd_api.g_exc_unexpected_error;
230: END IF;
231: ELSE
232: l_to_curr_approved_amt := p_approved_amount;
225:
226: IF l_return_status = fnd_api.g_ret_sts_error THEN
227: RAISE fnd_api.g_exc_error;
228: ELSIF l_return_status = fnd_api.g_ret_sts_unexp_error THEN
229: RAISE fnd_api.g_exc_unexpected_error;
230: END IF;
231: ELSE
232: l_to_curr_approved_amt := p_approved_amount;
233: END IF; --/// end if transfer currency
246: -- Update source fund
247: -- Source record
248: ozf_funds_pvt.update_fund(
249: p_api_version => l_api_version
250: ,p_init_msg_list => fnd_api.g_false
251: ,p_commit => fnd_api.g_false
252: ,x_return_status => l_return_status
253: ,x_msg_count => l_msg_count
254: ,x_msg_data => l_msg_data
247: -- Source record
248: ozf_funds_pvt.update_fund(
249: p_api_version => l_api_version
250: ,p_init_msg_list => fnd_api.g_false
251: ,p_commit => fnd_api.g_false
252: ,x_return_status => l_return_status
253: ,x_msg_count => l_msg_count
254: ,x_msg_data => l_msg_data
255: ,p_fund_rec => l_source_fund_rec
254: ,x_msg_data => l_msg_data
255: ,p_fund_rec => l_source_fund_rec
256: ,p_mode => 'ADJUST');
257:
258: IF l_return_status = fnd_api.g_ret_sts_error THEN
259: RAISE fnd_api.g_exc_error;
260: ELSIF l_return_status = fnd_api.g_ret_sts_unexp_error THEN
261: RAISE fnd_api.g_exc_unexpected_error;
262: END IF;
255: ,p_fund_rec => l_source_fund_rec
256: ,p_mode => 'ADJUST');
257:
258: IF l_return_status = fnd_api.g_ret_sts_error THEN
259: RAISE fnd_api.g_exc_error;
260: ELSIF l_return_status = fnd_api.g_ret_sts_unexp_error THEN
261: RAISE fnd_api.g_exc_unexpected_error;
262: END IF;
263:
256: ,p_mode => 'ADJUST');
257:
258: IF l_return_status = fnd_api.g_ret_sts_error THEN
259: RAISE fnd_api.g_exc_error;
260: ELSIF l_return_status = fnd_api.g_ret_sts_unexp_error THEN
261: RAISE fnd_api.g_exc_unexpected_error;
262: END IF;
263:
264: OPEN c_target_fund_detail(p_target_fund_id);
257:
258: IF l_return_status = fnd_api.g_ret_sts_error THEN
259: RAISE fnd_api.g_exc_error;
260: ELSIF l_return_status = fnd_api.g_ret_sts_unexp_error THEN
261: RAISE fnd_api.g_exc_unexpected_error;
262: END IF;
263:
264: OPEN c_target_fund_detail(p_target_fund_id);
265: FETCH c_target_fund_detail INTO l_target_rec.target_org_budget,
276: fnd_message.set_name('OZF', 'OZF_API_RECORD_NOT_FOUND');
277: fnd_msg_pub.add;
278: END IF;
279:
280: RAISE fnd_api.g_exc_error;
281: END IF;
282:
283: CLOSE c_target_fund_detail;
284: ozf_funds_pvt.init_fund_rec(x_fund_rec => l_target_fund_rec);
289:
290: IF p_child_flag = 'Y' THEN
291: /*
292: l_target_fund_rec.original_budget := NVL(l_to_curr_approved_amt, 0); ---changed 21st JULY to accomodate
293: l_target_fund_rec.transfered_in_amt := fnd_api.g_miss_num;
294: */
295: -- mpande 11/02/2001 changed
296: l_target_fund_rec.original_budget := 0;
297: l_target_fund_rec.transfered_in_amt := NVL(l_to_curr_approved_amt, 0);
304: ELSE
305: l_target_fund_rec.transfered_in_amt :=
306: NVL(l_target_rec.target_trans_in_amt, 0) + l_to_curr_approved_amt;
307: -- Transfered In AMT added in to fund currency
308: --l_target_fund_rec.original_budget := fnd_api.g_miss_num; --bug fix 3579649:rimehrot
309: END IF;
310:
311: IF G_DEBUG THEN
312: ozf_utility_pvt.debug_message(
320: IF p_requestor_owner = 'N' THEN
321: -- Update target fund to active other wise the caller API ( OZF_FUNDRULES_PVT) will update the fund to active
322: ozf_funds_pvt.update_fund(
323: p_api_version => l_api_version
324: ,p_init_msg_list => fnd_api.g_false
325: ,p_commit => fnd_api.g_false
326: ,x_return_status => l_return_status
327: ,x_msg_count => l_msg_count
328: ,x_msg_data => l_msg_data
321: -- Update target fund to active other wise the caller API ( OZF_FUNDRULES_PVT) will update the fund to active
322: ozf_funds_pvt.update_fund(
323: p_api_version => l_api_version
324: ,p_init_msg_list => fnd_api.g_false
325: ,p_commit => fnd_api.g_false
326: ,x_return_status => l_return_status
327: ,x_msg_count => l_msg_count
328: ,x_msg_data => l_msg_data
329: ,p_fund_rec => l_target_fund_rec
341: fnd_message.set_name('OZF', 'OZF_API_RECORD_NOT_FOUND');
342: fnd_msg_pub.add;
343: END IF;
344:
345: RAISE fnd_api.g_exc_error;
346: END IF;
347:
348: CLOSE c_act_budget_detail;
349: --- update th erequest stauts to approved
359: ,l_act_budget_rec.status_code);
360: -- Fund request record
361: ozf_actbudgets_pvt.update_act_budgets(
362: p_api_version => l_api_version
363: ,p_init_msg_list => fnd_api.g_false
364: ,p_commit => fnd_api.g_false
365: ,x_return_status => l_return_status
366: ,x_msg_count => l_msg_count
367: ,x_msg_data => l_msg_data
360: -- Fund request record
361: ozf_actbudgets_pvt.update_act_budgets(
362: p_api_version => l_api_version
363: ,p_init_msg_list => fnd_api.g_false
364: ,p_commit => fnd_api.g_false
365: ,x_return_status => l_return_status
366: ,x_msg_count => l_msg_count
367: ,x_msg_data => l_msg_data
368: ,p_act_budgets_rec => l_act_budget_rec
365: ,x_return_status => l_return_status
366: ,x_msg_count => l_msg_count
367: ,x_msg_data => l_msg_data
368: ,p_act_budgets_rec => l_act_budget_rec
369: ,p_child_approval_flag => FND_API.g_false
370: ,p_requestor_owner_flag => p_requestor_owner
371: );
372:
373: IF l_return_status = fnd_api.g_ret_sts_error THEN
369: ,p_child_approval_flag => FND_API.g_false
370: ,p_requestor_owner_flag => p_requestor_owner
371: );
372:
373: IF l_return_status = fnd_api.g_ret_sts_error THEN
374: RAISE fnd_api.g_exc_error;
375: ELSIF l_return_status = fnd_api.g_ret_sts_unexp_error THEN
376: RAISE fnd_api.g_exc_unexpected_error;
377: END IF;
370: ,p_requestor_owner_flag => p_requestor_owner
371: );
372:
373: IF l_return_status = fnd_api.g_ret_sts_error THEN
374: RAISE fnd_api.g_exc_error;
375: ELSIF l_return_status = fnd_api.g_ret_sts_unexp_error THEN
376: RAISE fnd_api.g_exc_unexpected_error;
377: END IF;
378: */
371: );
372:
373: IF l_return_status = fnd_api.g_ret_sts_error THEN
374: RAISE fnd_api.g_exc_error;
375: ELSIF l_return_status = fnd_api.g_ret_sts_unexp_error THEN
376: RAISE fnd_api.g_exc_unexpected_error;
377: END IF;
378: */
379: NULL;
372:
373: IF l_return_status = fnd_api.g_ret_sts_error THEN
374: RAISE fnd_api.g_exc_error;
375: ELSIF l_return_status = fnd_api.g_ret_sts_unexp_error THEN
376: RAISE fnd_api.g_exc_unexpected_error;
377: END IF;
378: */
379: NULL;
380: END IF;
381: ELSIF p_child_flag = 'N' THEN
382: -- if not a child transfer always update the target fund
383: ozf_funds_pvt.update_fund(
384: p_api_version => l_api_version
385: ,p_init_msg_list => fnd_api.g_false
386: ,p_commit => fnd_api.g_false
387: ,x_return_status => l_return_status
388: ,x_msg_count => l_msg_count
389: ,x_msg_data => l_msg_data
382: -- if not a child transfer always update the target fund
383: ozf_funds_pvt.update_fund(
384: p_api_version => l_api_version
385: ,p_init_msg_list => fnd_api.g_false
386: ,p_commit => fnd_api.g_false
387: ,x_return_status => l_return_status
388: ,x_msg_count => l_msg_count
389: ,x_msg_data => l_msg_data
390: ,p_fund_rec => l_target_fund_rec
390: ,p_fund_rec => l_target_fund_rec
391: ,p_mode => 'ADJUST');
392: END IF;
393:
394: IF l_return_status = fnd_api.g_ret_sts_error THEN
395: RAISE fnd_api.g_exc_error;
396: ELSIF l_return_status = fnd_api.g_ret_sts_unexp_error THEN
397: RAISE fnd_api.g_exc_unexpected_error;
398: END IF;
391: ,p_mode => 'ADJUST');
392: END IF;
393:
394: IF l_return_status = fnd_api.g_ret_sts_error THEN
395: RAISE fnd_api.g_exc_error;
396: ELSIF l_return_status = fnd_api.g_ret_sts_unexp_error THEN
397: RAISE fnd_api.g_exc_unexpected_error;
398: END IF;
399: -- if the fund transfer is being updated from workflow the request record should be approved
392: END IF;
393:
394: IF l_return_status = fnd_api.g_ret_sts_error THEN
395: RAISE fnd_api.g_exc_error;
396: ELSIF l_return_status = fnd_api.g_ret_sts_unexp_error THEN
397: RAISE fnd_api.g_exc_unexpected_error;
398: END IF;
399: -- if the fund transfer is being updated from workflow the request record should be approved
400: -- other wise the caller API will make it approved
393:
394: IF l_return_status = fnd_api.g_ret_sts_error THEN
395: RAISE fnd_api.g_exc_error;
396: ELSIF l_return_status = fnd_api.g_ret_sts_unexp_error THEN
397: RAISE fnd_api.g_exc_unexpected_error;
398: END IF;
399: -- if the fund transfer is being updated from workflow the request record should be approved
400: -- other wise the caller API will make it approved
401: -- mpande 09/06/2001 IF p_child_flag = 'N' AND p_workflow_flag = 'Y' THEN
411: fnd_message.set_name('OZF', 'OZF_API_RECORD_NOT_FOUND');
412: fnd_msg_pub.add;
413: END IF;
414:
415: RAISE fnd_api.g_exc_error;
416: END IF;
417:
418: CLOSE c_act_budget_detail;
419: ozf_actbudgets_pvt.init_act_budgets_rec(l_act_budget_rec);
430: ,l_act_budget_rec.status_code);
431: -- Fund request record
432: ozf_actbudgets_pvt.update_act_budgets(
433: p_api_version => l_api_version
434: ,p_init_msg_list => fnd_api.g_false
435: ,p_commit => fnd_api.g_false
436: ,x_return_status => l_return_status
437: ,x_msg_count => l_msg_count
438: ,x_msg_data => l_msg_data
431: -- Fund request record
432: ozf_actbudgets_pvt.update_act_budgets(
433: p_api_version => l_api_version
434: ,p_init_msg_list => fnd_api.g_false
435: ,p_commit => fnd_api.g_false
436: ,x_return_status => l_return_status
437: ,x_msg_count => l_msg_count
438: ,x_msg_data => l_msg_data
439: ,p_act_budgets_rec => l_act_budget_rec);
438: ,x_msg_data => l_msg_data
439: ,p_act_budgets_rec => l_act_budget_rec);
440:
441: -- Set the return status
442: IF l_return_status = fnd_api.g_ret_sts_error THEN
443: RAISE fnd_api.g_exc_error;
444: ELSIF l_return_status = fnd_api.g_ret_sts_unexp_error THEN
445: RAISE fnd_api.g_exc_unexpected_error;
446: END IF;
439: ,p_act_budgets_rec => l_act_budget_rec);
440:
441: -- Set the return status
442: IF l_return_status = fnd_api.g_ret_sts_error THEN
443: RAISE fnd_api.g_exc_error;
444: ELSIF l_return_status = fnd_api.g_ret_sts_unexp_error THEN
445: RAISE fnd_api.g_exc_unexpected_error;
446: END IF;
447: END IF ;
440:
441: -- Set the return status
442: IF l_return_status = fnd_api.g_ret_sts_error THEN
443: RAISE fnd_api.g_exc_error;
444: ELSIF l_return_status = fnd_api.g_ret_sts_unexp_error THEN
445: RAISE fnd_api.g_exc_unexpected_error;
446: END IF;
447: END IF ;
448: fnd_msg_pub.count_and_get(
441: -- Set the return status
442: IF l_return_status = fnd_api.g_ret_sts_error THEN
443: RAISE fnd_api.g_exc_error;
444: ELSIF l_return_status = fnd_api.g_ret_sts_unexp_error THEN
445: RAISE fnd_api.g_exc_unexpected_error;
446: END IF;
447: END IF ;
448: fnd_msg_pub.count_and_get(
449: p_encoded => fnd_api.g_false
445: RAISE fnd_api.g_exc_unexpected_error;
446: END IF;
447: END IF ;
448: fnd_msg_pub.count_and_get(
449: p_encoded => fnd_api.g_false
450: ,p_count => x_msg_count
451: ,p_data => x_msg_data);
452:
453: -- Conditional commit;
450: ,p_count => x_msg_count
451: ,p_data => x_msg_data);
452:
453: -- Conditional commit;
454: IF fnd_api.to_boolean(p_commit)
455: AND x_return_status = fnd_api.g_ret_sts_success THEN
456: COMMIT WORK;
457: END IF;
458: EXCEPTION
451: ,p_data => x_msg_data);
452:
453: -- Conditional commit;
454: IF fnd_api.to_boolean(p_commit)
455: AND x_return_status = fnd_api.g_ret_sts_success THEN
456: COMMIT WORK;
457: END IF;
458: EXCEPTION
459: WHEN fnd_api.g_exc_error THEN
455: AND x_return_status = fnd_api.g_ret_sts_success THEN
456: COMMIT WORK;
457: END IF;
458: EXCEPTION
459: WHEN fnd_api.g_exc_error THEN
460: ROLLBACK TO approve_request;
461: x_return_status := fnd_api.g_ret_sts_error;
462: fnd_msg_pub.count_and_get(
463: p_encoded => fnd_api.g_false
457: END IF;
458: EXCEPTION
459: WHEN fnd_api.g_exc_error THEN
460: ROLLBACK TO approve_request;
461: x_return_status := fnd_api.g_ret_sts_error;
462: fnd_msg_pub.count_and_get(
463: p_encoded => fnd_api.g_false
464: ,p_count => x_msg_count
465: ,p_data => x_msg_data);
459: WHEN fnd_api.g_exc_error THEN
460: ROLLBACK TO approve_request;
461: x_return_status := fnd_api.g_ret_sts_error;
462: fnd_msg_pub.count_and_get(
463: p_encoded => fnd_api.g_false
464: ,p_count => x_msg_count
465: ,p_data => x_msg_data);
466: WHEN fnd_api.g_exc_unexpected_error THEN
467: ROLLBACK TO approve_request;
462: fnd_msg_pub.count_and_get(
463: p_encoded => fnd_api.g_false
464: ,p_count => x_msg_count
465: ,p_data => x_msg_data);
466: WHEN fnd_api.g_exc_unexpected_error THEN
467: ROLLBACK TO approve_request;
468: x_return_status := fnd_api.g_ret_sts_unexp_error;
469: fnd_msg_pub.count_and_get(
470: p_encoded => fnd_api.g_false
464: ,p_count => x_msg_count
465: ,p_data => x_msg_data);
466: WHEN fnd_api.g_exc_unexpected_error THEN
467: ROLLBACK TO approve_request;
468: x_return_status := fnd_api.g_ret_sts_unexp_error;
469: fnd_msg_pub.count_and_get(
470: p_encoded => fnd_api.g_false
471: ,p_count => x_msg_count
472: ,p_data => x_msg_data);
466: WHEN fnd_api.g_exc_unexpected_error THEN
467: ROLLBACK TO approve_request;
468: x_return_status := fnd_api.g_ret_sts_unexp_error;
469: fnd_msg_pub.count_and_get(
470: p_encoded => fnd_api.g_false
471: ,p_count => x_msg_count
472: ,p_data => x_msg_data);
473: WHEN OTHERS THEN
474: ROLLBACK TO approve_request;
471: ,p_count => x_msg_count
472: ,p_data => x_msg_data);
473: WHEN OTHERS THEN
474: ROLLBACK TO approve_request;
475: x_return_status := fnd_api.g_ret_sts_unexp_error;
476:
477: IF fnd_msg_pub.check_msg_level(fnd_msg_pub.g_msg_lvl_unexp_error) THEN
478: fnd_msg_pub.add_exc_msg(g_pkg_name, l_api_name);
479: END IF;
478: fnd_msg_pub.add_exc_msg(g_pkg_name, l_api_name);
479: END IF;
480:
481: fnd_msg_pub.count_and_get(
482: p_encoded => fnd_api.g_false
483: ,p_count => x_msg_count
484: ,p_data => x_msg_data);
485: END approve_request;
486:
494: -- called only when the request is rejected or error occured in approval process
495: -- for successful approval, approve_request() is called.
496: --
497: -- IN
498: --p_commit IN VARCHAR2 := fnd_api.g_false
499: --p_update_status IN VARCHAR2 := 'Y'
500: --p_fund_request_id IN NUMBER
501: --p_target_fund_id IN NUMBER
502: --p_source_fund_id IN NUMBER
516: ------------------------------------------------------------------------------
517:
518:
519: PROCEDURE negative_request(
520: p_commit IN VARCHAR2 := fnd_api.g_false
521: ,p_act_budget_id IN NUMBER
522: ,p_target_fund_id IN NUMBER
523: ,p_source_fund_id IN NUMBER
524: ,p_requester_id IN NUMBER
605: fnd_message.set_name('OZF', 'OZF_API_RECORD_NOT_FOUND');
606: fnd_msg_pub.add;
607: END IF;
608:
609: RAISE fnd_api.g_exc_error;
610: END IF;
611:
612: CLOSE c_target_fund_detail;
613: ozf_funds_pvt.init_fund_rec(x_fund_rec => l_target_fund_rec);
629: ELSE
630: l_target_fund_rec.transfered_in_amt :=
631: NVL(l_target_rec.target_trans_in_amt, 0) + l_to_curr_approved_amt;
632: -- Transfered In AMT added in to fund currency
633: l_target_fund_rec.original_budget := fnd_api.g_miss_num;
634: END IF;
635: */
636: IF G_DEBUG THEN
637: ozf_utility_pvt.debug_message(
656:
657: -- Update target fund
658: ozf_funds_pvt.update_fund(
659: p_api_version => l_api_version
660: ,p_init_msg_list => fnd_api.g_false
661: ,p_commit => fnd_api.g_false
662: ,x_return_status => l_return_status
663: ,x_msg_count => l_msg_count
664: ,x_msg_data => l_msg_data
657: -- Update target fund
658: ozf_funds_pvt.update_fund(
659: p_api_version => l_api_version
660: ,p_init_msg_list => fnd_api.g_false
661: ,p_commit => fnd_api.g_false
662: ,x_return_status => l_return_status
663: ,x_msg_count => l_msg_count
664: ,x_msg_data => l_msg_data
665: ,p_fund_rec => l_target_fund_rec
676: fnd_message.set_name('OZF', 'OZF_API_RECORD_NOT_FOUND');
677: fnd_msg_pub.add;
678: END IF;
679:
680: RAISE fnd_api.g_exc_error;
681: END IF;
682:
683: CLOSE c_act_budget_detail;
684: --- update th erequest stauts to pending before submitting
693: ,l_act_budget_rec.status_code);
694: -- Fund request record
695: ozf_actbudgets_pvt.update_act_budgets(
696: p_api_version => l_api_version
697: ,p_init_msg_list => fnd_api.g_false
698: ,p_commit => fnd_api.g_false
699: ,x_return_status => l_return_status
700: ,x_msg_count => l_msg_count
701: ,x_msg_data => l_msg_data
694: -- Fund request record
695: ozf_actbudgets_pvt.update_act_budgets(
696: p_api_version => l_api_version
697: ,p_init_msg_list => fnd_api.g_false
698: ,p_commit => fnd_api.g_false
699: ,x_return_status => l_return_status
700: ,x_msg_count => l_msg_count
701: ,x_msg_data => l_msg_data
702: ,p_act_budgets_rec => l_act_budget_rec
699: ,x_return_status => l_return_status
700: ,x_msg_count => l_msg_count
701: ,x_msg_data => l_msg_data
702: ,p_act_budgets_rec => l_act_budget_rec
703: ,p_child_approval_flag => FND_API.g_true
704: );
705:
706: IF l_return_status = fnd_api.g_ret_sts_error THEN
707: RAISE fnd_api.g_exc_error;
702: ,p_act_budgets_rec => l_act_budget_rec
703: ,p_child_approval_flag => FND_API.g_true
704: );
705:
706: IF l_return_status = fnd_api.g_ret_sts_error THEN
707: RAISE fnd_api.g_exc_error;
708: ELSIF l_return_status = fnd_api.g_ret_sts_unexp_error THEN
709: RAISE fnd_api.g_exc_unexpected_error;
710: END IF;
703: ,p_child_approval_flag => FND_API.g_true
704: );
705:
706: IF l_return_status = fnd_api.g_ret_sts_error THEN
707: RAISE fnd_api.g_exc_error;
708: ELSIF l_return_status = fnd_api.g_ret_sts_unexp_error THEN
709: RAISE fnd_api.g_exc_unexpected_error;
710: END IF;
711: END IF;
704: );
705:
706: IF l_return_status = fnd_api.g_ret_sts_error THEN
707: RAISE fnd_api.g_exc_error;
708: ELSIF l_return_status = fnd_api.g_ret_sts_unexp_error THEN
709: RAISE fnd_api.g_exc_unexpected_error;
710: END IF;
711: END IF;
712:
705:
706: IF l_return_status = fnd_api.g_ret_sts_error THEN
707: RAISE fnd_api.g_exc_error;
708: ELSIF l_return_status = fnd_api.g_ret_sts_unexp_error THEN
709: RAISE fnd_api.g_exc_unexpected_error;
710: END IF;
711: END IF;
712:
713: ELSIF p_child_flag = 'N' THEN
712:
713: ELSIF p_child_flag = 'N' THEN
714: ozf_funds_pvt.update_fund(
715: p_api_version => l_api_version
716: ,p_init_msg_list => fnd_api.g_false
717: ,p_commit => fnd_api.g_false
718: ,x_return_status => l_return_status
719: ,x_msg_count => l_msg_count
720: ,x_msg_data => l_msg_data
713: ELSIF p_child_flag = 'N' THEN
714: ozf_funds_pvt.update_fund(
715: p_api_version => l_api_version
716: ,p_init_msg_list => fnd_api.g_false
717: ,p_commit => fnd_api.g_false
718: ,x_return_status => l_return_status
719: ,x_msg_count => l_msg_count
720: ,x_msg_data => l_msg_data
721: ,p_fund_rec => l_target_fund_rec
723: */
724: END IF;
725: END IF;
726:
727: IF l_return_status = fnd_api.g_ret_sts_error THEN
728: RAISE fnd_api.g_exc_error;
729: ELSIF l_return_status = fnd_api.g_ret_sts_unexp_error THEN
730: RAISE fnd_api.g_exc_unexpected_error;
731: END IF;
724: END IF;
725: END IF;
726:
727: IF l_return_status = fnd_api.g_ret_sts_error THEN
728: RAISE fnd_api.g_exc_error;
729: ELSIF l_return_status = fnd_api.g_ret_sts_unexp_error THEN
730: RAISE fnd_api.g_exc_unexpected_error;
731: END IF;
732:
725: END IF;
726:
727: IF l_return_status = fnd_api.g_ret_sts_error THEN
728: RAISE fnd_api.g_exc_error;
729: ELSIF l_return_status = fnd_api.g_ret_sts_unexp_error THEN
730: RAISE fnd_api.g_exc_unexpected_error;
731: END IF;
732:
733: -- Fund Request Detail
726:
727: IF l_return_status = fnd_api.g_ret_sts_error THEN
728: RAISE fnd_api.g_exc_error;
729: ELSIF l_return_status = fnd_api.g_ret_sts_unexp_error THEN
730: RAISE fnd_api.g_exc_unexpected_error;
731: END IF;
732:
733: -- Fund Request Detail
734: OPEN c_act_budget_detail(p_act_budget_id);
741: fnd_message.set_name('OZF', 'OZF_API_RECORD_NOT_FOUND');
742: fnd_msg_pub.add;
743: END IF;
744:
745: RAISE fnd_api.g_exc_error;
746: END IF;
747:
748: CLOSE c_act_budget_detail;
749: ozf_actbudgets_pvt.init_act_budgets_rec(l_act_budget_rec);
760: l_act_budget_rec.comment := p_note;
761: -- Fund request record
762: ozf_actbudgets_pvt.update_act_budgets(
763: p_api_version => l_api_version
764: ,p_init_msg_list => fnd_api.g_false
765: ,p_commit => fnd_api.g_false
766: ,x_return_status => l_return_status
767: ,x_msg_count => l_msg_count
768: ,x_msg_data => l_msg_data
761: -- Fund request record
762: ozf_actbudgets_pvt.update_act_budgets(
763: p_api_version => l_api_version
764: ,p_init_msg_list => fnd_api.g_false
765: ,p_commit => fnd_api.g_false
766: ,x_return_status => l_return_status
767: ,x_msg_count => l_msg_count
768: ,x_msg_data => l_msg_data
769: ,p_act_budgets_rec => l_act_budget_rec);
768: ,x_msg_data => l_msg_data
769: ,p_act_budgets_rec => l_act_budget_rec);
770:
771: -- Set the return status
772: IF l_return_status = fnd_api.g_ret_sts_error THEN
773: RAISE fnd_api.g_exc_error;
774: ELSIF l_return_status = fnd_api.g_ret_sts_unexp_error THEN
775: RAISE fnd_api.g_exc_unexpected_error;
776: END IF;
769: ,p_act_budgets_rec => l_act_budget_rec);
770:
771: -- Set the return status
772: IF l_return_status = fnd_api.g_ret_sts_error THEN
773: RAISE fnd_api.g_exc_error;
774: ELSIF l_return_status = fnd_api.g_ret_sts_unexp_error THEN
775: RAISE fnd_api.g_exc_unexpected_error;
776: END IF;
777:
770:
771: -- Set the return status
772: IF l_return_status = fnd_api.g_ret_sts_error THEN
773: RAISE fnd_api.g_exc_error;
774: ELSIF l_return_status = fnd_api.g_ret_sts_unexp_error THEN
775: RAISE fnd_api.g_exc_unexpected_error;
776: END IF;
777:
778: fnd_msg_pub.count_and_get(
771: -- Set the return status
772: IF l_return_status = fnd_api.g_ret_sts_error THEN
773: RAISE fnd_api.g_exc_error;
774: ELSIF l_return_status = fnd_api.g_ret_sts_unexp_error THEN
775: RAISE fnd_api.g_exc_unexpected_error;
776: END IF;
777:
778: fnd_msg_pub.count_and_get(
779: p_encoded => fnd_api.g_false
775: RAISE fnd_api.g_exc_unexpected_error;
776: END IF;
777:
778: fnd_msg_pub.count_and_get(
779: p_encoded => fnd_api.g_false
780: ,p_count => x_msg_count
781: ,p_data => x_msg_data);
782:
783: -- Conditional commit;
780: ,p_count => x_msg_count
781: ,p_data => x_msg_data);
782:
783: -- Conditional commit;
784: IF fnd_api.to_boolean(p_commit)
785: AND x_return_status = fnd_api.g_ret_sts_success THEN
786: COMMIT WORK;
787: END IF;
788: EXCEPTION
781: ,p_data => x_msg_data);
782:
783: -- Conditional commit;
784: IF fnd_api.to_boolean(p_commit)
785: AND x_return_status = fnd_api.g_ret_sts_success THEN
786: COMMIT WORK;
787: END IF;
788: EXCEPTION
789: WHEN fnd_api.g_exc_error THEN
785: AND x_return_status = fnd_api.g_ret_sts_success THEN
786: COMMIT WORK;
787: END IF;
788: EXCEPTION
789: WHEN fnd_api.g_exc_error THEN
790: ROLLBACK TO negative_request;
791: x_return_status := fnd_api.g_ret_sts_error;
792: fnd_msg_pub.count_and_get(
793: p_encoded => fnd_api.g_false
787: END IF;
788: EXCEPTION
789: WHEN fnd_api.g_exc_error THEN
790: ROLLBACK TO negative_request;
791: x_return_status := fnd_api.g_ret_sts_error;
792: fnd_msg_pub.count_and_get(
793: p_encoded => fnd_api.g_false
794: ,p_count => x_msg_count
795: ,p_data => x_msg_data);
789: WHEN fnd_api.g_exc_error THEN
790: ROLLBACK TO negative_request;
791: x_return_status := fnd_api.g_ret_sts_error;
792: fnd_msg_pub.count_and_get(
793: p_encoded => fnd_api.g_false
794: ,p_count => x_msg_count
795: ,p_data => x_msg_data);
796: WHEN fnd_api.g_exc_unexpected_error THEN
797: ROLLBACK TO negative_request;
792: fnd_msg_pub.count_and_get(
793: p_encoded => fnd_api.g_false
794: ,p_count => x_msg_count
795: ,p_data => x_msg_data);
796: WHEN fnd_api.g_exc_unexpected_error THEN
797: ROLLBACK TO negative_request;
798: x_return_status := fnd_api.g_ret_sts_unexp_error;
799: fnd_msg_pub.count_and_get(
800: p_encoded => fnd_api.g_false
794: ,p_count => x_msg_count
795: ,p_data => x_msg_data);
796: WHEN fnd_api.g_exc_unexpected_error THEN
797: ROLLBACK TO negative_request;
798: x_return_status := fnd_api.g_ret_sts_unexp_error;
799: fnd_msg_pub.count_and_get(
800: p_encoded => fnd_api.g_false
801: ,p_count => x_msg_count
802: ,p_data => x_msg_data);
796: WHEN fnd_api.g_exc_unexpected_error THEN
797: ROLLBACK TO negative_request;
798: x_return_status := fnd_api.g_ret_sts_unexp_error;
799: fnd_msg_pub.count_and_get(
800: p_encoded => fnd_api.g_false
801: ,p_count => x_msg_count
802: ,p_data => x_msg_data);
803: WHEN OTHERS THEN
804: ROLLBACK TO negative_request;
801: ,p_count => x_msg_count
802: ,p_data => x_msg_data);
803: WHEN OTHERS THEN
804: ROLLBACK TO negative_request;
805: x_return_status := fnd_api.g_ret_sts_unexp_error;
806:
807: IF fnd_msg_pub.check_msg_level(fnd_msg_pub.g_msg_lvl_unexp_error) THEN
808: fnd_msg_pub.add_exc_msg(g_pkg_name, l_api_name);
809: END IF;
808: fnd_msg_pub.add_exc_msg(g_pkg_name, l_api_name);
809: END IF;
810:
811: fnd_msg_pub.count_and_get(
812: p_encoded => fnd_api.g_false
813: ,p_count => x_msg_count
814: ,p_data => x_msg_data);
815: END negative_request;
816:
823: -- This Procedure will create the fund request
824: --
825: --
826: -- IN
827: -- p_commit IN VARCHAR2 := fnd_api.g_false
828: -- p_update_status IN VARCHAR2 := 'Y'
829: -- p_approval_for IN VARCHAR2 := 'FUND'
830: -- p_approval_for_id IN NUMBER
831: -- p_requester_id IN NUMBER
834: -- p_approval_fm_id IN NUMBER DEFAULT NULL
835: -- p_transfer_type IN VARCHAR2 := 'TRANSFER' --- 'REQUEST' OR 'TRANSFER'
836: -- p_child_flag IN VARCHAR2 := 'N' -- flag to indicate wether it is a child fund creation
837: -- p_act_budget_id IN NUMBER := NULL -- request_id ( for a child fund it is null)
838: -- p_init_msg_list IN VARCHAR2 := fnd_api.g_false
839: -- p_justification IN VARCHAR2
840: --
841: -- OUT
842: -- x_return_status OUT VARCHAR2
855: -- HISTORY
856: -- 02/20/2001 MUMU PANDE CREATION
857: -- End of Comments
858: PROCEDURE create_fund_request(
859: p_commit IN VARCHAR2 := fnd_api.g_false
860: ,p_update_status IN VARCHAR2 := 'Y'
861: ,p_approval_for IN VARCHAR2 := 'FUND'
862: ,p_approval_for_id IN NUMBER
863: ,p_requester_id IN NUMBER
867: ,p_approval_fm_id IN NUMBER
868: ,p_transfer_type IN VARCHAR2 := 'REQUEST' --- 'REQUEST' OR 'TRANSFER'
869: ,p_child_flag IN VARCHAR2 := 'N' -- flag to indicate whether it is a child fund creation
870: ,p_act_budget_id IN NUMBER := NULL -- request_id ( for a child fund it is null)
871: ,p_init_msg_list IN VARCHAR2 := fnd_api.g_false
872: ,p_justification IN VARCHAR2
873: ,p_allocation_flag IN VARCHAR2 := 'N' -- flag to indicate whether it is an allocation or not
874: ,x_return_status OUT NOCOPY VARCHAR2
875: ,x_msg_count OUT NOCOPY NUMBER
881: IS
882: -- Local variables
883: l_api_version CONSTANT NUMBER := 1.0;
884: l_return_status VARCHAR2(1)
885: := fnd_api.g_ret_sts_success;
886: l_msg_count NUMBER;
887: l_msg_data VARCHAR2(4000);
888: l_api_name CONSTANT VARCHAR2(30)
889: := 'Create_Fund_Request';
946:
947: l_act_budget_appr_rec c_act_budget_rec%ROWTYPE;
948: BEGIN
949: SAVEPOINT create_fund_request;
950: x_return_status := fnd_api.g_ret_sts_success;
951: -- Initialize
952: IF G_DEBUG THEN
953: ozf_utility_pvt.debug_message(l_full_name || ': start');
954: END IF;
979: ,p_act_budgets_rec => l_act_budget_rec
980: ,x_act_budget_id => l_act_budget_id);
981:
982: ------------if no request is created terminate the process
983: IF l_return_status = fnd_api.g_ret_sts_error THEN
984: RAISE fnd_api.g_exc_error;
985: ELSIF l_return_status = fnd_api.g_ret_sts_unexp_error THEN
986: RAISE fnd_api.g_exc_unexpected_error;
987: END IF;
980: ,x_act_budget_id => l_act_budget_id);
981:
982: ------------if no request is created terminate the process
983: IF l_return_status = fnd_api.g_ret_sts_error THEN
984: RAISE fnd_api.g_exc_error;
985: ELSIF l_return_status = fnd_api.g_ret_sts_unexp_error THEN
986: RAISE fnd_api.g_exc_unexpected_error;
987: END IF;
988:
981:
982: ------------if no request is created terminate the process
983: IF l_return_status = fnd_api.g_ret_sts_error THEN
984: RAISE fnd_api.g_exc_error;
985: ELSIF l_return_status = fnd_api.g_ret_sts_unexp_error THEN
986: RAISE fnd_api.g_exc_unexpected_error;
987: END IF;
988:
989: IF G_DEBUG THEN
982: ------------if no request is created terminate the process
983: IF l_return_status = fnd_api.g_ret_sts_error THEN
984: RAISE fnd_api.g_exc_error;
985: ELSIF l_return_status = fnd_api.g_ret_sts_unexp_error THEN
986: RAISE fnd_api.g_exc_unexpected_error;
987: END IF;
988:
989: IF G_DEBUG THEN
990: ozf_utility_pvt.debug_message(l_full_name || ': end creating request');
1002: fnd_message.set_name('OZF', 'OZF_API_RECORD_NOT_FOUND');
1003: fnd_msg_pub.add;
1004: END IF;
1005:
1006: RAISE fnd_api.g_exc_error;
1007: END IF;
1008:
1009: CLOSE c_parent_fund_owner;
1010: -- 10/22/2001 mpande Changed code different owner allocation bug
1031: fnd_message.set_name('OZF', 'OZF_API_RECORD_NOT_FOUND');
1032: fnd_msg_pub.add;
1033: END IF;
1034:
1035: RAISE fnd_api.g_exc_error;
1036: END IF;
1037:
1038: CLOSE c_fm_fund_currency;
1039: OPEN c_to_fund_currency(p_approval_for_id);
1046: fnd_message.set_name('OZF', 'OZF_API_RECORD_NOT_FOUND');
1047: fnd_msg_pub.add;
1048: END IF;
1049:
1050: RAISE fnd_api.g_exc_error;
1051: END IF;
1052:
1053: CLOSE c_to_fund_currency;
1054:
1061: ,p_from_amount => p_requested_amount
1062: ,x_to_amount => l_fm_curr_requested_amount
1063: ,x_rate => l_rate);
1064:
1065: IF l_return_status = fnd_api.g_ret_sts_error THEN
1066: RAISE fnd_api.g_exc_error;
1067: ELSIF l_return_status = fnd_api.g_ret_sts_unexp_error THEN
1068: RAISE fnd_api.g_exc_unexpected_error;
1069: END IF;
1062: ,x_to_amount => l_fm_curr_requested_amount
1063: ,x_rate => l_rate);
1064:
1065: IF l_return_status = fnd_api.g_ret_sts_error THEN
1066: RAISE fnd_api.g_exc_error;
1067: ELSIF l_return_status = fnd_api.g_ret_sts_unexp_error THEN
1068: RAISE fnd_api.g_exc_unexpected_error;
1069: END IF;
1070: ELSE
1063: ,x_rate => l_rate);
1064:
1065: IF l_return_status = fnd_api.g_ret_sts_error THEN
1066: RAISE fnd_api.g_exc_error;
1067: ELSIF l_return_status = fnd_api.g_ret_sts_unexp_error THEN
1068: RAISE fnd_api.g_exc_unexpected_error;
1069: END IF;
1070: ELSE
1071: l_fm_curr_requested_amount := NVL(p_requested_amount, 0); -- when currencies are the same the
1064:
1065: IF l_return_status = fnd_api.g_ret_sts_error THEN
1066: RAISE fnd_api.g_exc_error;
1067: ELSIF l_return_status = fnd_api.g_ret_sts_unexp_error THEN
1068: RAISE fnd_api.g_exc_unexpected_error;
1069: END IF;
1070: ELSE
1071: l_fm_curr_requested_amount := NVL(p_requested_amount, 0); -- when currencies are the same the
1072: END IF; -- end if transfer currency
1082: fnd_message.set_name('OZF', 'OZF_API_RECORD_NOT_FOUND');
1083: fnd_msg_pub.add;
1084: END IF;
1085:
1086: RAISE fnd_api.g_exc_error;
1087: END IF;
1088:
1089: CLOSE c_act_budget_rec;
1090:
1105: ,l_act_budget_rec.status_code);
1106: -- Fund request record
1107: ozf_actbudgets_pvt.update_act_budgets(
1108: p_api_version => l_api_version
1109: ,p_init_msg_list => fnd_api.g_false
1110: ,p_commit => fnd_api.g_false
1111: ,x_return_status => l_return_status
1112: ,x_msg_count => l_msg_count
1113: ,x_msg_data => l_msg_data
1106: -- Fund request record
1107: ozf_actbudgets_pvt.update_act_budgets(
1108: p_api_version => l_api_version
1109: ,p_init_msg_list => fnd_api.g_false
1110: ,p_commit => fnd_api.g_false
1111: ,x_return_status => l_return_status
1112: ,x_msg_count => l_msg_count
1113: ,x_msg_data => l_msg_data
1114: ,p_act_budgets_rec => l_act_budget_rec
1111: ,x_return_status => l_return_status
1112: ,x_msg_count => l_msg_count
1113: ,x_msg_data => l_msg_data
1114: ,p_act_budgets_rec => l_act_budget_rec
1115: ,p_child_approval_flag => FND_API.g_true
1116: -- 10/22/2001 mpande Changed code different owner allocation bug
1117: ,p_requestor_owner_flag =>x_is_requester_owner );
1118:
1119: IF l_return_status = fnd_api.g_ret_sts_error THEN
1115: ,p_child_approval_flag => FND_API.g_true
1116: -- 10/22/2001 mpande Changed code different owner allocation bug
1117: ,p_requestor_owner_flag =>x_is_requester_owner );
1118:
1119: IF l_return_status = fnd_api.g_ret_sts_error THEN
1120: RAISE fnd_api.g_exc_error;
1121: ELSIF l_return_status = fnd_api.g_ret_sts_unexp_error THEN
1122: RAISE fnd_api.g_exc_unexpected_error;
1123: END IF;
1116: -- 10/22/2001 mpande Changed code different owner allocation bug
1117: ,p_requestor_owner_flag =>x_is_requester_owner );
1118:
1119: IF l_return_status = fnd_api.g_ret_sts_error THEN
1120: RAISE fnd_api.g_exc_error;
1121: ELSIF l_return_status = fnd_api.g_ret_sts_unexp_error THEN
1122: RAISE fnd_api.g_exc_unexpected_error;
1123: END IF;
1124: -- if child fund the object veriosn number is +1
1117: ,p_requestor_owner_flag =>x_is_requester_owner );
1118:
1119: IF l_return_status = fnd_api.g_ret_sts_error THEN
1120: RAISE fnd_api.g_exc_error;
1121: ELSIF l_return_status = fnd_api.g_ret_sts_unexp_error THEN
1122: RAISE fnd_api.g_exc_unexpected_error;
1123: END IF;
1124: -- if child fund the object veriosn number is +1
1125: l_act_budget_appr_rec.object_version_number := l_act_budget_appr_rec.object_version_number +1 ;
1118:
1119: IF l_return_status = fnd_api.g_ret_sts_error THEN
1120: RAISE fnd_api.g_exc_error;
1121: ELSIF l_return_status = fnd_api.g_ret_sts_unexp_error THEN
1122: RAISE fnd_api.g_exc_unexpected_error;
1123: END IF;
1124: -- if child fund the object veriosn number is +1
1125: l_act_budget_appr_rec.object_version_number := l_act_budget_appr_rec.object_version_number +1 ;
1126: END IF; -- end if for child fund
1129: -- else trigger the workflow
1130: IF x_is_requester_owner = 'Y' THEN
1131: -- apporve it directly if requester and owner is the same
1132: approve_request(
1133: p_commit => fnd_api.g_false
1134: ,p_update_status => p_update_status
1135: ,p_act_budget_id => l_act_budget_id
1136: ,p_target_fund_id => p_approval_for_id
1137: ,p_source_fund_id => p_approval_fm_id
1145: ,x_return_status => l_return_status
1146: ,x_msg_count => l_msg_count
1147: ,x_msg_data => l_msg_data);
1148:
1149: IF l_return_status = fnd_api.g_ret_sts_error THEN
1150: RAISE fnd_api.g_exc_error;
1151: ELSIF l_return_status = fnd_api.g_ret_sts_unexp_error THEN
1152: RAISE fnd_api.g_exc_unexpected_error;
1153: END IF;
1146: ,x_msg_count => l_msg_count
1147: ,x_msg_data => l_msg_data);
1148:
1149: IF l_return_status = fnd_api.g_ret_sts_error THEN
1150: RAISE fnd_api.g_exc_error;
1151: ELSIF l_return_status = fnd_api.g_ret_sts_unexp_error THEN
1152: RAISE fnd_api.g_exc_unexpected_error;
1153: END IF;
1154: ELSIF x_is_requester_owner = 'N' THEN
1147: ,x_msg_data => l_msg_data);
1148:
1149: IF l_return_status = fnd_api.g_ret_sts_error THEN
1150: RAISE fnd_api.g_exc_error;
1151: ELSIF l_return_status = fnd_api.g_ret_sts_unexp_error THEN
1152: RAISE fnd_api.g_exc_unexpected_error;
1153: END IF;
1154: ELSIF x_is_requester_owner = 'N' THEN
1155:
1148:
1149: IF l_return_status = fnd_api.g_ret_sts_error THEN
1150: RAISE fnd_api.g_exc_error;
1151: ELSIF l_return_status = fnd_api.g_ret_sts_unexp_error THEN
1152: RAISE fnd_api.g_exc_unexpected_error;
1153: END IF;
1154: ELSIF x_is_requester_owner = 'N' THEN
1155:
1156: l_new_status_id :=
1179:
1180: END IF; -- ENDIF x_is_requester_owner
1181:
1182: -- Conditional commit;
1183: IF fnd_api.to_boolean(p_commit)
1184: AND x_return_status = fnd_api.g_ret_sts_success THEN
1185: COMMIT WORK;
1186: END IF;
1187:
1180: END IF; -- ENDIF x_is_requester_owner
1181:
1182: -- Conditional commit;
1183: IF fnd_api.to_boolean(p_commit)
1184: AND x_return_status = fnd_api.g_ret_sts_success THEN
1185: COMMIT WORK;
1186: END IF;
1187:
1188: fnd_msg_pub.count_and_get(
1185: COMMIT WORK;
1186: END IF;
1187:
1188: fnd_msg_pub.count_and_get(
1189: p_encoded => fnd_api.g_false
1190: ,p_count => x_msg_count
1191: ,p_data => x_msg_data);
1192: EXCEPTION
1193: WHEN fnd_api.g_exc_error THEN
1189: p_encoded => fnd_api.g_false
1190: ,p_count => x_msg_count
1191: ,p_data => x_msg_data);
1192: EXCEPTION
1193: WHEN fnd_api.g_exc_error THEN
1194: ROLLBACK TO create_fund_request;
1195: x_return_status := fnd_api.g_ret_sts_error;
1196: fnd_msg_pub.count_and_get(
1197: p_encoded => fnd_api.g_false
1191: ,p_data => x_msg_data);
1192: EXCEPTION
1193: WHEN fnd_api.g_exc_error THEN
1194: ROLLBACK TO create_fund_request;
1195: x_return_status := fnd_api.g_ret_sts_error;
1196: fnd_msg_pub.count_and_get(
1197: p_encoded => fnd_api.g_false
1198: ,p_count => x_msg_count
1199: ,p_data => x_msg_data);
1193: WHEN fnd_api.g_exc_error THEN
1194: ROLLBACK TO create_fund_request;
1195: x_return_status := fnd_api.g_ret_sts_error;
1196: fnd_msg_pub.count_and_get(
1197: p_encoded => fnd_api.g_false
1198: ,p_count => x_msg_count
1199: ,p_data => x_msg_data);
1200: WHEN fnd_api.g_exc_unexpected_error THEN
1201: ROLLBACK TO create_fund_request;
1196: fnd_msg_pub.count_and_get(
1197: p_encoded => fnd_api.g_false
1198: ,p_count => x_msg_count
1199: ,p_data => x_msg_data);
1200: WHEN fnd_api.g_exc_unexpected_error THEN
1201: ROLLBACK TO create_fund_request;
1202: x_return_status := fnd_api.g_ret_sts_unexp_error;
1203: fnd_msg_pub.count_and_get(
1204: p_encoded => fnd_api.g_false
1198: ,p_count => x_msg_count
1199: ,p_data => x_msg_data);
1200: WHEN fnd_api.g_exc_unexpected_error THEN
1201: ROLLBACK TO create_fund_request;
1202: x_return_status := fnd_api.g_ret_sts_unexp_error;
1203: fnd_msg_pub.count_and_get(
1204: p_encoded => fnd_api.g_false
1205: ,p_count => x_msg_count
1206: ,p_data => x_msg_data);
1200: WHEN fnd_api.g_exc_unexpected_error THEN
1201: ROLLBACK TO create_fund_request;
1202: x_return_status := fnd_api.g_ret_sts_unexp_error;
1203: fnd_msg_pub.count_and_get(
1204: p_encoded => fnd_api.g_false
1205: ,p_count => x_msg_count
1206: ,p_data => x_msg_data);
1207: WHEN OTHERS THEN
1208: ROLLBACK TO create_fund_request;
1205: ,p_count => x_msg_count
1206: ,p_data => x_msg_data);
1207: WHEN OTHERS THEN
1208: ROLLBACK TO create_fund_request;
1209: x_return_status := fnd_api.g_ret_sts_unexp_error;
1210:
1211: IF fnd_msg_pub.check_msg_level(fnd_msg_pub.g_msg_lvl_unexp_error) THEN
1212: fnd_msg_pub.add_exc_msg(g_pkg_name, l_api_name);
1213: END IF;
1212: fnd_msg_pub.add_exc_msg(g_pkg_name, l_api_name);
1213: END IF;
1214:
1215: fnd_msg_pub.count_and_get(
1216: p_encoded => fnd_api.g_false
1217: ,p_count => x_msg_count
1218: ,p_data => x_msg_data);
1219: END create_fund_request;
1220:
2286: fnd_message.set_name('OZF', 'OZF_API_RECORD_NOT_FOUND');
2287: fnd_msg_pub.add;
2288: END IF;
2289:
2290: RAISE fnd_api.g_exc_error;
2291: END IF;
2292: CLOSE c_act_budget_rec;
2293: OPEN c_fund_rec(l_fund_id);
2294: FETCH c_fund_rec INTO l_object_details.name,
2308: fnd_message.set_name('OZF', 'OZF_API_RECORD_NOT_FOUND');
2309: fnd_msg_pub.add;
2310: END IF;
2311:
2312: RAISE fnd_api.g_exc_error;
2313: END IF;
2314: CLOSE c_fund_rec;
2315: ELSE
2316: OPEN c_transfer_rec(l_activity_id);
2330: fnd_message.set_name('OZF', 'OZF_API_RECORD_NOT_FOUND');
2331: fnd_msg_pub.add;
2332: END IF;
2333:
2334: RAISE fnd_api.g_exc_error;
2335: END IF;
2336: CLOSE c_transfer_rec;
2337:
2338: END IF;
2348: fnd_message.set_name('OZF', 'OZF_API_RECORD_NOT_FOUND');
2349: fnd_msg_pub.add;
2350: END IF;
2351:
2352: RAISE fnd_api.g_exc_error;
2353: END IF;
2354: CLOSE c_budget_src_rec;
2355:
2356: OPEN c_src_category(l_budget_source_id);
2368: ,x_approval_detail_id => l_approval_detail_id
2369: ,x_approver_seq => l_approver_seq
2370: ,x_return_status => l_return_status);
2371:
2372: IF l_return_status = fnd_api.g_ret_sts_success THEN
2373: wf_engine.setitemattrnumber(
2374: itemtype => itemtype
2375: ,itemkey => itemkey
2376: ,aname => 'AMS_APPROVAL_DETAIL_ID'
2475:
2476: resultout := 'COMPLETE:SUCCESS';
2477: ELSE
2478: fnd_msg_pub.count_and_get(
2479: p_encoded => fnd_api.g_false
2480: ,p_count => l_msg_count
2481: ,p_data => l_msg_data);
2482: ams_gen_approval_pvt.handle_err(
2483: p_itemtype => itemtype
2493: ,itemtype
2494: ,itemkey
2495: ,actid
2496: ,l_error_msg);
2497: -- RAISE FND_API.G_EXC_ERROR;
2498: resultout := 'COMPLETE:ERROR';
2499: END IF;
2500: END IF;
2501:
2516: END IF;
2517: --
2518:
2519: EXCEPTION
2520: WHEN fnd_api.g_exc_error THEN
2521: wf_core.context(
2522: 'ozf_fund_request_apr_pvt'
2523: ,'Set_trans_Activity_Detail'
2524: ,itemtype
2528: ,l_error_msg);
2529: RAISE;
2530: WHEN OTHERS THEN
2531: fnd_msg_pub.count_and_get(
2532: p_encoded => fnd_api.g_false
2533: ,p_count => l_msg_count
2534: ,p_data => l_msg_data);
2535: ams_gen_approval_pvt.handle_err(
2536: p_itemtype => itemtype
2668: ,resultout OUT NOCOPY VARCHAR2)
2669: IS
2670: l_status_code VARCHAR2(30);
2671: l_api_version CONSTANT NUMBER := 1.0;
2672: l_return_status VARCHAR2(1) := fnd_api.g_ret_sts_success;
2673: l_msg_count NUMBER;
2674: l_msg_data VARCHAR2(4000);
2675: l_api_name CONSTANT VARCHAR2(30) := 'Update_ParBudget_Status';
2676: l_full_name CONSTANT VARCHAR2(60) := g_pkg_name || '.' || l_api_name;
2834: fnd_message.set_name('OZF', 'OZF_API_RECORD_NOT_FOUND');
2835: fnd_msg_pub.add;
2836: END IF;
2837:
2838: RAISE fnd_api.g_exc_error;
2839: END IF;
2840: CLOSE c_act_budget_rec;
2841:
2842: -- [BEGIN OF BUG 2750841(same as 2741039) FIXING by yzhao 01/10/2003]
2855: ,p_from_amount=> l_approved_amount
2856: ,x_to_amount=> l_approved_amt_in_from_curr
2857: );
2858:
2859: IF l_return_status = fnd_api.g_ret_sts_unexp_error THEN
2860: RAISE fnd_api.g_exc_unexpected_error;
2861: ELSIF l_return_status = fnd_api.g_ret_sts_error THEN
2862: RAISE fnd_api.g_exc_error;
2863: END IF;
2856: ,x_to_amount=> l_approved_amt_in_from_curr
2857: );
2858:
2859: IF l_return_status = fnd_api.g_ret_sts_unexp_error THEN
2860: RAISE fnd_api.g_exc_unexpected_error;
2861: ELSIF l_return_status = fnd_api.g_ret_sts_error THEN
2862: RAISE fnd_api.g_exc_error;
2863: END IF;
2864:
2857: );
2858:
2859: IF l_return_status = fnd_api.g_ret_sts_unexp_error THEN
2860: RAISE fnd_api.g_exc_unexpected_error;
2861: ELSIF l_return_status = fnd_api.g_ret_sts_error THEN
2862: RAISE fnd_api.g_exc_error;
2863: END IF;
2864:
2865: ELSE
2858:
2859: IF l_return_status = fnd_api.g_ret_sts_unexp_error THEN
2860: RAISE fnd_api.g_exc_unexpected_error;
2861: ELSIF l_return_status = fnd_api.g_ret_sts_error THEN
2862: RAISE fnd_api.g_exc_error;
2863: END IF;
2864:
2865: ELSE
2866: l_approved_amt_in_from_curr := l_approved_amount;
2865: ELSE
2866: l_approved_amt_in_from_curr := l_approved_amount;
2867: END IF;
2868:
2869: -- x_return_status := fnd_api.g_ret_sts_success;
2870: l_status_code := ozf_utility_pvt.get_system_status_code(l_next_status_id);
2871:
2872: IF l_update_status = 'APPROVED' THEN
2873: approve_request(
2870: l_status_code := ozf_utility_pvt.get_system_status_code(l_next_status_id);
2871:
2872: IF l_update_status = 'APPROVED' THEN
2873: approve_request(
2874: p_commit => fnd_api.g_false
2875: ,p_update_status => 'Y'
2876: ,p_act_budget_id => l_act_budget_id
2877: ,p_target_fund_id => l_approval_for_id
2878: ,p_source_fund_id => l_approval_fm_id
2889: ,p_note => l_note);
2890: ELSE
2891: -- 6/14/2002 mpande changed for implementaion of ENH#2352621
2892: negative_request(
2893: p_commit => fnd_api.g_false
2894: ,p_act_budget_id => l_act_budget_id
2895: ,p_target_fund_id => l_approval_for_id
2896: ,p_source_fund_id => l_approval_fm_id
2897: ,p_requester_id => l_requester_id
2907: ,x_msg_count => l_msg_count
2908: ,x_msg_data => l_msg_data);
2909: END IF;
2910:
2911: IF l_return_status <> fnd_api.g_ret_sts_success THEN
2912: ams_gen_approval_pvt.handle_err(
2913: p_itemtype => itemtype
2914: ,p_itemkey => itemkey
2915: ,p_msg_count => l_msg_count
2940: RETURN;
2941: END IF;
2942:
2943: fnd_msg_pub.count_and_get(
2944: p_encoded => fnd_api.g_false
2945: ,p_count => l_msg_count
2946: ,p_data => l_msg_data);
2947: IF G_DEBUG THEN
2948: ozf_utility_pvt.debug_message(l_full_name || ': l_return_status' || l_return_status);
2948: ozf_utility_pvt.debug_message(l_full_name || ': l_return_status' || l_return_status);
2949: END IF;
2950: EXCEPTION
2951: WHEN OTHERS THEN
2952: -- x_return_status := fnd_api.g_ret_sts_error;
2953: fnd_msg_pub.count_and_get(
2954: p_encoded => fnd_api.g_false
2955: ,p_count => l_msg_count
2956: ,p_data => l_msg_data);
2950: EXCEPTION
2951: WHEN OTHERS THEN
2952: -- x_return_status := fnd_api.g_ret_sts_error;
2953: fnd_msg_pub.count_and_get(
2954: p_encoded => fnd_api.g_false
2955: ,p_count => l_msg_count
2956: ,p_data => l_msg_data);
2957: ams_gen_approval_pvt.handle_err(
2958: p_itemtype => itemtype
2998: --
2999: -- End of Comments
3000:
3001: PROCEDURE approve_holdback(
3002: p_commit IN VARCHAR2 := fnd_api.g_false
3003: ,p_act_budget_id IN NUMBER
3004: ,p_transfer_type IN VARCHAR2
3005: ,p_transac_fund_id IN NUMBER
3006: ,p_requester_id IN NUMBER
3017: l_api_version CONSTANT NUMBER := 1.0;
3018: l_msg_count NUMBER;
3019: l_msg_data VARCHAR2(4000);
3020: l_return_status VARCHAR2(1)
3021: := fnd_api.g_ret_sts_success;
3022: l_object_version_number NUMBER;
3023: -- Record variables for creating the fund request.
3024: l_fund_rec ozf_funds_pvt.fund_rec_type; -- transaction fund record
3025: l_act_budget_rec ozf_actbudgets_pvt.act_budgets_rec_type; -- fund request record
3058: l_request_id NUMBER;
3059: l_req_user_status_id NUMBER;
3060: l_req_object_version_number NUMBER;
3061: BEGIN
3062: x_return_status := fnd_api.g_ret_sts_success;
3063: -- Initialize
3064: IF G_DEBUG THEN
3065: ozf_utility_pvt.debug_message(l_full_name || ': start');
3066: END IF;
3075: fnd_message.set_name('OZF', 'OZF_API_RECORD_NOT_FOUND');
3076: fnd_msg_pub.add;
3077: END IF;
3078:
3079: RAISE fnd_api.g_exc_error;
3080: END IF;
3081:
3082: CLOSE c_fund_detail;
3083: -- Check to see whether the fund has sufficient available amount to reserve/release
3090: fnd_message.set_name('OZF', 'OZF_AMT_UNAVAILABLE');
3091: fnd_msg_pub.add;
3092: END IF;
3093:
3094: RAISE fnd_api.g_exc_error;
3095: END IF;
3096:
3097: l_fund_rec.holdback_amt := NVL(l_holdback_amt, 0) + NVL(p_requested_amount, 0); -- HOLDBACK AMT
3098: ELSIF p_transfer_type = 'RELEASE' THEN
3101: fnd_message.set_name('OZF', 'OZF_AMT_UNAVAILABLE');
3102: fnd_msg_pub.add;
3103: END IF;
3104:
3105: RAISE fnd_api.g_exc_error;
3106: END IF;
3107:
3108: l_fund_rec.holdback_amt := NVL(l_holdback_amt, 0) - NVL(p_requested_amount, 0); -- HOLDBACK AMT
3109: END IF;
3116: l_fund_rec.object_version_number := l_obj_number;
3117: -- Update source fund
3118: ozf_funds_pvt.update_fund(
3119: p_api_version => l_api_version
3120: ,p_commit => fnd_api.g_false
3121: ,x_return_status => l_return_status
3122: ,x_msg_count => l_msg_count
3123: ,x_msg_data => l_msg_data
3124: ,p_fund_rec => l_fund_rec
3123: ,x_msg_data => l_msg_data
3124: ,p_fund_rec => l_fund_rec
3125: ,p_mode => 'ADJUST');
3126:
3127: IF l_return_status = fnd_api.g_ret_sts_unexp_error THEN
3128: RAISE fnd_api.g_exc_unexpected_error;
3129: ELSIF l_return_status = fnd_api.g_ret_sts_error THEN
3130: RAISE fnd_api.g_exc_error;
3131: END IF;
3124: ,p_fund_rec => l_fund_rec
3125: ,p_mode => 'ADJUST');
3126:
3127: IF l_return_status = fnd_api.g_ret_sts_unexp_error THEN
3128: RAISE fnd_api.g_exc_unexpected_error;
3129: ELSIF l_return_status = fnd_api.g_ret_sts_error THEN
3130: RAISE fnd_api.g_exc_error;
3131: END IF;
3132:
3125: ,p_mode => 'ADJUST');
3126:
3127: IF l_return_status = fnd_api.g_ret_sts_unexp_error THEN
3128: RAISE fnd_api.g_exc_unexpected_error;
3129: ELSIF l_return_status = fnd_api.g_ret_sts_error THEN
3130: RAISE fnd_api.g_exc_error;
3131: END IF;
3132:
3133: -- Conditional commit
3126:
3127: IF l_return_status = fnd_api.g_ret_sts_unexp_error THEN
3128: RAISE fnd_api.g_exc_unexpected_error;
3129: ELSIF l_return_status = fnd_api.g_ret_sts_error THEN
3130: RAISE fnd_api.g_exc_error;
3131: END IF;
3132:
3133: -- Conditional commit
3134: IF fnd_api.to_boolean(p_commit)
3130: RAISE fnd_api.g_exc_error;
3131: END IF;
3132:
3133: -- Conditional commit
3134: IF fnd_api.to_boolean(p_commit)
3135: AND l_return_status = fnd_api.g_ret_sts_success THEN
3136: COMMIT WORK;
3137: END IF;
3138:
3131: END IF;
3132:
3133: -- Conditional commit
3134: IF fnd_api.to_boolean(p_commit)
3135: AND l_return_status = fnd_api.g_ret_sts_success THEN
3136: COMMIT WORK;
3137: END IF;
3138:
3139: fnd_msg_pub.count_and_get(
3136: COMMIT WORK;
3137: END IF;
3138:
3139: fnd_msg_pub.count_and_get(
3140: p_encoded => fnd_api.g_false
3141: ,p_count => x_msg_count
3142: ,p_data => x_msg_data);
3143: EXCEPTION
3144: WHEN fnd_api.g_exc_error THEN
3140: p_encoded => fnd_api.g_false
3141: ,p_count => x_msg_count
3142: ,p_data => x_msg_data);
3143: EXCEPTION
3144: WHEN fnd_api.g_exc_error THEN
3145: x_return_status := fnd_api.g_ret_sts_error;
3146: fnd_msg_pub.count_and_get(
3147: p_encoded => fnd_api.g_false
3148: ,p_count => x_msg_count
3141: ,p_count => x_msg_count
3142: ,p_data => x_msg_data);
3143: EXCEPTION
3144: WHEN fnd_api.g_exc_error THEN
3145: x_return_status := fnd_api.g_ret_sts_error;
3146: fnd_msg_pub.count_and_get(
3147: p_encoded => fnd_api.g_false
3148: ,p_count => x_msg_count
3149: ,p_data => x_msg_data);
3143: EXCEPTION
3144: WHEN fnd_api.g_exc_error THEN
3145: x_return_status := fnd_api.g_ret_sts_error;
3146: fnd_msg_pub.count_and_get(
3147: p_encoded => fnd_api.g_false
3148: ,p_count => x_msg_count
3149: ,p_data => x_msg_data);
3150: WHEN fnd_api.g_exc_unexpected_error THEN
3151: x_return_status := fnd_api.g_ret_sts_unexp_error;
3146: fnd_msg_pub.count_and_get(
3147: p_encoded => fnd_api.g_false
3148: ,p_count => x_msg_count
3149: ,p_data => x_msg_data);
3150: WHEN fnd_api.g_exc_unexpected_error THEN
3151: x_return_status := fnd_api.g_ret_sts_unexp_error;
3152: fnd_msg_pub.count_and_get(
3153: p_encoded => fnd_api.g_false
3154: ,p_count => x_msg_count
3147: p_encoded => fnd_api.g_false
3148: ,p_count => x_msg_count
3149: ,p_data => x_msg_data);
3150: WHEN fnd_api.g_exc_unexpected_error THEN
3151: x_return_status := fnd_api.g_ret_sts_unexp_error;
3152: fnd_msg_pub.count_and_get(
3153: p_encoded => fnd_api.g_false
3154: ,p_count => x_msg_count
3155: ,p_data => x_msg_data);
3149: ,p_data => x_msg_data);
3150: WHEN fnd_api.g_exc_unexpected_error THEN
3151: x_return_status := fnd_api.g_ret_sts_unexp_error;
3152: fnd_msg_pub.count_and_get(
3153: p_encoded => fnd_api.g_false
3154: ,p_count => x_msg_count
3155: ,p_data => x_msg_data);
3156: WHEN OTHERS THEN
3157: x_return_status := fnd_api.g_ret_sts_unexp_error;
3153: p_encoded => fnd_api.g_false
3154: ,p_count => x_msg_count
3155: ,p_data => x_msg_data);
3156: WHEN OTHERS THEN
3157: x_return_status := fnd_api.g_ret_sts_unexp_error;
3158:
3159: IF fnd_msg_pub.check_msg_level(fnd_msg_pub.g_msg_lvl_unexp_error) THEN
3160: fnd_msg_pub.add_exc_msg(g_pkg_name, l_api_name);
3161: END IF;
3160: fnd_msg_pub.add_exc_msg(g_pkg_name, l_api_name);
3161: END IF;
3162:
3163: fnd_msg_pub.count_and_get(
3164: p_encoded => fnd_api.g_false
3165: ,p_count => x_msg_count
3166: ,p_data => x_msg_data);
3167: END approve_holdback;
3168: END ozf_fund_request_apr_pvt;