[Home] [Help]
901: d_pos := 10;
902: --Get the Employee Id of the Current User
903: l_agent_id := fnd_global.employee_id;
904: --Get Document Sub type
905: IF(p_doc_type IN (PO_CORE_S.g_doc_type_PO, PO_CORE_S.g_doc_type_PA)) THEN
906: SELECT type_lookup_code
907: INTO l_doc_subtype
908: FROM po_headers_all
909: WHERE po_header_id = p_doc_header_id;
912: IF (PO_LOG.d_stmt) THEN
913: PO_LOG.stmt(d_module,d_pos,'l_agent_id',l_agent_id);
914: PO_LOG.stmt(d_module,d_pos,'l_doc_subtype',l_doc_subtype);
915: END IF;
916: IF (p_doc_level = PO_CORE_S.g_doc_level_HEADER) THEN --header level
917: d_pos := 30;
918: PO_DOCUMENT_CONTROL_PVT.get_header_actions
919: ( p_doc_subtype => l_doc_subtype
920: , p_doc_id => p_doc_level_id
923: , x_displayed_field_tbl => l_displayed_field_tbl
924: , x_return_status => x_return_status
925: , p_mode => l_mode);
926:
927: ELSIF (p_doc_level = PO_CORE_S.g_doc_level_LINE) THEN --line level
928: d_pos := 40;
929: --get the itme_id for the consumption transaction existence check
930: SELECT item_id
931: INTO l_item_id
945: , x_displayed_field_tbl => l_displayed_field_tbl
946: , x_return_status => x_return_status
947: , p_mode => l_mode);
948:
949: ELSIF (p_doc_level = PO_CORE_S.g_doc_level_SHIPMENT) THEN
950: d_pos := 50;
951: --shipment levl
952: PO_DOCUMENT_CONTROL_PVT.get_shipment_actions
953: ( p_doc_type => p_doc_type
966: d_pos := 60;
967:
968: IF (x_return_status = FND_API.g_ret_sts_success)then
969:
970: IF p_doc_level IN (PO_CORE_S.g_doc_level_HEADER, PO_CORE_S.g_doc_level_LINE) THEN
971: -- Checks if there exists a consumption transaction that is in process for
972: -- the passed in transaction source document ID and and item ID.
973: l_cons_trans_exist := PO_INV_THIRD_PARTY_STOCK_MDTR.consumption_trans_exist(
974: p_doc_header_id,
980: END IF;
981: --
982: --Prevent cancel option for shipment if it is the only shipment on the
983: --line that is not cancelled or finally closed.
984: IF(p_doc_level = PO_CORE_S.g_doc_level_SHIPMENT) THEN
985:
986: BEGIN
987: d_pos := 75;
988: SELECT 'N'
1008: END IF;
1009: l_ship_invalid_for_ctrl_actn := 'Y';
1010: END;
1011:
1012: END IF; --p_doc_level = PO_CORE_S.g_doc_level_SHIPMENT
1013: --
1014:
1015: FOR i IN l_valid_actions_tbl.first..l_valid_actions_tbl.last
1016: LOOP
1189:
1190: IF(l_ret_sts <> 'S') THEN
1191: x_return_status := l_ret_sts;
1192: x_return_mssg := l_error_message;
1193: RAISE PO_CORE_S.g_early_return_exc;
1194: END IF;
1195:
1196: END IF;
1197:
1195:
1196: END IF;
1197:
1198: -- Release Funds
1199: l_req_enc_on := PO_CORE_S.is_encumbrance_on(
1200: p_doc_type => PO_CORE_S.g_doc_type_REQUISITION
1201: , p_org_id => NULL
1202: );
1203:
1196: END IF;
1197:
1198: -- Release Funds
1199: l_req_enc_on := PO_CORE_S.is_encumbrance_on(
1200: p_doc_type => PO_CORE_S.g_doc_type_REQUISITION
1201: , p_org_id => NULL
1202: );
1203:
1204: d_position := 30;
1229:
1230: d_position := 50;
1231: x_return_status := fnd_api.G_RET_STS_ERROR;
1232: x_return_mssg := 'do_return not successful';
1233: RAISE PO_CORE_S.g_early_return_exc;
1234:
1235: END IF;
1236:
1237: d_position := 60;
1253:
1254: d_position := 80;
1255: x_return_status := fnd_api.G_RET_STS_ERROR;
1256: x_return_mssg := 'funds do_return partial';
1257: RAISE PO_CORE_S.g_early_return_exc;
1258:
1259: ELSIF (l_enc_ret_code = PO_DOCUMENT_FUNDS_PVT.g_return_FAILURE)
1260: THEN
1261:
1262: d_position := 90;
1263: x_return_status := fnd_api.G_RET_STS_ERROR;
1264: x_return_mssg := 'funds do_return failure';
1265:
1266: RAISE PO_CORE_S.g_early_return_exc;
1267:
1268:
1269: ELSIF (l_enc_ret_code = PO_DOCUMENT_FUNDS_PVT.g_return_FATAL)
1270: THEN
1271:
1272: d_position := 100;
1273: x_return_status := fnd_api.G_RET_STS_ERROR;
1274: x_return_mssg := 'funds do_return fatal';
1275: RAISE PO_CORE_S.g_early_return_exc;
1276:
1277: ELSE
1278:
1279: d_position := 110;
1278:
1279: d_position := 110;
1280: x_return_status := fnd_api.G_RET_STS_ERROR;
1281: x_return_mssg := 'Bad return code from funds do_return';
1282: RAISE PO_CORE_S.g_early_return_exc;
1283:
1284: END IF;
1285:
1286: END IF;
1429: po_log.Proc_end(d_module);
1430: END IF;
1431:
1432: EXCEPTION
1433: WHEN PO_CORE_S.g_early_return_exc THEN
1434:
1435: IF PO_LOG.d_exc THEN
1436: PO_LOG.exc(d_module, d_position, 'Exception occurred ' || x_return_mssg);
1437: END IF;