SAP LUW 实现提交数据库更新
阅读原文时间:2023年07月08日阅读:1

CALL FUNCTION 'TRANSACTION_BEGIN'
IMPORTING
transaction_id = lv_transaction_id.
* 更新日志表
MODIFY zfit0012_log FROM TABLE lt_zfit0012_log.
MODIFY zfit0012 FROM TABLE lt_zfit0012.
IF sy-subrc EQ 0.
COMMIT WORK AND WAIT.
* APPEND INITIAL LINE TO is_output-mt_fi012_erp_rsp-line_of_ret_msg ASSIGNING .
* -msgty = 'S'.
* -message = '传输成功!'.
ELSE.
ROLLBACK WORK.
* APPEND INITIAL LINE TO is_output-mt_fi012_erp_rsp-line_of_ret_msg ASSIGNING .
* -msgty = 'E'.
* -message = '传输失败!'.
ENDIF.
* 结束更新事务
CALL FUNCTION 'TRANSACTION_END'
EXPORTING
transaction_id = lv_transaction_id.

CALL FUNCTION 'TRANSACTION_BEGIN'
    IMPORTING
      transaction_id = lv_transaction_id.
* 更新日志表
  MODIFY zfit0012_log FROM TABLE lt_zfit0012_log.
  MODIFY zfit0012 FROM TABLE lt_zfit0012.
  IF sy-subrc EQ 0.
    COMMIT WORK AND WAIT.
*    APPEND INITIAL LINE TO is_output-mt_fi012_erp_rsp-line_of_ret_msg ASSIGNING .
*    -msgty = 'S'.
*    -message = '传输成功!'.
  ELSE.
    ROLLBACK WORK.
*    APPEND INITIAL LINE TO is_output-mt_fi012_erp_rsp-line_of_ret_msg ASSIGNING .
*    -msgty = 'E'.
*    -message = '传输失败!'.
  ENDIF.
* 结束更新事务
  CALL FUNCTION 'TRANSACTION_END'
    EXPORTING
      transaction_id = lv_transaction_id.