Application Development 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: 

Wait upto one second v/s BAPI TRANSACTION COMMIT

Former Member
0 Kudos

Hi All,

I calling the FM BAPI_EQUI_CHANGE and then CALL FUNCTION 'BAPI_TRANSACTION_COMMIT 'EXPORTING wait = 'X'.

But it seems like in the production environment the commit does not happen immediately and happens only when I add a "wait upto one second" statement. I want to avoid the wait and also a bit confused on why the commit BAPI does not work quickly enough. PLease enlightenme on this.

Best REgards,

Shankar.

6 REPLIES 6

former_member186491
Contributor
0 Kudos

Hi Shanker,

If you don't wanna let your program wait till any long; then you can comment EXPORTING section out. Example can be as below --

 CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
* EXPORTING
*   WAIT          =
 IMPORTING
   RETURN        = 
          .

Thanks.

Kumar Saurav.

former_member182040
Active Contributor
0 Kudos

you can also use

COMMIT WORK.

Former Member
0 Kudos

Hi,

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.

Former Member
0 Kudos

Hi,

CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'

EXPORTING

WAIT = 'X'

and COMMIT WORK AND WAIT are same. This will help you to do synchronous update(ie it will wait till update happens before going to the next step).

CALL FUNCTION 'BAPI_TRANSACTION_COMMIT' and COMMIT WORK are same. the differnce with the above is that this may not be synchronous.

Regards,

Sajith

raymond_giuseppi
Active Contributor
0 Kudos

BAPI_TRANSACTION_COMMIT executes

- a COMMIT WORK, so it starts update task, if WAIT specified, it waits until task are ended, and execute a database commit (native SQL commit on database server)

- a buffer refresh of the BAPI tools only not of the whole database on server...

There can nevertheless be some delay due to database server even if database commit is required it may take time and Abap don't wait at this step, so even a WAIT UP TO n SECONDS can fail ( So [it will happen|http://en.wikipedia.org/wiki/Murphy%27s_law]). If you want to actually be sure that database is updated, you must execute a SELECT from database[ BYPASSING BUFFER|http://help.sap.com/abapdocu_70/en/ABAPFROM_CLAUSE.htm#&ABAP_ADDITION_3@3@] in a DO/ENDDO loop to insure data is created/updated (Of course put a limit at the number of tries performed)

Regards,

Raymond

Former Member
0 Kudos

Hello Raymond,

Could you kindly explain little more your idea:

"There can nevertheless be some delay due to database server even if database commit is required it may take time and Abap don't wait at this step"

What it is meant by due to database server?==> Communication between application server and Data base servers. or it is data replication between the Buffer Pool and Physical data base?

If ever (for whatever the reason) the physical commit fails, what will be the result? From ABAP point of view, everything is okay and no thing will be reported to SM13 , SM21.

So where we can find error coming from such commit incidents?

Thanks in advance

Meher

Edited by: Rob Burbank on Oct 26, 2011 10:54 AM