Oracle EBS Interface/API(10)-The sales order line is cancelled.

前端之家收集整理的这篇文章主要介绍了Oracle EBS Interface/API(10)-The sales order line is cancelled.前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
系统版本 :
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;

猜你在找的Oracle相关文章