DATA:lv_msg TYPE string.
LOOP AT gt_out ASSIGNING FIELD-SYMBOL(<fs_out>) WHERE sel = 'X'.
CLEAR:lv_msg.
CALL FUNCTION 'ZFIFM_FBRA_POSTING'
EXPORTING
i_augbl = <fs_out>-augbl
i_bukrs = <fs_out>-bukrs
i_gjahr = <fs_out>-gjahr
i_stgrd = '01'
* I_NO_AUTH = ' '
EXCEPTIONS
not_possible_fbra = 1
not_possible_fb08 = 2
OTHERS = 3.
IF sy-subrc NE 0.
ROLLBACK WORK.
CALL FUNCTION 'MESSAGE_TEXT_BUILD'
EXPORTING
msgid = sy-msgid
msgnr = sy-msgno
msgv1 = sy-msgv1
msgv2 = sy-msgv2
msgv3 = sy-msgv3
msgv4 = sy-msgv4
IMPORTING
message_text_output = lv_msg.
<fs_out>-bapi_mtype = 'E'.
<fs_out>-bapi_msg = lv_msg.
ELSE.
COMMIT WORK.
<fs_out>-bapi_mtype = 'S'.
<fs_out>-bapi_msg = '重置成功'.
DO 10 TIMES.
SELECT SINGLE stblg stjah INTO (<fs_out>-belnr_cz,<fs_out>-gjahr_cz) FROM bkpf
WHERE belnr = <fs_out>-augbl AND bukrs = <fs_out>-bukrs AND gjahr = <fs_out>-gjahr.
IF <fs_out>-belnr_cz IS NOT INITIAL AND <fs_out>-gjahr_cz IS NOT INITIAL.
EXIT.
ELSE.
WAIT UP TO 1 SECONDS.
ENDIF.
ENDDO.
ENDIF.
ENDLOOP.
FUNCTION zfifm_fbra_posting.
*"----------------------------------------------------------------------
*"*"本地接口:
*" IMPORTING
*" VALUE(I_AUGBL) TYPE BKPF-BELNR
*" VALUE(I_BUKRS) TYPE BKPF-BUKRS
*" VALUE(I_GJAHR) TYPE BKPF-GJAHR
*" VALUE(I_STGRD) TYPE BKPF-STGRD
*" VALUE(I_BUDAT) TYPE BKPF-BUDAT OPTIONAL
*" VALUE(I_NO_AUTH) DEFAULT SPACE
*" EXCEPTIONS
*" NOT_POSSIBLE_FBRA
*" NOT_POSSIBLE_FB08
*"----------------------------------------------------------------------
DATA:
stodt LIKE bkpf-budat, "Storno-Buchungsdatum und -Periode
stomo LIKE bkpf-monat. "zur Übergabe an FBRA (RWIN-Aufruf)
CALL FUNCTION 'CALL_FB08' "Simulation des Stornos
EXPORTING
i_bukrs = i_bukrs
i_belnr = i_augbl
i_gjahr = i_gjahr
i_stgrd = i_stgrd
i_xsimu = 'X'
i_no_auth = i_no_auth
IMPORTING
e_budat = stodt
e_monat = stomo
EXCEPTIONS
not_possible = 4.
IF sy-subrc <> 0.
RAISE not_possible_fb08.
ELSE.
CALL FUNCTION 'CALL_FBRA'
EXPORTING
i_bukrs = i_bukrs
i_augbl = i_augbl
i_gjahr = i_gjahr
i_stodt = stodt
i_stomo = stomo
i_no_auth = i_no_auth
EXCEPTIONS
not_possible = 4.
IF sy-subrc <> 0.
RAISE not_possible_fbra.
ELSE.
CALL FUNCTION 'CALL_FB08'
EXPORTING
i_bukrs = i_bukrs
i_belnr = i_augbl
i_gjahr = i_gjahr
i_stgrd = i_stgrd
i_no_auth = i_no_auth
EXCEPTIONS
not_possible = 4.
IF sy-subrc <> 0.
RAISE not_possible_fb08.
ENDIF.
ENDIF.
ENDIF.
ENDFUNCTION.