BAPI----冲销外向交货

*&---------------------------------------------------------------------*
*& Report  Z_MYTEST_REVERSE_GODDSISSUE
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*

REPORT  Z_MYTEST_REVERSE_GODDSISSUE.
DATA: BEGIN OF T_TAB OCCURS 0,
      VBELN LIKE LIKP-VBELN,
      VBTYP LIKE LIKP-VBTYP,
     END OF T_TAB.

DATA: T_MESG    LIKE MESG OCCURS 0 WITH HEADER LINE,
      T_BUDAT     LIKE SY-DATLO.

SELECT VBELN  VBTYP
  INTO CORRESPONDING FIELDS OF TABLE T_TAB
  FROM LIKP
  WHERE LIKP~VBELN = '0080015532'.

LOOP AT T_TAB.
  CALL FUNCTION 'WS_REVERSE_GOODS_ISSUE'
    EXPORTING
      I_VBELN                         = T_TAB-VBELN
      I_BUDAT                         = SY-DATUM
*   I_COUNT                         =
*   I_MBLNR                         =
     I_TCODE                         = 'VL09'
      I_VBTYP                         = T_TAB-VBTYP
*   I_MBLPO                         =
*   I_MJAHR                         =
*   I_POSNR                         =
*   I_SIMULATE                      = ' '
*   I_SPE_BUDAT_UHR                 =
*   I_SPE_BUDAT_ZONE                =
*   I_SPE_MDNUM_EWM                 =
*   I_SPE_LOGSYS                    =
*   I_SPE_CONFIRM_CENTRAL           = ' '
* IMPORTING
*   ES_EMKPF                        =
    TABLES
      T_MESG                          = T_MESG
   EXCEPTIONS
     ERROR_REVERSE_GOODS_ISSUE       = 1
     OTHERS                          = 2
            .
  IF SY-SUBRC = 0.
    COMMIT WORK AND WAIT.
    MESSAGE '冲销成功!' TYPE 'S'.
  ELSE.
    MESSAGE '没有过账,无法冲销!' TYPE 'S'.
  ENDIF.
ENDLOOP.

你可能感兴趣的:(function,header,report,table)