修改会计凭证的参考代码2的值。
-------------------------------------------------------------------* TYPE-POOLS tpit. DATA: ls_bseg TYPE bseg, lt_bseg TYPE TABLE OF bseg, lt_buztab TYPE tpit_t_buztab, ls_buztab LIKE LINE OF lt_buztab, lt_fldtab TYPE tpit_t_fname, ls_fldtab LIKE LINE OF lt_fldtab. SELECT * INTO TABLE lt_bseg FROM bseg WHERE bukrs = lv_bukrs AND belnr = lv_belnr AND gjahr = lv_gjahrs. *READ TABLE lt_bseg INTO ls_bseg WITH KEY buzid = 'W'. CHECK sy-subrc = 0. LOOP AT lt_bseg INTO lS_bseg WHERE buzid = 'M'. SELECT * FROM bsis INTO CORRESPONDING FIELDS OF TABLE lt_buztab WHERE bukrs EQ ls_bseg-bukrs AND gjahr EQ ls_bseg-gjahr AND belnr EQ ls_bseg-belnr AND buzei EQ ls_bseg-buzei. IF lt_buztab[] IS INITIAL. SELECT * FROM bsas INTO CORRESPONDING FIELDS OF TABLE lt_buztab WHERE bukrs EQ ls_bseg-bukrs AND gjahr EQ ls_bseg-gjahr AND belnr EQ ls_bseg-belnr AND buzei EQ ls_bseg-buzei. ENDIF. CLEAR ls_bseg. ls_bseg-xref2 = 'YSTEST'. ls_fldtab-fname = 'XREF2'. ls_fldtab-aenkz = 'X'. APPEND ls_fldtab TO lt_fldtab. CALL FUNCTION 'FI_ITEMS_MASS_CHANGE' EXPORTING s_bseg = ls_bseg * IMPORTING * ERRTAB = TABLES it_buztab = lt_buztab it_fldtab = lt_fldtab * EXCEPTIONS * BDC_ERRORS = 1 * OTHERS = 2 . IF sy-subrc <> 0. * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO * WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4. ENDIF. ENDLOOP.