SAP BDC 冲销会计凭证

2021-11-10 22:46发布


          点击此处--->   EasySAP.com 群内免费提供SAP练习系统(在群公告中)

加入QQ群:457200227(SAP S4 HANA技术交流) 群内免费提供SAP练习系统(在群公告中)

SAP BDC 冲销会计凭证


*&---------------------------------------------------------------------*
*& Report  YTEST_FICO_030
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*

REPORT  YTEST_FICO_030.

 TABLES: bkpf.

 DATA: ls_co_head  TYPE bapidochdrr.
 DATA: wa_opt      TYPE ctu_params.
 DATA: lt_bdcmsg   TYPE TABLE OF bdcmsgcoll WITH HEADER LINE,
       lv_msg      TYPE bapiret2-message.
 DATA: bdcdata LIKE bdcdata    OCCURS 0 WITH HEADER LINE.

 PARAMETERS:belnr  TYPE bkpf-belnr,
            bukrs  TYPE bkpf-bukrs,
            gjahr  TYPE bkpf-gjahr,
            budat  TYPE bkpf-budat.


*      "冲销 凭证
 CLEAR wa_opt.
 wa_opt-dismode = 'N'.
 wa_opt-defsize = 'X'.
 wa_opt-updmode = 'L'.
 wa_opt-nobinpt = 'X'.
 wa_opt-nobiend = 'X'.
 REFRESH bdcdata.
 PERFORM bdc_dynpro USING 'SAPMF05A'   '0105'.
 PERFORM bdc_field USING 'BDC_OKCODE'  '=BU'.
 PERFORM bdc_field USING 'RF05A-BELNS' belnr.
 PERFORM bdc_field USING 'BKPF-BUKRS'  bukrs.
 PERFORM bdc_field USING 'RF05A-GJAHS' gjahr.
 PERFORM bdc_field USING 'BSIS-BUDAT'  budat.
 PERFORM bdc_field USING 'UF05A-STGRD' '02'.
 REFRESH lt_bdcmsg.
 CALL TRANSACTION 'FB08'  USING bdcdata
                          OPTIONS FROM wa_opt
                          MESSAGES INTO lt_bdcmsg.

 READ TABLE lt_bdcmsg WITH KEY msgid = 'F5' msgnr = '312'.
 IF sy-subrc EQ 0.
   ... ...
   "success
 ENDIF.

*&---------------------------------------------------------------------*
*&      Form  BDC_DYNPRO
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*      -->PROGRAM    text
*      -->DYNPRO     text
*----------------------------------------------------------------------*
FORM bdc_dynpro USING program dynpro.
 CLEAR bdcdata.
 bdcdata-program  = program.
 bdcdata-dynpro   = dynpro.
 bdcdata-dynbegin = 'X'.
 APPEND bdcdata.
ENDFORM.                    "BDC_DYNPRO

*&---------------------------------------------------------------------*
*&      Form  BDC_FIELD
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*      -->FNAM       text
*      -->FVAL       text
*----------------------------------------------------------------------*
FORM bdc_field USING fnam fval.
*  IF fval <> nodata_character.
 CLEAR bdcdata.
 bdcdata-fnam = fnam.
 bdcdata-fval = fval.
 APPEND bdcdata.
*  ENDIF.
ENDFORM.                    "BDC_FIELD







赞赏支持