DATA:gv_number TYPE bapi_incinv_fld-inv_doc_no,
gv_year TYPE bapi_incinv_fld-fisc_year,
gv_number1 TYPE bapi_incinv_fld-inv_doc_no,
gv_year1 TYPE bapi_incinv_fld-fisc_year,
gt_return TYPE TABLE OF bapiret2,
gs_return TYPE bapiret2,
zmsg type char255 .
CALL FUNCTION 'BAPI_INCOMINGINVOICE_CANCEL'
EXPORTING
invoicedocnumber = gv_number "凭证号
fiscalyear = gv_year "年度
reasonreversal = '03'
postingdate = sy-datum
IMPORTING
invoicedocnumber_reversal = gv_number1
fiscalyear_reversal = gv_year1
TABLES
return = gt_return.
IF gv_number1 IS NOT INITIAL .
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
wait = 'X'.
ELSE .
CALL FUNCTION 'BAPI_TRANSACTION_ROLLBACK'.
LOOP AT gt_return INTO gs_return WHERE type = 'E' .
IF zmsg IS INITIAL .
zmsg = gs_return-message .
ELSE .
zmsg = gs_return-message && '/' && zmsg .
ENDIF .
ENDLOOP .
ENDIF .
matinal:SAP ABAP MR8M冲销发票BAPI
最新推荐文章于 2024-08-20 08:57:54 发布