882: l_vdr_cntct_name varchar2(25);
883: l_buyer_name po_buyers_v.full_name%TYPE;
884:
885: BEGIN
886: x_return_status := fnd_api.g_ret_sts_success;
887:
888: l_err_po_line_num := p_doc_check_rec_type.line_num(p_po_error_index);
889:
890: IF(p_release_id IS NULL) THEN
1180: l_api_name || '.others_exception',
1181: p_header_id || '*' || p_release_id || '*' || p_err_po_msg || ':' || SQLERRM);
1182: END IF;
1183: END IF;
1184: x_return_status := fnd_api.g_ret_sts_unexp_error;
1185: x_return_msg := 'DPE_UNEXP:' || p_header_id || '*' || p_release_id || '*' || p_err_po_msg || '*' || l_progress || ':' || SQLERRM;
1186: END decode_poerror;
1187:
1188: /*
1386: IS
1387: l_api_name VARCHAR2(50) := 'Validate_Changes';
1388: l_po_change_table pos_chg_rec_tbl;
1389: l_error_table error_tbl_type;
1390: l_main_loop_flag VARCHAR2(1) := fnd_api.g_true;
1391: l_get_cur_id_loop_flag VARCHAR2(1) := fnd_api.g_true;
1392: i NUMBER := 2;
1393: j NUMBER;
1394: k NUMBER;
1387: l_api_name VARCHAR2(50) := 'Validate_Changes';
1388: l_po_change_table pos_chg_rec_tbl;
1389: l_error_table error_tbl_type;
1390: l_main_loop_flag VARCHAR2(1) := fnd_api.g_true;
1391: l_get_cur_id_loop_flag VARCHAR2(1) := fnd_api.g_true;
1392: i NUMBER := 2;
1393: j NUMBER;
1394: k NUMBER;
1395: l_table_index NUMBER;
1419: l_err_count NUMBER;
1420: l_req_org_id NUMBER;
1421: BEGIN
1422: x_retmsg := 'VC000';
1423: x_return_status := fnd_api.g_ret_sts_success;
1424:
1425: j := 1;
1426: l_main_loop_flag := fnd_api.g_true;
1427:
1422: x_retmsg := 'VC000';
1423: x_return_status := fnd_api.g_ret_sts_success;
1424:
1425: j := 1;
1426: l_main_loop_flag := fnd_api.g_true;
1427:
1428: --Main Loop Starts
1429: --Main Loop continues so as long there exists records with dirty_flag = 'N'
1430: WHILE(l_main_loop_flag = fnd_api.g_true)
1426: l_main_loop_flag := fnd_api.g_true;
1427:
1428: --Main Loop Starts
1429: --Main Loop continues so as long there exists records with dirty_flag = 'N'
1430: WHILE(l_main_loop_flag = fnd_api.g_true)
1431: LOOP
1432: x_retmsg := 'VC001';
1433: --Get First Clean Row => dirty_flag ='N'
1434: l_get_cur_id_loop_flag := fnd_api.g_true;
1430: WHILE(l_main_loop_flag = fnd_api.g_true)
1431: LOOP
1432: x_retmsg := 'VC001';
1433: --Get First Clean Row => dirty_flag ='N'
1434: l_get_cur_id_loop_flag := fnd_api.g_true;
1435: l_found_clean := fnd_api.g_true;
1436: WHILE(l_get_cur_id_loop_flag = fnd_api.g_true) LOOP
1437: IF(j = p_req_change_table.count + 1) THEN /*Cannot find any Clean Row, Thus End Procedure*/
1438: l_main_loop_flag := fnd_api.g_false;
1431: LOOP
1432: x_retmsg := 'VC001';
1433: --Get First Clean Row => dirty_flag ='N'
1434: l_get_cur_id_loop_flag := fnd_api.g_true;
1435: l_found_clean := fnd_api.g_true;
1436: WHILE(l_get_cur_id_loop_flag = fnd_api.g_true) LOOP
1437: IF(j = p_req_change_table.count + 1) THEN /*Cannot find any Clean Row, Thus End Procedure*/
1438: l_main_loop_flag := fnd_api.g_false;
1439: l_get_cur_id_loop_flag := fnd_api.g_false;
1432: x_retmsg := 'VC001';
1433: --Get First Clean Row => dirty_flag ='N'
1434: l_get_cur_id_loop_flag := fnd_api.g_true;
1435: l_found_clean := fnd_api.g_true;
1436: WHILE(l_get_cur_id_loop_flag = fnd_api.g_true) LOOP
1437: IF(j = p_req_change_table.count + 1) THEN /*Cannot find any Clean Row, Thus End Procedure*/
1438: l_main_loop_flag := fnd_api.g_false;
1439: l_get_cur_id_loop_flag := fnd_api.g_false;
1440: l_found_clean := fnd_api.g_false;
1434: l_get_cur_id_loop_flag := fnd_api.g_true;
1435: l_found_clean := fnd_api.g_true;
1436: WHILE(l_get_cur_id_loop_flag = fnd_api.g_true) LOOP
1437: IF(j = p_req_change_table.count + 1) THEN /*Cannot find any Clean Row, Thus End Procedure*/
1438: l_main_loop_flag := fnd_api.g_false;
1439: l_get_cur_id_loop_flag := fnd_api.g_false;
1440: l_found_clean := fnd_api.g_false;
1441: ELSIF(p_req_change_table(j).dirty_flag = 'N') THEN
1442: l_current_row_id := j;
1435: l_found_clean := fnd_api.g_true;
1436: WHILE(l_get_cur_id_loop_flag = fnd_api.g_true) LOOP
1437: IF(j = p_req_change_table.count + 1) THEN /*Cannot find any Clean Row, Thus End Procedure*/
1438: l_main_loop_flag := fnd_api.g_false;
1439: l_get_cur_id_loop_flag := fnd_api.g_false;
1440: l_found_clean := fnd_api.g_false;
1441: ELSIF(p_req_change_table(j).dirty_flag = 'N') THEN
1442: l_current_row_id := j;
1443: j := j + 1;
1436: WHILE(l_get_cur_id_loop_flag = fnd_api.g_true) LOOP
1437: IF(j = p_req_change_table.count + 1) THEN /*Cannot find any Clean Row, Thus End Procedure*/
1438: l_main_loop_flag := fnd_api.g_false;
1439: l_get_cur_id_loop_flag := fnd_api.g_false;
1440: l_found_clean := fnd_api.g_false;
1441: ELSIF(p_req_change_table(j).dirty_flag = 'N') THEN
1442: l_current_row_id := j;
1443: j := j + 1;
1444: l_get_cur_id_loop_flag := fnd_api.g_false;
1440: l_found_clean := fnd_api.g_false;
1441: ELSIF(p_req_change_table(j).dirty_flag = 'N') THEN
1442: l_current_row_id := j;
1443: j := j + 1;
1444: l_get_cur_id_loop_flag := fnd_api.g_false;
1445: ELSE
1446: j := j + 1;
1447: END IF;
1448: END LOOP;
1450: x_retmsg := 'VC002';
1451:
1452: --Obtained First Clean Row in l_current_row_id
1453:
1454: IF(l_found_clean = fnd_api.g_true) THEN
1455:
1456: --Get po_header_id/po_release_id for the current Clean Row
1457: SELECT
1458: plla.po_header_id,
1553: x_retmsg := 'VC0031-1';
1554:
1555: po_chg_request_pvt.validate_change_request(
1556: p_api_version => 1.0,
1557: p_init_msg_list => fnd_api.g_false,
1558: x_return_status => l_return_status,
1559: x_msg_data => l_return_msg,
1560: p_po_header_id => l_current_hdr_id,
1561: p_po_release_id => l_current_rel_id,
1576:
1577: -- set org context back to req's org
1578: po_moac_utils_pvt.set_org_context(l_req_org_id) ; --
1579:
1580: IF(l_return_status = fnd_api.g_ret_sts_error) THEN
1581: x_retmsg := 'VC0d31:' || l_return_msg;
1582: l_err_count := l_doc_check_rec_type.online_report_id.count;
1583: IF(l_err_count > 0) THEN
1584: FOR y IN 1..l_err_count
1592: p_errortable,
1593: l_error_index,
1594: l_decode_status,
1595: l_decode_msg);
1596: IF(l_decode_status <> fnd_api.g_ret_sts_success) THEN
1597: x_retmsg := 'VC0d41:' || l_decode_msg;
1598: x_return_status := fnd_api.g_ret_sts_error;
1599: RETURN;
1600: END IF;
1594: l_decode_status,
1595: l_decode_msg);
1596: IF(l_decode_status <> fnd_api.g_ret_sts_success) THEN
1597: x_retmsg := 'VC0d41:' || l_decode_msg;
1598: x_return_status := fnd_api.g_ret_sts_error;
1599: RETURN;
1600: END IF;
1601: END LOOP;
1602: END IF;
1599: RETURN;
1600: END IF;
1601: END LOOP;
1602: END IF;
1603: ELSIF(l_return_status = fnd_api.g_ret_sts_unexp_error) THEN
1604: x_retmsg := 'VC0f31:' || l_return_msg;
1605: x_return_status := fnd_api.g_ret_sts_unexp_error;
1606: RETURN;
1607: END IF;
1601: END LOOP;
1602: END IF;
1603: ELSIF(l_return_status = fnd_api.g_ret_sts_unexp_error) THEN
1604: x_retmsg := 'VC0f31:' || l_return_msg;
1605: x_return_status := fnd_api.g_ret_sts_unexp_error;
1606: RETURN;
1607: END IF;
1608:
1609: END IF;
1613: x_retmsg := 'VC004';
1614:
1615: IF(p_errortable.req_line_id.count>0) THEN
1616:
1617: x_return_status := fnd_api.g_ret_sts_error;
1618: ELSE
1619:
1620: x_return_status := fnd_api.g_ret_sts_success;
1621: END IF;
1616:
1617: x_return_status := fnd_api.g_ret_sts_error;
1618: ELSE
1619:
1620: x_return_status := fnd_api.g_ret_sts_success;
1621: END IF;
1622:
1623:
1624: EXCEPTION WHEN OTHERS THEN
1621: END IF;
1622:
1623:
1624: EXCEPTION WHEN OTHERS THEN
1625: x_return_status := fnd_api.g_ret_sts_unexp_error;
1626: x_retmsg := 'VC_Exp:' || x_retmsg || ':' || SQLERRM;
1627: IF g_fnd_debug = 'Y' THEN
1628: IF (fnd_log.g_current_runtime_level <= fnd_log.level_unexpected) THEN
1629: fnd_log.string(fnd_log.level_unexpected, g_module_prefix ||
1769: l_new_total NUMBER;
1770: l_rec_tax NUMBER;
1771: l_nonrec_tax NUMBER;
1772: BEGIN
1773: x_return_status := fnd_api.g_ret_sts_success;
1774:
1775: SELECT
1776: decode(prl.matching_basis, 'AMOUNT', prd.req_line_amount, prl.unit_price * prd.req_line_quantity),
1777: decode(prl.matching_basis, 'AMOUNT', p_dist_amount, nvl(p_price, prl.unit_price) * nvl(p_quantity, prd.req_line_quantity)),
1797: (l_nonrec_tax / l_dist_total) *
1798: l_new_total;
1799: END IF;
1800: EXCEPTION WHEN OTHERS THEN
1801: x_return_status := fnd_api.g_ret_sts_unexp_error;
1802: IF g_fnd_debug = 'Y' THEN
1803: IF (fnd_log.g_current_runtime_level <= fnd_log.level_unexpected) THEN
1804: fnd_log.string(fnd_log.level_unexpected, g_module_prefix ||
1805: l_api_name || '.others_exception', SQLERRM);
2689: END IF;
2690:
2691: EXCEPTION
2692: WHEN OTHERS THEN
2693: x_return_status := fnd_api.g_ret_sts_unexp_error;
2694: fnd_msg_pub.add_exc_msg(g_module_prefix, l_api_name);
2695: END is_on_complex_work_order;
2696:
2697: /*--------------------------------------------------------------
2715: END IF;
2716:
2717: EXCEPTION
2718: WHEN OTHERS THEN
2719: x_return_status := fnd_api.g_ret_sts_unexp_error;
2720: fnd_msg_pub.add_exc_msg(g_module_prefix, l_api_name);
2721: END is_complex_work_order;
2722:
2723:
2769: is_so_cancel varchar2(1):='N';
2770: l_sts varchar2(3);
2771: BEGIN
2772:
2773: x_return_status := fnd_api.g_ret_sts_success;
2774: /*
2775: * If called directly from the UI, we will need to make some extra validations,
2776: * which are also included in IS_REQ_LINE_CHANGEABLE.
2777: */
2814: 'Req Line ID:' || p_req_line_id || ' ' ||
2815: 'is Already cancelled');
2816: END IF;
2817: END IF;
2818: x_return_status := fnd_api.g_ret_sts_error;
2819: RETURN;
2820: END IF;
2821:
2822:
2836: 'Req Line ID:' || p_req_line_id || ' ' ||
2837: 'transferred to so ='||is_so_cancel||' status'||l_sts);
2838: END IF;
2839: END IF;
2840: IF( l_sts <> fnd_api.g_ret_sts_success OR ( l_sts = fnd_api.g_ret_sts_success AND is_so_cancel = 'N') )THEN
2841: x_return_status := fnd_api.g_ret_sts_error;
2842: END IF;
2843: Else
2844: is_internal_line_cancellable(1.0, x_return_status, p_req_line_id);
2837: 'transferred to so ='||is_so_cancel||' status'||l_sts);
2838: END IF;
2839: END IF;
2840: IF( l_sts <> fnd_api.g_ret_sts_success OR ( l_sts = fnd_api.g_ret_sts_success AND is_so_cancel = 'N') )THEN
2841: x_return_status := fnd_api.g_ret_sts_error;
2842: END IF;
2843: Else
2844: is_internal_line_cancellable(1.0, x_return_status, p_req_line_id);
2845: END IF;
2866: -- If the line is linked to a complex work PO, is not cancellable.
2867: IF(l_po_line_loc_id IS NOT NULL) THEN
2868: is_on_complex_work_order(l_po_line_loc_id, l_is_on_complex_work_po);
2869: IF(l_is_on_complex_work_po = 'Y') THEN
2870: x_return_status := fnd_api.g_ret_sts_error;
2871: END IF;
2872: END IF;
2873:
2874: -- Line is placed on PO. Check if the req is in change pending status
2872: END IF;
2873:
2874: -- Line is placed on PO. Check if the req is in change pending status
2875: IF (l_req_change_pending_flag = 'Y' AND l_po_line_loc_id IS NOT NULL) THEN
2876: x_return_status := fnd_api.g_ret_sts_error;
2877: END IF;
2878:
2879: IF (l_modified_by_agent = 'Y') THEN
2880: x_return_status := fnd_api.g_ret_sts_error;
2876: x_return_status := fnd_api.g_ret_sts_error;
2877: END IF;
2878:
2879: IF (l_modified_by_agent = 'Y') THEN
2880: x_return_status := fnd_api.g_ret_sts_error;
2881: END IF;
2882:
2883: l_progress := '001';
2884:
2885: /*
2886: * Final Validation to check if a line can be cancelled will be done by
2887: * calling PO Cancel API to check if the corresponding shipment can be cancelled
2888: */
2889: IF (x_return_status = fnd_api.g_ret_sts_success AND l_po_line_loc_id IS NOT NULL) THEN
2890: IF (p_origin IS NULL) THEN
2891: SELECT COUNT(DISTINCT nvl(prda.requisition_line_id, - 1))
2892: INTO l_count
2893: FROM
2898: AND prla.requisition_line_id = p_req_line_id
2899: AND pda.req_distribution_id = prda.distribution_id(+ );
2900:
2901: IF (l_count > 1) THEN
2902: x_return_status := fnd_api.g_ret_sts_error;
2903: RETURN;
2904: END IF;
2905: END IF;
2906:
2957: 'Shipment Fully Received');
2958: END IF;
2959: END IF;
2960:
2961: x_return_status := fnd_api.g_ret_sts_error;
2962: RETURN;
2963: END IF;
2964:
2965: l_progress := '004';
2976: 'Shipment Fully Billed');
2977: END IF;
2978: END IF;
2979:
2980: x_return_status := fnd_api.g_ret_sts_error;
2981: RETURN;
2982: END IF;
2983:
2984: l_progress := '005';
2999: 'Shipment Over Billed');
3000: END IF;
3001: END IF;
3002:
3003: x_return_status := fnd_api.g_ret_sts_error;
3004: RETURN;
3005: END IF;
3006:
3007: l_progress := '006';
3025: 'RCV transaction exists for Shipment');
3026: END IF;
3027: END IF;
3028:
3029: x_return_status := fnd_api.g_ret_sts_error;
3030: RETURN;
3031: END IF;
3032:
3033: EXCEPTION
3058: 'ASN not Fully Received');
3059: END IF;
3060: END IF;
3061:
3062: x_return_status := fnd_api.g_ret_sts_error;
3063: RETURN;
3064: END IF;
3065:
3066: EXCEPTION
3097: 'Shipment Received but not Delivered');
3098: END IF;
3099: END IF;
3100:
3101: x_return_status := fnd_api.g_ret_sts_error;
3102: RETURN;
3103: END IF;
3104:
3105: EXCEPTION
3147: 'Distribution Checks Failed');
3148: END IF;
3149: END IF;
3150:
3151: x_return_status := fnd_api.g_ret_sts_error;
3152: RETURN;
3153: END IF;
3154:
3155: EXCEPTION
3191: l_progress := '012';
3192:
3193: po_document_control_grp.check_control_action(
3194: p_api_version => 1.0,
3195: p_init_msg_list => fnd_api.g_true,
3196: x_return_status => l_return_status,
3197: p_doc_type => l_po_doc_type,
3198: p_doc_subtype => l_po_doc_subtype,
3199: p_doc_id => l_po_header_id,
3218: 'PO_Document_Control_GRP.check_control_action result:' || l_return_status);
3219: END IF;
3220: END IF;
3221:
3222: IF (l_return_status = fnd_api.g_ret_sts_success) THEN
3223: x_return_status := fnd_api.g_ret_sts_success;
3224: ELSE
3225: x_return_status := fnd_api.g_ret_sts_error;
3226: END IF;
3219: END IF;
3220: END IF;
3221:
3222: IF (l_return_status = fnd_api.g_ret_sts_success) THEN
3223: x_return_status := fnd_api.g_ret_sts_success;
3224: ELSE
3225: x_return_status := fnd_api.g_ret_sts_error;
3226: END IF;
3227:
3221:
3222: IF (l_return_status = fnd_api.g_ret_sts_success) THEN
3223: x_return_status := fnd_api.g_ret_sts_success;
3224: ELSE
3225: x_return_status := fnd_api.g_ret_sts_error;
3226: END IF;
3227:
3228: END IF;
3229: EXCEPTION WHEN OTHERS THEN
3226: END IF;
3227:
3228: END IF;
3229: EXCEPTION WHEN OTHERS THEN
3230: x_return_status := fnd_api.g_ret_sts_unexp_error;
3231: IF (g_fnd_debug = 'Y') THEN
3232: IF (fnd_log.g_current_runtime_level <= fnd_log.level_unexpected) THEN
3233: fnd_log.string(fnd_log.level_unexpected, g_module_prefix ||
3234: l_api_name || '.others_exception',
3290: l_price_updateable varchar2(1);
3291: BEGIN
3292:
3293:
3294: x_return_status := fnd_api.g_ret_sts_success;
3295: l_line_changeable_flag := 'Y';
3296: p_price_changeable_flag := 'Y';
3297: p_date_changeable_flag := 'Y';
3298: p_qty_changeable_flag := 'Y';
3477: IF (l_source_type_code = 'INVENTORY') THEN
3478: l_line_changeable_flag := 'N';
3479:
3480: IF ( nvl(l_transferred_to_oe_flag,'N') = 'Y' ) THEN
3481: l_return_status := FND_API.G_RET_STS_ERROR;
3482: Else
3483: is_internal_line_cancellable(1.0, l_return_status, p_req_line_id);
3484: END IF;
3485:
3482: Else
3483: is_internal_line_cancellable(1.0, l_return_status, p_req_line_id);
3484: END IF;
3485:
3486: IF (l_return_status <> fnd_api.g_ret_sts_success) THEN
3487: p_cancellable_flag := 'N';
3488: END IF;
3489:
3490: --Is there any PO associated with line?(Validation #1 in DLD)
3673: * can be cancelled.
3674: */
3675: IF(p_cancellable_flag = 'Y') THEN
3676: is_req_line_cancellable(1.0, l_return_status, p_req_line_id, 'Y');
3677: IF(l_return_status = fnd_api.g_ret_sts_error) THEN
3678: p_cancellable_flag := 'N';
3679: END IF;
3680: END IF;
3681:
3686: l_api_name || '.others_exception',
3687: p_req_line_id || '*' || l_progress || ':' || SQLERRM);
3688: END IF;
3689: END IF;
3690: x_return_status := fnd_api.g_ret_sts_unexp_error;
3691: END is_req_line_changeable;
3692:
3693: /*-------------------------------------------------------------------------------------------------
3694: *This API is called directly from the UI. It will have PLSQL tables as input, which contain change/cancel requests
3693: /*-------------------------------------------------------------------------------------------------
3694: *This API is called directly from the UI. It will have PLSQL tables as input, which contain change/cancel requests
3695: *1. Validate the requests
3696: *2. If ALL valid, same them into PO_CHANGE_REQUESTS table
3697: *x_return_status = FND_API.G_RET_STS_SUCCESS => Everything is Valid, and records are saved into change table
3698: * FND_API.G_RET_STS_ERROR => Caught Errors, thus no records are saved into change table
3699: * FND_API.G_RET_STS_UNEXP_ERROR => Unexpected Errors Occur in the API
3700: *x_retMsg will indicate details/location of errors.
3701: ---------------------------------------------------------------------------------------------------*/
3694: *This API is called directly from the UI. It will have PLSQL tables as input, which contain change/cancel requests
3695: *1. Validate the requests
3696: *2. If ALL valid, same them into PO_CHANGE_REQUESTS table
3697: *x_return_status = FND_API.G_RET_STS_SUCCESS => Everything is Valid, and records are saved into change table
3698: * FND_API.G_RET_STS_ERROR => Caught Errors, thus no records are saved into change table
3699: * FND_API.G_RET_STS_UNEXP_ERROR => Unexpected Errors Occur in the API
3700: *x_retMsg will indicate details/location of errors.
3701: ---------------------------------------------------------------------------------------------------*/
3702: PROCEDURE save_reqchange(p_api_version IN NUMBER,
3695: *1. Validate the requests
3696: *2. If ALL valid, same them into PO_CHANGE_REQUESTS table
3697: *x_return_status = FND_API.G_RET_STS_SUCCESS => Everything is Valid, and records are saved into change table
3698: * FND_API.G_RET_STS_ERROR => Caught Errors, thus no records are saved into change table
3699: * FND_API.G_RET_STS_UNEXP_ERROR => Unexpected Errors Occur in the API
3700: *x_retMsg will indicate details/location of errors.
3701: ---------------------------------------------------------------------------------------------------*/
3702: PROCEDURE save_reqchange(p_api_version IN NUMBER,
3703: x_return_status OUT NOCOPY VARCHAR2,
3711: l_api_name VARCHAR2(50) := 'Save_ReqChange';
3712: l_req_change_table change_tbl_type;
3713: l_dummy NUMBER;
3714: y NUMBER := 1;
3715: l_change_result VARCHAR2(1) := fnd_api.g_ret_sts_success;
3716: l_cancel_result VARCHAR2(1);
3717: l_err_line_id_tbl po_tbl_number;
3718: l_err_line_num_tbl po_tbl_number;
3719: l_err_dist_id_tbl po_tbl_number;
3864: validate_changes(p_req_hdr_id, l_req_change_table, l_change_result, x_retmsg, x_errtable);
3865: END IF;
3866:
3867: --If ALL changes are valid, we will insert change records, and insert cancel records(if any)
3868: IF(l_change_result = fnd_api.g_ret_sts_success) THEN
3869: x_retmsg := 'SRCH004';
3870: SELECT po_chg_request_seq.nextval INTO p_change_request_group_id FROM dual;
3871:
3872: insert_reqchange(l_req_change_table, p_change_request_group_id);
3883:
3884: x_retmsg := 'SRCH0062';
3885:
3886: --Process Cancellation Requests
3887: l_cancel_result := fnd_api.g_ret_sts_success;
3888:
3889: IF(p_cancel_table IS NOT NULL) THEN
3890: save_reqcancel(1.0, l_cancel_result, p_req_hdr_id, p_cancel_table, l_dummy, x_retmsg, p_change_request_group_id);
3891: END IF;
3890: save_reqcancel(1.0, l_cancel_result, p_req_hdr_id, p_cancel_table, l_dummy, x_retmsg, p_change_request_group_id);
3891: END IF;
3892:
3893: x_return_status := l_cancel_result;
3894: ELSIF(l_change_result = fnd_api.g_ret_sts_error) THEN
3895: x_return_status := fnd_api.g_ret_sts_error;
3896: x_retmsg := 'SRCH007';
3897: ELSE
3898: x_return_status := fnd_api.g_ret_sts_error;
3891: END IF;
3892:
3893: x_return_status := l_cancel_result;
3894: ELSIF(l_change_result = fnd_api.g_ret_sts_error) THEN
3895: x_return_status := fnd_api.g_ret_sts_error;
3896: x_retmsg := 'SRCH007';
3897: ELSE
3898: x_return_status := fnd_api.g_ret_sts_error;
3899:
3894: ELSIF(l_change_result = fnd_api.g_ret_sts_error) THEN
3895: x_return_status := fnd_api.g_ret_sts_error;
3896: x_retmsg := 'SRCH007';
3897: ELSE
3898: x_return_status := fnd_api.g_ret_sts_error;
3899:
3900: END IF;
3901:
3902: EXCEPTION
3901:
3902: EXCEPTION
3903: WHEN OTHERS THEN
3904: x_retmsg := 'SRCHUNEXP:' || x_retmsg || ':' || SQLERRM;
3905: x_return_status := fnd_api.g_ret_sts_unexp_error;
3906: IF g_fnd_debug = 'Y' THEN
3907: IF (fnd_log.g_current_runtime_level <= fnd_log.level_unexpected) THEN
3908: fnd_log.string(fnd_log.level_unexpected, g_module_prefix ||
3909: l_api_name || '.others_exception', x_retmsg);
4080:
4081: END LOOP;
4082:
4083:
4084: x_return_status := fnd_api.g_ret_sts_success;
4085: EXCEPTION WHEN OTHERS THEN
4086: x_return_status := fnd_api.g_ret_sts_unexp_error;
4087: IF g_fnd_debug = 'Y' THEN
4088: IF (fnd_log.g_current_runtime_level <= fnd_log.level_unexpected) THEN
4082:
4083:
4084: x_return_status := fnd_api.g_ret_sts_success;
4085: EXCEPTION WHEN OTHERS THEN
4086: x_return_status := fnd_api.g_ret_sts_unexp_error;
4087: IF g_fnd_debug = 'Y' THEN
4088: IF (fnd_log.g_current_runtime_level <= fnd_log.level_unexpected) THEN
4089: fnd_log.string(fnd_log.level_unexpected, g_module_prefix ||
4090: l_api_name || '.others_exception', x_retmsg || ':' || SQLERRM);
4131: l_old_quantity NUMBER;
4132: l_old_tax NUMBER;
4133: l_ship_to_org_id NUMBER;
4134: l_ship_to_loc_id NUMBER;
4135: l_price_changed_flag VARCHAR2(1) := fnd_api.g_false;
4136: l_qty_changed_flag VARCHAR2(1) := fnd_api.g_false;
4137: l_change_exist VARCHAR2(1);
4138: l_cancel_exist VARCHAR2(1);
4139: l_new_price NUMBER;
4132: l_old_tax NUMBER;
4133: l_ship_to_org_id NUMBER;
4134: l_ship_to_loc_id NUMBER;
4135: l_price_changed_flag VARCHAR2(1) := fnd_api.g_false;
4136: l_qty_changed_flag VARCHAR2(1) := fnd_api.g_false;
4137: l_change_exist VARCHAR2(1);
4138: l_cancel_exist VARCHAR2(1);
4139: l_new_price NUMBER;
4140: l_new_quantity NUMBER;
4313:
4314:
4315: BEGIN
4316: x_retmsg := 'SMRCH000';
4317: x_return_status := fnd_api.g_ret_sts_success;
4318:
4319: --Check if Funds Check is needed
4320: SELECT
4321: nvl(fsp.req_encumbrance_flag, 'N'),
4384: p_make_new_copies_flag => po_document_funds_grp.g_parameter_yes,
4385: p_check_only_flag => po_document_funds_grp.g_parameter_yes);
4386:
4387: -- error handling after calling populate_encumbrance_gt
4388: IF (x_return_status <> fnd_api.g_ret_sts_success) THEN
4389: x_retmsg := 'After calling populate_encumbrance_gt';
4390: x_errcode := 'FC_FAIL';
4391: RETURN;
4392: END IF;
4414: p_make_new_copies_flag => po_document_funds_grp.g_parameter_yes,
4415: p_check_only_flag => po_document_funds_grp.g_parameter_yes);
4416:
4417: -- error handling after calling populate_encumbrance_gt
4418: IF (x_return_status <> fnd_api.g_ret_sts_success) THEN
4419: x_retmsg := 'After calling populate_encumbrance_gt (release)';
4420: x_errcode := 'FC_FAIL';
4421: RETURN;
4422: END IF;
4530:
4531:
4532: EXCEPTION
4533: WHEN NO_DATA_FOUND THEN
4534: x_return_status := FND_API.G_RET_STS_ERROR;
4535: x_retMsg := 'SMRCH0033: No Open GL Period';
4536: x_errCode := 'FC_GL_PERIOD_ERROR';
4537: RETURN;
4538: END; */
4666: 'FUNDS CHECK:' || l_fc_result_status ||' PO RETURN CODE:' || l_po_return_code);
4667: END IF;
4668: END IF;
4669:
4670: IF (l_fc_result_status = fnd_api.g_ret_sts_unexp_error) THEN
4671: x_errcode := 'FC_ERROR';
4672: x_return_status := fnd_api.g_ret_sts_error;
4673: RETURN;
4674:
4668: END IF;
4669:
4670: IF (l_fc_result_status = fnd_api.g_ret_sts_unexp_error) THEN
4671: x_errcode := 'FC_ERROR';
4672: x_return_status := fnd_api.g_ret_sts_error;
4673: RETURN;
4674:
4675: ELSE
4676:
4674:
4675: ELSE
4676:
4677: IF (l_po_return_code = po_document_funds_grp.g_return_success) THEN
4678: x_return_status := fnd_api.g_ret_sts_success;
4679:
4680: ELSE -- there can be warning/error message for other cases
4681: IF (l_po_return_code = po_document_funds_grp.g_return_WARNING) THEN
4682: x_errCode := 'FC_WARN';
4682: x_errCode := 'FC_WARN';
4683: ELSE
4684: x_errcode := 'FC_FAIL';
4685: END IF;
4686: x_return_status := fnd_api.g_ret_sts_error;
4687:
4688: -- populate x_errTable (output PLSQL table) with the corresponding
4689: -- funds check error messages.
4690:
4834: --Kick Off Workflow
4835: x_retmsg := 'SMRCH009';
4836: po_reqchangerequestwf_pvt.submit_req_change(
4837: p_api_version => 1.0,
4838: p_commit => fnd_api.g_false,
4839:
4840: p_req_header_id => l_req_hdr_id,
4841: p_note_to_approver => p_note_to_approver,
4842: p_initiator => p_initiator,
4842: p_initiator => p_initiator,
4843: x_return_status => l_wf_status);
4844: ELSE
4845: x_errcode := 'VC_FAIL';
4846: x_return_status := fnd_api.g_ret_sts_error;
4847: END IF;
4848: EXCEPTION WHEN OTHERS THEN
4849: x_return_status := fnd_api.g_ret_sts_unexp_error;
4850: x_retmsg := x_retmsg || ':' || SQLERRM;
4845: x_errcode := 'VC_FAIL';
4846: x_return_status := fnd_api.g_ret_sts_error;
4847: END IF;
4848: EXCEPTION WHEN OTHERS THEN
4849: x_return_status := fnd_api.g_ret_sts_unexp_error;
4850: x_retmsg := x_retmsg || ':' || SQLERRM;
4851: IF g_fnd_debug = 'Y' THEN
4852: IF (fnd_log.g_current_runtime_level <= fnd_log.level_unexpected) THEN
4853: fnd_log.string(fnd_log.level_unexpected, g_module_prefix ||
4939: END LOOP;
4940:
4941: CLOSE l_cancels_csr;
4942:
4943: x_return_status := fnd_api.g_ret_sts_success;
4944:
4945: --If all requests are valid, update status to "NEW", and kick off Workflow
4946:
4947: IF(p_errtable.req_line_id.count = 0) THEN
4953: IF (p_origin IS NULL AND l_workflow_needed = 'Y') THEN
4954:
4955: po_reqchangerequestwf_pvt.submit_req_change(
4956: p_api_version => 1.0,
4957: p_commit => fnd_api.g_false,
4958: x_return_status => l_wf_status,
4959: p_req_header_id => l_req_hdr_id,
4960: p_note_to_approver => NULL,
4961: p_initiator => 'REQUESTER');
4960: p_note_to_approver => NULL,
4961: p_initiator => 'REQUESTER');
4962: END IF;
4963: ELSE
4964: x_return_status := fnd_api.g_ret_sts_error;
4965: END IF;
4966:
4967: EXCEPTION WHEN OTHERS THEN
4968: x_return_status := fnd_api.g_ret_sts_unexp_error ;
4964: x_return_status := fnd_api.g_ret_sts_error;
4965: END IF;
4966:
4967: EXCEPTION WHEN OTHERS THEN
4968: x_return_status := fnd_api.g_ret_sts_unexp_error ;
4969: IF g_fnd_debug = 'Y' THEN
4970: IF (fnd_log.g_current_runtime_level <= fnd_log.level_unexpected) THEN
4971: fnd_log.string(fnd_log.level_unexpected, g_module_prefix ||
4972: l_api_name || '.others_exception', SQLERRM);
4988: l_api_name varchar2(50):= 'Is_Internal_Line_Cancellable';
4989: BEGIN
4990: BEGIN
4991:
4992: x_return_status := FND_API.G_RET_STS_SUCCESS;
4993:
4994: SELECT
4995: prl.requisition_line_id,
4996: prh.requisition_header_id
5022:
5023: EXCEPTION
5024:
5025: WHEN NO_DATA_FOUND THEN
5026: x_return_status := FND_API.G_RET_STS_ERROR;
5027: RETURN;
5028:
5029: WHEN OTHERS THEN
5030: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
5026: x_return_status := FND_API.G_RET_STS_ERROR;
5027: RETURN;
5028:
5029: WHEN OTHERS THEN
5030: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
5031: IF (g_fnd_debug = 'Y') THEN
5032: IF (FND_LOG.G_CURRENT_RUNTIME_LEVEL <= FND_LOG.LEVEL_UNEXPECTED) THEN
5033: FND_LOG.string(FND_LOG.level_unexpected, g_module_prefix ||
5034: l_api_name || '.others_exception',
5043: BEGIN
5044: IF po_req_lines_sv.val_oe_shipment_in_proc(l_req_header_id,
5045: p_req_line_id) = FALSE
5046: THEN
5047: x_return_status := FND_API.G_RET_STS_ERROR;
5048: RETURN;
5049: END IF;
5050: EXCEPTION
5051: WHEN NO_DATA_FOUND THEN
5048: RETURN;
5049: END IF;
5050: EXCEPTION
5051: WHEN NO_DATA_FOUND THEN
5052: x_return_status := FND_API.G_RET_STS_ERROR;
5053: RETURN;
5054: END;
5055:
5056: /* Bug : 4639448
5059: BEGIN
5060: IF po_req_lines_sv.val_reqs_qty_received (l_req_header_id,
5061: p_req_line_id ) = FALSE
5062: THEN
5063: x_return_status := FND_API.G_RET_STS_ERROR;
5064: RETURN;
5065: END IF;
5066: EXCEPTION
5067: WHEN NO_DATA_FOUND THEN
5064: RETURN;
5065: END IF;
5066: EXCEPTION
5067: WHEN NO_DATA_FOUND THEN
5068: x_return_status := FND_API.G_RET_STS_ERROR;
5069: RETURN;
5070: END;
5071:
5072: END IS_INTERNAL_LINE_CANCELLABLE;
5088: X_msg_data varchar2(3000);
5089: l_orgid number;
5090: l_api_version CONSTANT NUMBER := 1.0;
5091: BEGIN
5092: x_return_status := fnd_api.g_ret_sts_success;
5093:
5094: IF g_debug_stmt THEN
5095: po_debug.debug_begin(l_log_head);
5096: po_debug.debug_var(l_log_head, l_progress, 'p_api_version', p_api_version);
5097: po_debug.debug_var(l_log_head, l_progress, 'p_req_line_id', p_req_line_id);
5098: po_debug.debug_var(l_log_head, l_progress, 'p_req_header_id', p_req_header_id);
5099: END IF;
5100:
5101: IF NOT FND_API.Compatible_API_Call ( l_api_version ,
5102: p_api_version,
5103: l_api_name ,
5104: G_PKG_NAME )
5105: THEN
5102: p_api_version,
5103: l_api_name ,
5104: G_PKG_NAME )
5105: THEN
5106: RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
5107: END IF;
5108:
5109: IF (p_req_line_id is null and p_req_header_id is null ) then
5110: RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
5106: RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
5107: END IF;
5108:
5109: IF (p_req_line_id is null and p_req_header_id is null ) then
5110: RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
5111: END if;
5112:
5113: IF (p_req_line_id is null and p_req_header_id is not null ) then
5114: l_progress := '001';
5148: IF l_orgid is NOT NULL THEN
5149: PO_MOAC_UTILS_PVT.set_org_context(l_orgid) ; --
5150: END IF;
5151:
5152: IF (x_return_status <> fnd_api.g_ret_sts_success) THEN
5153: RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
5154: ElsE
5155: x_cancellable := por_util_pkg.bool_to_varchar(X_Cancel_Allowed);
5156: END IF;
5149: PO_MOAC_UTILS_PVT.set_org_context(l_orgid) ; --
5150: END IF;
5151:
5152: IF (x_return_status <> fnd_api.g_ret_sts_success) THEN
5153: RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
5154: ElsE
5155: x_cancellable := por_util_pkg.bool_to_varchar(X_Cancel_Allowed);
5156: END IF;
5157:
5204: IF l_orgid is NOT NULL THEN
5205: PO_MOAC_UTILS_PVT.set_org_context(l_orgid) ; --
5206: END IF;
5207:
5208: IF (x_return_status <> fnd_api.g_ret_sts_success) THEN
5209: RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
5210: ElsE
5211: x_cancellable := por_util_pkg.bool_to_varchar(X_Cancel_Allowed);
5212: END IF;
5205: PO_MOAC_UTILS_PVT.set_org_context(l_orgid) ; --
5206: END IF;
5207:
5208: IF (x_return_status <> fnd_api.g_ret_sts_success) THEN
5209: RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
5210: ElsE
5211: x_cancellable := por_util_pkg.bool_to_varchar(X_Cancel_Allowed);
5212: END IF;
5213: end if;
5217: po_debug.debug_end(l_log_head);
5218: end if;
5219: EXCEPTION
5220: WHEN no_data_found THEN
5221: x_return_status := fnd_api.g_ret_sts_error;
5222: RETURN;
5223:
5224: WHEN OTHERS THEN
5225: x_return_status := fnd_api.g_ret_sts_unexp_error;
5221: x_return_status := fnd_api.g_ret_sts_error;
5222: RETURN;
5223:
5224: WHEN OTHERS THEN
5225: x_return_status := fnd_api.g_ret_sts_unexp_error;
5226: IF (g_fnd_debug = 'Y') THEN
5227: IF (fnd_log.g_current_runtime_level <= fnd_log.level_unexpected) THEN
5228: fnd_log.string(fnd_log.level_unexpected, g_module_prefix ||
5229: l_api_name || '.others_exception',
5256: l_api_version CONSTANT NUMBER := 1.0;
5257: l_orgid number;
5258: BEGIN
5259:
5260: IF NOT FND_API.Compatible_API_Call ( l_api_version ,
5261: p_api_version,
5262: l_api_name ,
5263: G_PKG_NAME )
5264: THEN
5261: p_api_version,
5262: l_api_name ,
5263: G_PKG_NAME )
5264: THEN
5265: RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
5266: END IF;
5267:
5268: x_return_status := fnd_api.g_ret_sts_success;
5269: l_update_allowed := FALSE;
5264: THEN
5265: RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
5266: END IF;
5267:
5268: x_return_status := fnd_api.g_ret_sts_success;
5269: l_update_allowed := FALSE;
5270: l_cancel_allowed := FALSE;
5271:
5272: IF g_debug_stmt THEN
5330: END IF;
5331: EXCEPTION
5332:
5333: WHEN no_data_found THEN
5334: x_return_status := fnd_api.g_ret_sts_error;
5335: RETURN;
5336:
5337: WHEN OTHERS THEN
5338: x_return_status := fnd_api.g_ret_sts_unexp_error;
5334: x_return_status := fnd_api.g_ret_sts_error;
5335: RETURN;
5336:
5337: WHEN OTHERS THEN
5338: x_return_status := fnd_api.g_ret_sts_unexp_error;
5339: IF (g_fnd_debug = 'Y') THEN
5340: IF (fnd_log.g_current_runtime_level <= fnd_log.level_unexpected) THEN
5341: fnd_log.string(fnd_log.level_unexpected, g_module_prefix ||
5342: l_api_name || '.others_exception',
5547:
5548: END LOOP;
5549:
5550:
5551: x_return_status := fnd_api.g_ret_sts_success;
5552: EXCEPTION WHEN OTHERS THEN
5553: x_return_status := fnd_api.g_ret_sts_unexp_error;
5554: IF g_fnd_debug = 'Y' THEN
5555: IF (fnd_log.g_current_runtime_level <= fnd_log.level_unexpected) THEN
5549:
5550:
5551: x_return_status := fnd_api.g_ret_sts_success;
5552: EXCEPTION WHEN OTHERS THEN
5553: x_return_status := fnd_api.g_ret_sts_unexp_error;
5554: IF g_fnd_debug = 'Y' THEN
5555: IF (fnd_log.g_current_runtime_level <= fnd_log.level_unexpected) THEN
5556: fnd_log.string(fnd_log.level_unexpected, g_module_prefix ||
5557: l_api_name || '.others_exception', l_progress || ':' || SQLERRM);
5562: /*-------------------------------------------------------------------------------------------------
5563: *This API is called directly from the UI. It will have PLSQL tables as input, which contain change/cancel requests
5564: *1. Validate the requests
5565: *2. If ALL valid, same them into PO_CHANGE_REQUESTS table
5566: *x_return_status = FND_API.G_RET_STS_SUCCESS => Everything is Valid, and records are saved into change table
5567: * FND_API.G_RET_STS_ERROR => Caught Errors, thus no records are saved into change table
5568: * FND_API.G_RET_STS_UNEXP_ERROR => Unexpected Errors Occur in the API
5569: *x_retMsg will indicate details/location of errors.
5570: ---------------------------------------------------------------------------------------------------*/
5563: *This API is called directly from the UI. It will have PLSQL tables as input, which contain change/cancel requests
5564: *1. Validate the requests
5565: *2. If ALL valid, same them into PO_CHANGE_REQUESTS table
5566: *x_return_status = FND_API.G_RET_STS_SUCCESS => Everything is Valid, and records are saved into change table
5567: * FND_API.G_RET_STS_ERROR => Caught Errors, thus no records are saved into change table
5568: * FND_API.G_RET_STS_UNEXP_ERROR => Unexpected Errors Occur in the API
5569: *x_retMsg will indicate details/location of errors.
5570: ---------------------------------------------------------------------------------------------------*/
5571: PROCEDURE save_ireqchange(p_api_version IN NUMBER,
5564: *1. Validate the requests
5565: *2. If ALL valid, same them into PO_CHANGE_REQUESTS table
5566: *x_return_status = FND_API.G_RET_STS_SUCCESS => Everything is Valid, and records are saved into change table
5567: * FND_API.G_RET_STS_ERROR => Caught Errors, thus no records are saved into change table
5568: * FND_API.G_RET_STS_UNEXP_ERROR => Unexpected Errors Occur in the API
5569: *x_retMsg will indicate details/location of errors.
5570: ---------------------------------------------------------------------------------------------------*/
5571: PROCEDURE save_ireqchange(p_api_version IN NUMBER,
5572: x_return_status OUT NOCOPY VARCHAR2,
5580: l_api_name VARCHAR2(50) := 'Save_IReqChange';
5581: l_req_change_table change_tbl_type;
5582: l_dummy NUMBER;
5583: y NUMBER := 1;
5584: l_change_result VARCHAR2(1) := fnd_api.g_ret_sts_success;
5585: l_cancel_result VARCHAR2(1);
5586: l_err_line_id_tbl po_tbl_number;
5587: l_err_line_num_tbl po_tbl_number;
5588: l_err_dist_id_tbl po_tbl_number;
5757: -- these validations are done online
5758: END IF;
5759:
5760: --If ALL changes are valid, we will insert change records, and insert cancel records(if any)
5761: --if(l_change_result = FND_API.G_RET_STS_SUCCESS) then
5762: x_retmsg := 'SRCH004';
5763: SELECT po_chg_request_seq.nextval INTO p_change_request_group_id FROM dual;
5764:
5765:
5776:
5777:
5778:
5779: ---Insert_LineQuantityOrAmount(p_change_request_group_id); not inserting derived record in po_change_request
5780: l_change_result := fnd_api.g_ret_sts_success;
5781: x_retmsg := 'SRCH0061';
5782:
5783: -- Insert_PriceBreakRows(p_change_request_group_id);
5784:
5784:
5785: x_retmsg := 'SRCH0062';
5786:
5787: --Process Cancellation Requests
5788: l_cancel_result := fnd_api.g_ret_sts_success;
5789:
5790: IF(p_cancel_table IS NOT NULL) THEN
5791: save_ireqcancel(1.0, l_cancel_result, p_req_hdr_id, p_cancel_table, l_dummy, x_retmsg, p_change_request_group_id);
5792: END IF;
5791: save_ireqcancel(1.0, l_cancel_result, p_req_hdr_id, p_cancel_table, l_dummy, x_retmsg, p_change_request_group_id);
5792: END IF;
5793:
5794: --x_return_status := l_cancel_result;
5795: x_return_status := fnd_api.g_ret_sts_success;
5796:
5797: IF(l_change_result = fnd_api.g_ret_sts_error) THEN
5798: x_return_status := fnd_api.g_ret_sts_error;
5799: x_retmsg := 'SRCH007';
5793:
5794: --x_return_status := l_cancel_result;
5795: x_return_status := fnd_api.g_ret_sts_success;
5796:
5797: IF(l_change_result = fnd_api.g_ret_sts_error) THEN
5798: x_return_status := fnd_api.g_ret_sts_error;
5799: x_retmsg := 'SRCH007';
5800: ELSE
5801: x_return_status := fnd_api.g_ret_sts_success;
5794: --x_return_status := l_cancel_result;
5795: x_return_status := fnd_api.g_ret_sts_success;
5796:
5797: IF(l_change_result = fnd_api.g_ret_sts_error) THEN
5798: x_return_status := fnd_api.g_ret_sts_error;
5799: x_retmsg := 'SRCH007';
5800: ELSE
5801: x_return_status := fnd_api.g_ret_sts_success;
5802:
5797: IF(l_change_result = fnd_api.g_ret_sts_error) THEN
5798: x_return_status := fnd_api.g_ret_sts_error;
5799: x_retmsg := 'SRCH007';
5800: ELSE
5801: x_return_status := fnd_api.g_ret_sts_success;
5802:
5803: END IF;
5804:
5805: EXCEPTION
5804:
5805: EXCEPTION
5806: WHEN OTHERS THEN
5807: x_retmsg := 'SRCHUNEXP:' || x_retmsg || ':' || SQLERRM;
5808: x_return_status := fnd_api.g_ret_sts_unexp_error;
5809:
5810:
5811:
5812: IF g_fnd_debug = 'Y' THEN
5902: END LOOP;
5903:
5904: CLOSE l_cancels_csr;
5905:
5906: x_return_status := fnd_api.g_ret_sts_success;
5907:
5908: --If all requests are valid, update status to "NEW", and kick off Workflow
5909:
5910: IF(p_errtable.req_line_id.count = 0) THEN
5923: IF (p_origin IS NULL AND l_workflow_needed = 'Y') THEN
5924:
5925: po_reqchangerequestwf_pvt.submit_internal_req_change(
5926: p_api_version => 1.0,
5927: p_commit => fnd_api.g_false,
5928: x_return_status => l_wf_status,
5929: p_req_header_id => l_req_hdr_id,
5930: p_note_to_approver => NULL,
5931: p_initiator => 'REQUESTER');
5934:
5935:
5936:
5937: ELSE
5938: x_return_status := fnd_api.g_ret_sts_error;
5939: END IF;
5940:
5941: EXCEPTION WHEN OTHERS THEN
5942: x_return_status := fnd_api.g_ret_sts_unexp_error ;
5938: x_return_status := fnd_api.g_ret_sts_error;
5939: END IF;
5940:
5941: EXCEPTION WHEN OTHERS THEN
5942: x_return_status := fnd_api.g_ret_sts_unexp_error ;
5943: IF g_fnd_debug = 'Y' THEN
5944: IF (fnd_log.g_current_runtime_level <= fnd_log.level_unexpected) THEN
5945: fnd_log.string(fnd_log.level_unexpected, g_module_prefix ||
5946: l_api_name || '.others_exception', SQLERRM);
5968: x_preparer_name,
5969: x_preparer_display_name);
5970:
5971:
5972: x_return_status := fnd_api.g_ret_sts_success;
5973: END get_preparer_name;
5974:
5975:
5976:
6012: END;
6013:
6014: IF (l_count <> 0 ) THEN
6015:
6016: x_return_status := FND_API.G_RET_STS_ERROR;
6017: IF g_debug_stmt THEN
6018: po_debug.debug_begin(l_log_head);
6019:
6020: po_debug.debug_var(l_log_head, l_progress, 'p_req_line_id', p_req_line_id);
6030: Step 1: Retrive the open receiving quantity INTO l_open_quantity
6031: Step 2 : Retrive the REQ LINE quantity INTO l_quantity
6032: */
6033:
6034: l_return_status := fnd_api.g_ret_sts_success;
6035: l_progress:='001';
6036:
6037: IF g_debug_stmt THEN
6038: po_debug.debug_begin(l_log_head);
6056: FROM po_requisition_lines_all
6057: WHERE REQUISITION_LINE_ID=p_req_line_id;
6058: EXCEPTION
6059: WHEN OTHERS THEN
6060: RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
6061: END;
6062:
6063: IF g_debug_stmt THEN
6064: po_debug.debug_var(l_log_head, l_progress, 'l_quantity', l_quantity);
6095: IF g_debug_stmt THEN
6096: po_debug.debug_var(l_log_head, l_progress, 'l_return_status', l_return_status);
6097: END IF;
6098:
6099: x_return_status := fnd_api.g_ret_sts_success;
6100:
6101: EXCEPTION
6102: WHEN OTHERS THEN
6103: x_return_status:= FND_API.G_RET_STS_ERROR;
6099: x_return_status := fnd_api.g_ret_sts_success;
6100:
6101: EXCEPTION
6102: WHEN OTHERS THEN
6103: x_return_status:= FND_API.G_RET_STS_ERROR;
6104: ROLLBACK TO update_reqcancel_from_so_sp;
6105: END update_reqcancel_from_so;
6106:
6107:
6139: l_count :=0;
6140: END;
6141:
6142: IF (l_count <> 0 ) THEN
6143: x_return_status := FND_API.G_RET_STS_ERROR;
6144: return;
6145: END IF;
6146:
6147: -- have save point
6145: END IF;
6146:
6147: -- have save point
6148: SAVEPOINT update_reqchange_from_so_s;
6149: l_return_status := fnd_api.g_ret_sts_success;
6150:
6151: --algo
6152: -- for the given req line the given attribute needs to be chnaged
6153: -- for quantity .. input is the delta qunatity = new qunatity-old quantity
6191: ROLLBACK TO update_reqchange_from_so_s;
6192: END;
6193:
6194: END IF;
6195: x_return_status := fnd_api.g_ret_sts_success;
6196:
6197: END update_reqchange_from_so;
6198:
6199:
6228: l_budget_account_id NUMBER;
6229: l_gl_date DATE;
6230: l_old_quantity NUMBER;
6231: l_old_tax NUMBER;
6232: l_qty_changed_flag VARCHAR2(1) := fnd_api.g_false;
6233: l_change_exist VARCHAR2(1);
6234: l_cancel_exist VARCHAR2(1);
6235: l_new_quantity NUMBER;
6236: l_new_so_quantity NUMBER;
6388: prla.requisition_line_id = prda.requisition_line_id AND
6389: pcr.document_line_id = prla.requisition_line_id ;
6390:
6391: BEGIN
6392: x_return_status := fnd_api.g_ret_sts_error;
6393: x_retmsg := 'SMRCH000';
6394: x_return_status := fnd_api.g_ret_sts_success;
6395:
6396: --Check if Funds Check is needed
6390:
6391: BEGIN
6392: x_return_status := fnd_api.g_ret_sts_error;
6393: x_retmsg := 'SMRCH000';
6394: x_return_status := fnd_api.g_ret_sts_success;
6395:
6396: --Check if Funds Check is needed
6397: SELECT
6398: nvl(fsp.req_encumbrance_flag, 'N')
6488: p_make_new_copies_flag => po_document_funds_grp.g_parameter_yes,
6489: p_check_only_flag => po_document_funds_grp.g_parameter_yes);
6490:
6491: -- error handling after calling populate_encumbrance_gt
6492: IF (x_return_status <> fnd_api.g_ret_sts_success) THEN
6493: x_retmsg := 'After calling populate_encumbrance_gt';
6494: x_errcode := 'FC_FAIL';
6495: IF g_debug_stmt THEN
6496: po_debug.debug_stmt(l_log_head, x_retmsg,'error exists with funds check');
6584: 'FUNDS CHECK:' || l_fc_result_status ||' PO RETURN CODE:' || l_po_return_code);
6585: END IF;
6586: END IF;
6587:
6588: IF (l_fc_result_status = fnd_api.g_ret_sts_unexp_error) THEN
6589: x_errcode := 'FC_ERROR';
6590: x_return_status := fnd_api.g_ret_sts_error;
6591: RETURN;
6592:
6586: END IF;
6587:
6588: IF (l_fc_result_status = fnd_api.g_ret_sts_unexp_error) THEN
6589: x_errcode := 'FC_ERROR';
6590: x_return_status := fnd_api.g_ret_sts_error;
6591: RETURN;
6592:
6593: ELSE
6594: IF g_debug_stmt THEN
6596: END IF;
6597:
6598:
6599: IF (l_po_return_code = po_document_funds_grp.g_return_success) THEN
6600: x_return_status := fnd_api.g_ret_sts_success;
6601:
6602: ELSE -- there can be warning/error message for other cases
6603:
6604: x_errcode := 'FC_FAIL';
6601:
6602: ELSE -- there can be warning/error message for other cases
6603:
6604: x_errcode := 'FC_FAIL';
6605: x_return_status := fnd_api.g_ret_sts_error;
6606:
6607: -- populate x_errTable (output PLSQL table) with the corresponding
6608: -- funds check error messages.
6609:
6764: x_retmsg := 'SMRCH009';
6765:
6766: po_reqchangerequestwf_pvt.submit_internal_req_change(
6767: p_api_version => 1.0,
6768: p_commit => fnd_api.g_false,
6769: p_req_header_id => l_req_hdr_id,
6770: p_note_to_approver => p_note_to_approver,
6771: p_initiator => p_initiator,
6772: x_return_status => l_wf_status);
6771: p_initiator => p_initiator,
6772: x_return_status => l_wf_status);
6773: ELSE
6774: x_errcode := 'VC_FAIL';
6775: x_return_status := fnd_api.g_ret_sts_error;
6776: END IF;
6777: EXCEPTION WHEN OTHERS THEN
6778: x_return_status := fnd_api.g_ret_sts_unexp_error;
6779: x_retmsg := x_retmsg || ':' || SQLERRM;
6774: x_errcode := 'VC_FAIL';
6775: x_return_status := fnd_api.g_ret_sts_error;
6776: END IF;
6777: EXCEPTION WHEN OTHERS THEN
6778: x_return_status := fnd_api.g_ret_sts_unexp_error;
6779: x_retmsg := x_retmsg || ':' || SQLERRM;
6780: IF g_fnd_debug = 'Y' THEN
6781: IF (fnd_log.g_current_runtime_level <= fnd_log.level_unexpected) THEN
6782: fnd_log.string(fnd_log.level_unexpected, g_module_prefix ||
6851: EXCEPTION
6852: WHEN NO_DATA_FOUND THEN
6853: l_open_quantity := 0;
6854: WHEN OTHERS THEN
6855: RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
6856: END;
6857:
6858: IF ( p_new_quantity < l_open_quantity ) THEN
6859: RAISE FND_API.G_EXC_ERROR;
6855: RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
6856: END;
6857:
6858: IF ( p_new_quantity < l_open_quantity ) THEN
6859: RAISE FND_API.G_EXC_ERROR;
6860: END IF;
6861: END IF;
6862: l_delta_quantity := p_new_quantity-p_old_quantity;
6863:
6926:
6927: END IF;
6928: exception
6929: when others then
6930: X_return_status:=FND_API.G_RET_STS_ERROR;
6931: IF g_debug_stmt THEN
6932: po_debug.debug_stmt(l_log_head, l_progress, ' Validating the changes in exception'|| sqlerrm);
6933: po_debug.debug_var(l_log_head, l_progress, 'l_orgid', l_orgid);
6934: po_debug.debug_var(l_log_head, l_progress, 'L_msg_data', L_msg_data);
6992: END;
6993:
6994: IF (l_count <> 0 ) THEN
6995:
6996: x_return_status := FND_API.G_RET_STS_ERROR;
6997: IF g_debug_stmt THEN
6998: po_debug.debug_begin(l_log_head);
6999:
7000: po_debug.debug_var(l_log_head, l_progress, 'p_req_line_id', p_req_line_id);
7010: Step 1: Retrive the open receiving quantity INTO l_open_quantity
7011: Step 2 : Retrive the REQ LINE quantity INTO l_quantity
7012: */
7013:
7014: l_return_status := fnd_api.g_ret_sts_success;
7015: l_progress:='001';
7016:
7017: IF g_debug_stmt THEN
7018: po_debug.debug_begin(l_log_head);
7037: FROM po_requisition_lines_all
7038: WHERE REQUISITION_LINE_ID=p_req_line_id;
7039: EXCEPTION
7040: WHEN OTHERS THEN
7041: RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
7042: END;
7043:
7044: IF g_debug_stmt THEN
7045: po_debug.debug_var(l_log_head, l_progress, 'l_prim_quantity', l_prim_quantity);
7085: IF g_debug_stmt THEN
7086: po_debug.debug_var(l_log_head, l_progress, 'l_return_status', l_return_status);
7087: END IF;
7088:
7089: x_return_status := fnd_api.g_ret_sts_success;
7090:
7091: EXCEPTION
7092: WHEN OTHERS THEN
7093: x_return_status:= FND_API.G_RET_STS_ERROR;
7089: x_return_status := fnd_api.g_ret_sts_success;
7090:
7091: EXCEPTION
7092: WHEN OTHERS THEN
7093: x_return_status:= FND_API.G_RET_STS_ERROR;
7094: ROLLBACK TO update_reqcancel_from_so_sp;
7095: END update_reqcancel_from_so;
7096:
7097:
7138: l_count :=0;
7139: END;
7140:
7141: IF (l_count <> 0 ) THEN
7142: x_return_status := FND_API.G_RET_STS_ERROR;
7143: return;
7144: END IF;
7145:
7146: -- have save point
7144: END IF;
7145:
7146: -- have save point
7147: SAVEPOINT update_reqchange_from_so_s;
7148: l_return_status := fnd_api.g_ret_sts_success;
7149:
7150: --algo
7151: -- for the given req line the given attribute needs to be chnaged
7152: -- for quantity .. input is the delta qunatity = new qunatity-old quantity
7191: ROLLBACK TO update_reqchange_from_so_s;
7192: END;
7193:
7194: END IF;
7195: x_return_status := fnd_api.g_ret_sts_success;
7196:
7197: END update_reqchange_from_so;
7198:
7199: -- 14227140 changes ends
7226: COMMIT;
7227: END IF;
7228: END LOOP;
7229: CLOSE l_req_lines_csr;
7230: x_return_status := fnd_api.g_ret_sts_success;
7231: EXCEPTION
7232: WHEN OTHERS THEN
7233: x_return_status:= fnd_api.g_ret_sts_error;
7234: END del_req_line_chng_attachments;
7229: CLOSE l_req_lines_csr;
7230: x_return_status := fnd_api.g_ret_sts_success;
7231: EXCEPTION
7232: WHEN OTHERS THEN
7233: x_return_status:= fnd_api.g_ret_sts_error;
7234: END del_req_line_chng_attachments;
7235: -- 15875594 changes ends
7236:
7237: -- 16839471 changes starts
7261: po_debug.debug_var(l_log_head, l_progress, 'p_req_line_id', p_req_line_id);
7262: END IF;
7263: COMMIT;
7264: END IF;
7265: x_return_status := fnd_api.g_ret_sts_success;
7266: EXCEPTION
7267: WHEN OTHERS THEN
7268: x_return_status:= fnd_api.g_ret_sts_error;
7269: IF g_debug_stmt THEN
7264: END IF;
7265: x_return_status := fnd_api.g_ret_sts_success;
7266: EXCEPTION
7267: WHEN OTHERS THEN
7268: x_return_status:= fnd_api.g_ret_sts_error;
7269: IF g_debug_stmt THEN
7270: l_progress :='003';
7271: po_debug.debug_var(l_log_head, l_progress, 'p_req_line_id', p_req_line_id);
7272: po_debug.debug_var(l_log_head, l_progress, 'x_return_status', x_return_status);