系統版本 :
RDBMS : 9.2.0.6.0
Oracle 應用產品 : 11.5.10.2
由於失效成品編碼時,系統提示如下:
該提示有二種情況:
1.檢查發現該成品的銷售訂單行狀態一直是”等待發運“。汗。。。。。。。。。。。有三年以上的銷售訂單沒有發運一直不取消。難怪不能失效。通過如下SQL
Select OEH.ORDER_NUMBER, OTT.name, OEH.CREATION_DATE, CUST.CUSTOMER_NAME, OEL.LINE_NUMBER || '.' || OEL.SHIPMENT_NUMBER LINE, MSI.SEGMENT1, MSI.DESCRIPTION, OEL.ORDERED_QUANTITY, OEL.LINE_ID From OE_ORDER_HEADERS_ALL OEH, OE_ORDER_LINES_ALL OEL, MTL_SYSTEM_ITEMS_B MSI, AR_CUSTOMERS CUST, OE_TRANSACTION_TYPES_V OTT Where OEH.Header_Id = OEL.HEADER_ID And OEL.SHIP_FROM_ORG_ID = MSI.ORGANIZATION_ID And OEL.INVENTORY_ITEM_ID = MSI.INVENTORY_ITEM_ID And OEH.SOLD_TO_ORG_ID = CUST.CUSTOMER_ID And OEH.ORDER_TYPE_ID = OTT.TRANSACTION_TYPE_ID AnD OEH.Ordered_Date < To_DatE('2018-01-01', 'YYYY-MM-DD') And OEH.FLOW_STATUS_CODE = 'BOOKED' And OEL.FLOW_STATUS_CODE = 'AWAITING_SHIPPING' And Not Exists (Select 1 From WSH_DELIVERY_DETAILS WDD Where WDD.SOURCE_LINE_ID = OEL.LINE_ID And WDD.SOURCE_HEADER_ID = OEL.HEADER_ID And WDD.RELEASED_STATUS = 'Y') Order By OEH.CREATION_DATE, OEH.SOLD_TO_ORG_ID;
2.雖然該成品編碼的銷售訂單行全部關閉狀態,但是由於銷售題頭流程問題導致銷售訂單題頭狀態未關閉,同樣也會提示。
檢查發現2018年以前有4K多行”等待發運“的訂單行,如此多銷售訂單行沒有取消,現在手工取消不現實呀。只能用系統的API來取消。查看系統標準的Form原始碼,主要調用API包如:oe_oe_form_cancel_line.Process_cancel_quantity
Declare l_return_status Varchar2(30) := null; l_msg_count number := 0; l_msg_data varchar2(2000) := null; l_mc_err_handling_flag NUMBER := Null; ---取消類型:F表示完全取消,P表示部分取消。當為部分取消時,取消數量不可為空 l_cancel_type varchar2(2) := 'F'; --l_cancelation_reason_code varchar2(30) := name_in('audit_qty.reasons_code'); l_LineCount Number := 1; --取消記錄條數 --取消訂單行OE_ORDER_LINES_ALL.Line_Id 使用逗號隔分開,LINE_ID可以是來自不同銷售訂單 l_LineList varchar2(32000) := '320564,12432324'; --取消數量 l_cancel_quantity Number; --取消備忘 l_Comments Varchar2(200) := '20180414批量取消操作'; --取原因代碼 l_ReasonsCode Number := 1; l_error_count number; l_UserId Number := 1110; l_RespId Number := 50247; l_RespApplId Number := 660; l_msg_index_out NUMBER(10);Begin --初始化 fnd_global.apps_initialize(user_id => l_UserId, resp_id => 50247, resp_appl_id => l_RespApplId); --調用API oe_oe_form_cancel_line.Process_cancel_quantity(p_num_of_records => l_LineCount, --oe_cancel_lines.g_line_count, p_record_ids => l_LineList, --oe_cancel_lines.g_line_list, p_cancel_to_quantity => l_cancel_quantity, p_cancellation_comments => l_Comments, --Name_in('audit_qty.comments'), p_reason_code => l_ReasonsCode, --l_cancelation_reason_code, p_cancellation_type => l_cancel_type, p_mc_err_handling_flag => l_mc_err_handling_flag, x_msg_count => l_msg_count, x_msg_data => l_msg_data, x_return_status => l_return_status, x_error_count => l_error_count); if l_return_status <> 'S' then FOR i IN 1 .. l_msg_count LOOP Oe_Msg_Pub.get(p_msg_index => i, p_encoded => Fnd_Api.G_FALSE, p_data => l_msg_data, p_msg_index_out => l_msg_index_out); DBMS_OUTPUT.put_line('message is:' || l_msg_data || ',' || 'message index is:' || l_msg_index_out); END LOOP; Rollback; else commit; end if;End;