记账程序注意凭证记账与更新自建表同事提交

** 完成后先不提交 或者 回滚,记录下消息,
CALL FUCNTION 'BAPI_ACC_DOCUMENT_POST'  <br /><br /><br />** 继续自建表更新逻辑:<br />UPDATE zfit640_s SET status1 = gs_zfit640_s-status1
                         bukrs1  = gs_zfit640_s-bukrs1
                         belnr1  = gs_zfit640_s-belnr1
                         budat1  = gs_zfit640_s-budat1
                         message1 = gs_zfit640_s-message1
                         zdate    = gs_zfit640_s-zdate "ADD BY YANGC AT 20171115 FOR 肖克
                         ztime    = gs_zfit640_s-ztime
                 WHERE oms_item  = gs_zfit640_s-oms_item
                   AND servercode = gs_zfit640_s-servercode.
    IF  sy-subrc EQ .
      CLEAR gs_return.
      CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
        EXPORTING
          wait   = 'X'
        IMPORTING
          return = gs_return.
      IF gs_return-type = 'E'.
        CALL FUNCTION 'BAPI_TRANSACTION_ROLLBACK'.
        CLEAR: gs_zfit640_s-bukrs1,gs_zfit640_s-budat1,gs_zfit640_s-belnr1.
        gs_zfit640_s-status1    = 'E'.
        CONCATENATE gs_zfit640_s-message1 '提交数据失败' INTO gs_zfit640_s-message1 SEPARATED BY ' '.
      ENDIF.

    ELSE.
      ROLLBACK WORK.
      CLEAR: gs_zfit640_s-bukrs1,gs_zfit640_s-budat1,gs_zfit640_s-belnr1.
      gs_zfit640_s-status1    = 'E'.
      CONCATENATE gs_zfit640_s-message1 '过账状态数据更新到ZFIT1025表失败' INTO gs_zfit640_s-message1 SEPARATED BY ' '.
    ENDIF.

相关推荐