Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

About BAPI_TRANSACTION_COMMIT

Former Member
0 Likes
37,328

Hi,

Can anyone pls tell me when to use BAPI_TRANSACTION_COMMIT.

Is it only used for Creating of Data in R/3 Using another BAPI ?

or

Is this BAPI is Used after Updation and Deletion of Data in R/3also?

Thanks in Advance,

Venkat

6 REPLIES 6
Read only

Former Member
0 Likes
18,707

Yes you can use this in R3 also.

BAPI_TRANSACTION_COMMIT.

use : when you are using BAPI's it need external commit. for this we use the above FM.

when you will use..

When there is no error from BAPI then only you need to call this BAPI.

Read only

RaymondGiuseppi
Active Contributor
0 Likes
18,707

Look at OSS [Note 798535 - COMMIT WORK after calling a BAPI|https://service.sap.com/sap/support/notes/798535]

Regards

Read only

Former Member
0 Likes
18,707

This BAPI is used to update the database after all the transactions in a LUW are completed successfully. After execution of this BAPI all the related tables are updated in the database.

So whatever operation you do which requires the database tables to be updated, this BAPI can be used.

Read only

Former Member
18,707

BAPI_TRANSACTION_COMMIT is called to COMMIT a database operation.

As we can not write COMMIT WORK statement inside BAPI, we need to call this BAPI.

Suppose you are updating some database table inside one BAPI.

According to success status of that BAPI, either you can COMMIT or ROLLBACK. To COMMIT call BAPI BAPI_TRANSACTION_COMMIT

Read only

former_member125661
Contributor
0 Likes
18,707

This method executes a COMMIT WORK command. It is needed for transactions that are developed outside of the R/3 System, but change data in the R/3 System using BAPI calls.

If you call BAPIs in your program, which are meant to change R/3 System data, you must call this method to write the changes in the database.

In this case, the database commit is executed externally.

Executing the ABAP statement COMMIT WORK:

Besides the database commit, this statement executes other activities - compare the key term documentation for COMMIT WORK.

In this case, the database commit is executed internally.

Example program

**************************************************************
Call BAPI
**************************************************************

CALL FUNCTION 'BAPI_DOCUMENT_CREATE2'
           EXPORTING: documentdata = ls_doc

           IMPORTING: documenttype = lf_doctype

                    documentnumber = lf_docnumber

                    documentpart = lf_docpart

                    documentversion = lf_docversion

                    re stall turn = ls_return

           TABLES: documentdescriptions = lt_drat

                    object-left = lt_drad

                    documentfiles = lt_files.


**************************************************************
**Error Check
**************************************************************

IF ls_return-type CA 'EA'.
           ROLLBACK WORK.          'Errors are made declining

           MESSAGE ID '''26''' TYPE '''I''' NUMBER '''000'''

           WITH ls_return-message.

ELSE.

           COMMIT WORK.             'Changes are confirmed


ENDIF.

Read only

Former Member
0 Likes
18,707

hii

CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'

EXPORTING

WAIT = w_WAIT

IMPORTING

RETURN = RETURN.

.

This FM will update your data.it will use for the FM like BAPI_DOCUMENT_CHANGE2 ....if its done successfully then 'BAPI_TRANSACTION_COMMIT' FM will save all the changes or else it will not save and will perform rollback.

reward if useful

thx

twinkal