‎2008 Jul 24 5:31 PM
Hello all,
What is the difference between Commit Work and using BAPI_TRANSACTION_COMMIT. when should we use each of these.
Regards,
Salil
‎2008 Jul 24 5:43 PM
Hi ,
If you see the code of the 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'.
ENDFUNCTION.
COMMIT WORK IS INTERNALLY USED.
It further provides BAPIRET2 structure as output ,waits and refresh.
So it is always better to use this while using the BAPI.
And there is a rule that..Dont ever write Commit work inside the bapi call.Always use this function after the completion of the BAPI.
When you call BAPIs in your program that change data in the R/3 System,afterwards you must call this method to write the changes to the database.
commit work
Executes a database commit and thus closes a Logical Unit of Work
All database updates are made irrevocable and cannot be reversed with ROLLBACK WORK
All database locks are released.
Thank you...
‎2008 Jul 24 5:44 PM
hi check this...
As of Release 4.0 BAPIs must not execute 'COMMIT WORK' commands. Because The caller should have control of the transaction. Several BAPIs should be able to be combined within one LUW.
The BAPI's created with new guidelines will not have COMMIT WORK or
ROLLBACK Statement in it. Based on the Failure/Success of the BAPI we have to explicitly call BAPI_TRANSACTION_ROLLBACK and BAPI_TRANSACTION_COMMIT which will have
ROLLBACK WORK or COMMIT WORK Respectively in it.
Commit work is used when you code directly in ABAP and make changes in the database and
want to commit the database.
BAPI_TRANSACTION_COMMIT is used when you make changes to the SAP database by calling
a BAPI from outside SAP and want to commit the database. When you use a BAPI, you can not
directly use commit work, instead you are allowed to use only
BAPI_TRANSACTION_COMMIT.
‎2008 Jul 24 5:47 PM
Both are same except the message handling.
(WAIT we can use with COMMIT WORK) ,
COMMIT WORK we have to manually handle the sy-subrc check.
But in that function BAPI_TRANSACTION_COMMIT it is handled.
‎2008 Aug 19 8:09 PM
Hi all,
The question is closed. I looked at coupel of standard documents to clarify this.