1. 程式人生 > >Commit 函數WAIT = 'X'.

Commit 函數WAIT = 'X'.

turn dex com llb 供應商 tab cnblogs buffer 創建

BAPI_TRANSACTION_COMMIT

IF WAIT EQ SPACE.
  COMMIT WORK.
ELSE.
  COMMIT WORK AND WAIT.
  IF SY-SUBRC NE 0.
    CALL FUNCTION BALW_BAPIRETURN_GET2
         EXPORTING
              TYPE       = E
              CL         = S&
              NUMBER     = 150
         IMPORTING
              RETURN     
= RETURN. ENDIF. ENDIF. CALL FUNCTION BUFFER_REFRESH_ALL.

使用API 函數需要註意:要使用 wait = ‘X‘.

不然多條會dump

IF ex_statu NE ‘E‘.
CALL FUNCTION ‘BAPI_TRANSACTION_COMMIT‘
EXPORTING
wait = ‘X‘.
READ TABLE lt_get INTO ls_get INDEX 1.
ex_lifnr = ls_get-header-object_instance-lifnr.
ex_statu = ‘S‘.
ex_msg = ‘創建供應商成功!‘.
ELSE.
CALL FUNCTION ‘BAPI_TRANSACTION_ROLLBACK‘.
* ROLLBACK WORK.
* ex_statu = ‘E‘.
* ex_msg = ‘創建供應商失敗!‘.
ENDIF.

CALL FUNCTION ‘BAPI_TRANSACTION_ROLLBACK‘. 清空緩存 很重要!!!

Commit 函數WAIT = 'X'.