沖銷已過賬外向交貨單BAPI:WS_REVE…
阿新 • • 發佈:2018-12-30
前臺操作:
VL09
填寫裝運點 和交貨單
*&---------------------------------------------------------------------*
*& Report YLM_TEST007
*&
*&---------------------------------------------------------------------*
*&沖銷已過賬外向交貨單
*&---------------------------------------------------------------------*
TABLES: MKPF, IMKPF, EMKPF, LIKP.
DATA: LT_MESG TYPE TABLE OF MESG WITH HEADER LINE.
SELECTION-SCREEN : BEGIN OF BLOCK BLK WITH FRAME TITLE TEXT-001.
PARAMETERS : P_VBELN LIKE LIKP-VBELN OBLIGATORY DEFAULT '8000002259'. "外向交貨單
SELECTION-SCREEN : END OF BLOCK BLK.
START-OF-SELECTION.
"沖銷外向交貨單過賬
PERFORM REVERSE_GOODSISSUE.
*&---------------------------------------------------------------------*
*& Form reverse_goodsissue
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM REVERSE_GOODSISSUE .
DATA : LV_VBTYP LIKE LIKP-VBTYP.
SELECT SINGLE VBTYP "SD 憑證類別
FROM LIKP
INTO LV_VBTYP
WHERE VBELN = P_VBELN.
CALL FUNCTION 'WS_REVERSE_GOODS_ISSUE'
EXPORTING
I_VBELN = P_VBELN
I_BUDAT = SY-DATUM
I_TCODE = 'VL09'
I_VBTYP = LV_VBTYP "SD 憑證類別 * I_POSNR = 10
TABLES
T_MESG = LT_MESG
EXCEPTIONS
ERROR_REVERSE_GOODS_ISSUE = 1
OTHERS = 2.
IF SY-SUBRC = 0.
ENDIF.
READ TABLE LT_MESG WITH KEY MSGTY = 'E'.
IF SY-SUBRC = 0.
ENDIF.
具體其他bapi的引數欄位可以看描述,自己測試
點選定義日期,將輸入的實際過賬日期輸入到本地日期中。點勾
然後點選沖銷
點選綠色勾,沖銷成功或錯誤,則均會出現如果對話方塊。
*&---------------------------------------------------------------------*
*& Report YLM_TEST007
*&
*&---------------------------------------------------------------------*
*&沖銷已過賬外向交貨單
*&---------------------------------------------------------------------*
TABLES: MKPF, IMKPF, EMKPF, LIKP.
DATA: LT_MESG TYPE TABLE OF MESG WITH HEADER LINE.
SELECTION-SCREEN : BEGIN OF BLOCK BLK WITH FRAME TITLE TEXT-001.
PARAMETERS : P_VBELN LIKE LIKP-VBELN OBLIGATORY DEFAULT '8000002259'. "外向交貨單
SELECTION-SCREEN : END OF BLOCK BLK.
START-OF-SELECTION.
"沖銷外向交貨單過賬
PERFORM REVERSE_GOODSISSUE.
*&---------------------------------------------------------------------*
*& Form reverse_goodsissue
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM REVERSE_GOODSISSUE .
DATA : LV_VBTYP LIKE LIKP-VBTYP.
SELECT SINGLE VBTYP "SD 憑證類別
FROM LIKP
INTO LV_VBTYP
WHERE VBELN = P_VBELN.
CALL FUNCTION 'WS_REVERSE_GOODS_ISSUE'
EXPORTING
I_VBELN = P_VBELN
I_BUDAT = SY-DATUM
I_TCODE = 'VL09'
I_VBTYP = LV_VBTYP "SD 憑證類別 * I_POSNR = 10
TABLES
T_MESG = LT_MESG
EXCEPTIONS
ERROR_REVERSE_GOODS_ISSUE = 1
OTHERS = 2.
IF SY-SUBRC = 0.
ENDIF.
READ TABLE LT_MESG WITH KEY MSGTY = 'E'.
IF SY-SUBRC = 0.
ENDIF.
具體其他bapi的引數欄位可以看描述,自己測試