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.
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.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
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.
- 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)
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
Edited by: Rob Burbank on Oct 26, 2011 10:54 AM