SAP ABAP 发货过账WS_DELIVERY_UPDATE
DATA:ls_vbkok LIKE vbkok,
lv_error TYPE xfeld,
it_prott LIKE prott OCCURS 0 WITH HEADER LINE, "Return Message
it_vbpok LIKE vbpok OCCURS 0 WITH HEADER LINE. "Delivery items
DATA:lv_wadat TYPE likp-wadat_ist.
SELECT SINGLE wadat_ist "dn的移动日期
FROM likp
INTO lv_wadat
WHERE vbeln = "交货号
ls_vbkok-vbeln_vl = "交货号
ls_vbkok-wabuc = 'X'.
IF lv_wadat+0(6) <> sy-datum+0(6)."移动日期不等于系统当前年月 属于跨月就用接口日期
lv_wadat = "接口日期
ENDIF.
ls_vbkok-wadat_ist = lv_wadat.
CALL FUNCTION 'WS_DELIVERY_UPDATE'
EXPORTING
vbkok_wa = ls_vbkok
update_picking = 'X'
commit = 'X'
delivery = "交货号
IMPORTING
ef_error_in_goods_issue_0 = lv_error
TABLES
prot = it_prott
vbpok_tab = it_vbpok
EXCEPTIONS
error_message = 1
OTHERS = 2.
IF sy-subrc <> 0 OR lv_error = 'X'. "过账失败
CALL FUNCTION 'BAPI_TRANSACTION_ROLLBACK'.
ELSE."过账成功
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
wait = abap_true.
ENDIF.