如何使用BAPI创建内部交货单

2021-10-23 16:32发布


          点击此处--->   EasySAP.com 群内免费提供SAP练习系统(在群公告中)

加入QQ群:457200227(SAP S4 HANA技术交流) 群内免费提供SAP练习系统(在群公告中)

  DATA LS_BBP_INBD_L        TYPE BBP_INBD_L.
  DATA LT_BBP_INBD_D        TYPE TABLE OF BBP_INBD_D.
  DATA LT_BAPIRETURN        TYPE TABLE OF BAPIRETURN.
  DATA LS_BBP_INBD_D        TYPE BBP_INBD_D. 

  DATA   lv_vbeln  type vbeln.

  LOOP AT PT_LIPS ASSIGNING .

    LS_INB_DELIVERY_DETAIL-DELIV_ITEM -POSNR."必须要有!!
  LS_INB_DELIVERY_DETAIL-PO_NUMBER = -VGBEL.
    LS_INB_DELIVERY_DETAIL-PO_ITEM    -VGPOS.
    LS_INB_DELIVERY_DETAIL-MATERIAL   -MATNR.
    LS_INB_DELIVERY_DETAIL-DELIV_QTY  -LFIMG.
    LS_INB_DELIVERY_DETAIL-UNIT       -MEINS.
    APPEND LS_INB_DELIVERY_DETAIL TO ET_INB_DELIVERY_DETAIL.
    CLEAR  LS_INB_DELIVERY_DETAIL.

  ENDLOOP.

        LS_BBP_INBD_L-DELIV_DATE SY-DATUM.

          CALL FUNCTION 'BBP_INB_DELIVERY_CREATE'
            EXPORTING
              IS_INB_DELIVERY_HEADER LS_BBP_INBD_L
            IMPORTING
              EF_DELIVERY            lv_vbeln
            TABLES
              IT_INB_DELIVERY_DETAIL LT_BBP_INBD_D
              RETURN                 LT_BAPIRETURN.


虽然能创建内向交货单,但是内部交货单会没有物料号!


BUG原因如下:

image.png

可以做隐身增强

调整代码为  

IF t_kom-ematn is not initial.

t_kom-matnr t_kom-ematn.

endif.

物料号即可带出。


赞赏支持