以下为正文

销售订单修改BAPI:BAPI_SALESORDER_CHANGE 
 
*&---------------------------------------------------------------------* 
*&      Form  rechazar 
*&---------------------------------------------------------------------* 
FORM rechazar . 
 DATA: i_hdr  TYPE bapisdh1, 
       i_hdrx TYPE bapisdh1x, 
       i_ret  TYPE bapiret2 OCCURS 0 WITH HEADER LINE, 
       i_itm  TYPE bapisditm OCCURS 0 WITH HEADER LINE, 
       i_itmx TYPE bapisditmx  OCCURS 0 WITH HEADER LINE. 
 
 
 REFRESH: i_itm, i_itmx, i_ret. 
 CLEAR: i_hdr, i_hdrx. 
 i_hdr-sd_doc_cat  = 'C'. 
 i_hdrx-updateflag = 'U'. 
 
 
 SELECT * FROM vbap 
  WHERE vbeln = i_listado-vbeln. 
 
 
   i_itm-itm_number = vbap-posnr. 
   i_itm-reason_rej = 'Z1'. 
 
 
   i_itmx-updateflag = 'U'. 
   i_itmx-itm_number = vbap-posnr. 
   i_itmx-reason_rej = 'X'. 
 
 
   APPEND i_itm. 
   APPEND i_itmx. 
 ENDSELECT. 
 
 
 CALL FUNCTION 'BAPI_SALESORDER_CHANGE' 
   EXPORTING 
     salesdocument     = i_listado-vbeln 
     order_header_in   = i_hdr 
     order_header_inx  = i_hdrx 
     behave_when_error = 'P' 
   TABLES 
     return            = i_ret 
     order_item_in     = i_itm 
     order_item_inx    = i_itmx. 
 
 
ENDFORM.                    " rechazar

评论关闭
IT干货网

微信公众号号:IT虾米 (左侧二维码扫一扫)欢迎添加!