交货时如何去掉批号?

How to remove batch number on delivery?

我需要删除交货项目上的批号 (LIPS-CHARG) 并尝试 BAPI_OUTB_DELIVERY_CHANGE 没有成功。 我可以使用此 BAPI 正确更改交货数量 (LIPS-LFIMG) 并使用 [=20= 更改提货编号 (LIPS-PKIMG) ]WS_DELIVERY_UPDATE_2,但不能去掉批号

有人已经删除了批号吗?不需要使用这个BAPI,可以是另一个。我只需要以任何方式删除批次。

以下代码用于更改交货数量和领料数量。某个时刻,我把领料数量改成零,此时我需要去掉批号。

"&**** Begin structures BAPI_OUTB_DELIVERY_CHANGE *******
ls_header_data-deliv_numb     = p_vbeln.
ls_header_control-deliv_numb  = p_vbeln.
  
APPEND INITIAL LINE TO lt_item_data ASSIGNING FIELD-SYMBOL(<ls_item_data>).

<ls_item_data>-deliv_numb       = p_vbeln.
<ls_item_data>-deliv_item       = lv_posnn.
<ls_item_data>-material         = <ls_alv>-matnr. 
<ls_item_data>-batch            = <ls_alv>-charg. 
<ls_item_data>-hieraritem       = <ls_lips>-posnr.
<ls_item_data>-usehieritm       = '1'. 
<ls_item_data>-dlv_qty          = lv_delivery_qtd. "my delivery quantity
<ls_item_data>-dlv_qty_imunit   = lv_delivery_qtd. "my delivery quantity
<ls_item_data>-fact_unit_nom    = <ls_lips>-umvkz.
<ls_item_data>-fact_unit_denom  = <ls_lips>-umvkn.
<ls_item_data>-sales_unit       = <ls_lips>-vrkme.

APPEND INITIAL LINE TO lt_item_control ASSIGNING FIELD-SYMBOL(<ls_item_control>).

<ls_item_control>-deliv_numb = p_vbeln.
<ls_item_control>-deliv_item = lv_posnn.
<ls_item_control>-chg_delqty = 'X'.
"&**** End structures BAPI_OUTB_DELIVERY_CHANGE *******

CALL FUNCTION 'BAPI_OUTB_DELIVERY_CHANGE'
EXPORTING
  header_data    = ls_header_data
  header_control = ls_header_control
  delivery       = p_vbeln
TABLES
  item_data      = lt_item_data
  item_control   = lt_item_control
  return         = lt_return.
 
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'. 

  
"&**** Begin structures WS_DELIVERY_UPDATE_2 *******
APPEND INITIAL LINE TO lt_vbpok ASSIGNING FIELD-SYMBOL(<ls_vbpok>).
<ls_vbpok>-vbeln_vl = <ls_lips>-vbeln.                
<ls_vbpok>-posnr_vl = <ls_lips>-posnr.                
<ls_vbpok>-vbeln    = <ls_lips>-vgbel.                
<ls_vbpok>-posnn    = <ls_lips>-vgpos.                
<ls_vbpok>-matnr    = <ls_lips>-matnr.
<ls_vbpok>-werks    = <ls_lips>-werks.
<ls_vbpok>-umvkz    = <ls_lips>-umvkz.                
<ls_vbpok>-umvkn    = <ls_lips>-umvkn.                
<ls_vbpok>-gewei    = <ls_lips>-gewei.
<ls_vbpok>-charg    = <ls_alv>-charg.
<ls_vbpok>-pikmg    = lv_picking_qtd.   "my picking quantity

ls_vbkok-vbeln_vl = <ls_lips>-vbeln.               
ls_vbkok-vbtyp_vl = 'J'.                           
ls_vbkok-komue    = 'X'.                           
ls_vbkok-gewei    = <ls_lips>-gewei.
ls_vbkok-anzpk    = lv_anzpk.
ls_vbkok-kzapk    = 'X'.
"&**** End structures WS_DELIVERY_UPDATE_2 *******

CALL FUNCTION 'WS_DELIVERY_UPDATE_2'
EXPORTING
    vbkok_wa                  = ls_vbkok
    delivery                  = p_vbeln
    synchron                  = abap_true
    update_picking            = abap_true
    nicht_sperren_1           = abap_true
    commit                    = abap_false
    if_error_messages_send    = abap_false
IMPORTING
    ef_error_any              = ls_error-any
    ef_error_in_item_deletion = ls_error-in_item_deletion
    ef_error_in_pod_update    = ls_error-in_pod_update
    ef_error_in_interface     = ls_error-in_interface
    ef_error_in_goods_issue   = ls_error-in_goods_issue
    ef_error_in_final_check   = ls_error-in_final_check
    ef_error_partner_update   = ls_error-partner_update
    ef_error_sernr_update     = ls_error-sernr_update
TABLES
    vbpok_tab                 = lt_vbpok.
    
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.

我发现了我的错误! 当我们需要删除批号时,我们不需要在 ITEM_DATA-DELIV_ITEM.

上发送值

在我的代码中,我在 ITEM_DATA-DELIV_ITEM 上发送了“90000001”,在 ITEM_DATA-USEHIERITM 上发送了“00010”,但为了工作,我只发送了 ITEM_DATA-USEHIERITM 并且批号已被正确删除.

谢谢大家!