根据采购订单生成内向交货单调用一次BAPI,却生成了多张凭证
原因:没有对ordcombind订单组合字段赋值
PS:因为代码是直接从公司系统上面拷下来,放到另外一个系统用,所以没有进去看BAPI参数,后在BING找到原因(原系统没问题)
LOOP AT lt_data ASSIGNING <fs_data> WHERE zzshdh EQ <ls_call>-zzshdh
AND lfdat EQ <ls_call>-lfdat
AND werks EQ <ls_call>-werks
AND lgfsb EQ <ls_call>-lgfsb
AND lifnr EQ <ls_call>-lifnr
AND zzinvno EQ <ls_call>-zzinvno
AND itm_expvz EQ <ls_call>-itm_expvz.
ls_inbd-document_numb = <fs_data>-ebeln.
ls_inbd-document_item = <fs_data>-ebelp.
ls_inbd-plant = <fs_data>-werks.
ls_inbd-stge_loc = <fs_data>-lgfsb.
ls_inbd-quantity_sales_uom = <fs_data>-lfimg.
SELECT SINGLE meins
FROM ekpo
INTO ls_inbd-base_uom
WHERE ebeln EQ <fs_data>-ebeln
AND ebelp EQ <fs_data>-ebelp.
CLEAR lv_matnr18.
lv_matnr18 = <fs_data>-matnr.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
input = lv_matnr18
IMPORTING
output = lv_matnr18.
ls_inbd-material = lv_matnr18.
ls_inbd-delivery_date = <fs_data>-lfdat.
ls_inbd-document_type = 'B'. " B - PO , L - DN , A - SALES ORDER
ls_inbd-ordcombind = 'X'.
APPEND ls_inbd TO lt_inbd.
ENDLOOP.
* 创建交货单
CALL FUNCTION 'BAPI_DELIVERYPROCESSING_EXEC'
TABLES
request = lt_inbd
createditems = lt_createditems
return = lt_return.