首页 > 其他分享 >FBRA重置并冲销BAPI

FBRA重置并冲销BAPI

时间:2022-09-24 23:00:44浏览次数:47  
标签:sy gjahr budat req 重置 BAPI possible FBRA bukrs

      CALL FUNCTION 'ZJ_1B_FBRA_POSTING_AUFRUFEN'
        EXPORTING
          i_augbl           = is_req-belnr
          i_bukrs           = is_req-bukrs
          i_gjahr           = is_req-gjahr
          i_stgrd           = is_req-stgrd
          i_budat           = is_req-budat
*         I_NO_AUTH         = ' '
        EXCEPTIONS
          not_possible_fbra = 1
          not_possible_fb08 = 2
          OTHERS            = 3.
      IF sy-subrc NE 0.
* Implement suitable error handling here

        ROLLBACK WORK.

        MESSAGE ID sy-msgid
        TYPE sy-msgty
        NUMBER sy-msgno
        WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4
        INTO  es_rsp-message.
        es_rsp-type = 'E'.



      ELSE.
        COMMIT WORK.

        es_rsp-type = 'S'.

        es_rsp-message = TEXT-001.

        "add by wangy
        WAIT UP TO '02' SECONDS.
        SELECT SINGLE stblg INTO es_rsp-stblg FROM bkpf
          WHERE belnr = is_req-belnr AND bukrs = is_req-bukrs AND gjahr = is_req-gjahr.
        "end

      ENDIF.


前面封装的ZJ_1B_FBRA_POSTING_AUFRUFEN 如下:
FUNCTION zj_1b_fbra_posting_aufrufen.
*"----------------------------------------------------------------------
*"*"本地接口:
*"  IMPORTING
*"     VALUE(I_AUGBL) LIKE  BKPF-BELNR
*"     VALUE(I_BUKRS) LIKE  BKPF-BUKRS
*"     VALUE(I_GJAHR) LIKE  BKPF-GJAHR
*"     VALUE(I_STGRD) LIKE  BKPF-STGRD
*"     VALUE(I_BUDAT) LIKE  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.

      IF i_stgrd EQ '03'.
        SELECT SINGLE budat
          INTO i_budat
            FROM bkpf
          WHERE bukrs EQ i_bukrs
          AND belnr EQ i_augbl
          AND gjahr EQ i_gjahr.
      ENDIF.

      CALL FUNCTION 'CALL_FB08'
        EXPORTING
          i_bukrs      = i_bukrs
          i_belnr      = i_augbl
          i_gjahr      = i_gjahr
          i_stgrd      = i_stgrd
          i_budat      = i_budat
          i_no_auth    = i_no_auth
        EXCEPTIONS
          not_possible = 4.
      IF sy-subrc <> 0.
        RAISE not_possible_fb08.
      ENDIF.
    ENDIF.
  ENDIF.




ENDFUNCTION.
View Code

 

 

标签:sy,gjahr,budat,req,重置,BAPI,possible,FBRA,bukrs
From: https://www.cnblogs.com/yy-abaper/p/16726919.html

相关文章