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

故事扮演 提交于 2020-03-21 08:16:02

 

** 完成后先不提交 或者 回滚,记录下消息,
 CALL FUCNTION 'BAPI_ACC_DOCUMENT_POST'  ** 继续自建表更新逻辑:  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 
                         ztime    = gs_zfit640_s-ztime
                 WHERE oms_item  = gs_zfit640_s-oms_item
                   AND servercode = gs_zfit640_s-servercode.
    IF  sy-subrc EQ 0.
      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.

 

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!