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

COMMIT WORK AND WAIT; WAIT flag in BAPI_TRANSACTION_COMMIT

former_member202077
Participant
0 Likes
2,523

Hello

1) Some times we use COMMIT WORK AND WAIT and some times we pass 'X' falg for WAIT param in BAPI_TRANSACTION_COMMIT, so the standars SAP How many micro seoconds / seconds will be passes for this WAIT command?

2) Instead can i sue COMMIT WORK and checking the system DB for update in question, if its successful, EXITting the block, Can i implement this alternative in performence perspective is it useful?

Thank you

8 REPLIES 8
Read only

former_member202077
Participant
0 Likes
1,470

Any replies experts pls.?

Thank you

Read only

yuri_ziryukin
Product and Topic Expert
Product and Topic Expert
0 Likes
1,470

1) There is no number of seconds for this WAIT. The work process waits until the V1 (most important) updates are completely finished and then returns. Please be aware that V2 updates might still be running. But normally they are not a big problem.

2) Yes, you can theoretically do that, but do not forget to put "WAIT UP to 1 seconds" after each select in the loop.

Using this method you will be wasting in average 500 milliseconds.

Read only

Former Member
0 Likes
1,470

Adding to what Yuri said , wanted to add the pitfalls of COMMIT WORK  without WAIT  statement, COMMIT WORK without WAIT is basically asynchronous, the code below ur COMMIT WORK will always execute without waiting for the database updates to complete (say if u have 5 tables to update) the current program will not wait for table updates to complete, sometimes it might take a second at times it might take more than that...WAIT UPTO 1 SEC can minimize ur probabilitly of an slect not failing however it cannot be eliminated...  I will prefer to use COMMIT WORK AND WAIT in case if u wanted the recently posted data thru BAPI /code for subsequent processing

Read only

Former Member
0 Likes
1,470

Hi MSR,

         

WAIT addition is used for synchronous updating, that means the program will resume its execution till the update work finish, and it will continue after the database update. Otherwise it will be a asynchronous update (means the program wont wait for the database update).

When we call a COMMIT WORK the following actions are occurring in the system.

  • Execute all subroutines registered using PERFORM ON COMMIT bases on the registration order.
  • Trigger an internal event for the Persistence Service of the Object Services.
  • It Handles the SAP locks associated with the current program.

  • Trigger database commit and close the current database LUW and database cursors.

  • Trigger the TRANSACTION_FINISHED event

  The system field sy-subrc will contain the following follows when we execute this statement. 

  • sy-subrc= 0 If the WAIT addition is not specified.
  • sy-subrc= 0 If the WAIT addition is specified and updating is successful.
  • sy-subrc= 4 If the WAIT addition is specified and updating is failure.

some times we pass 'X' falg for WAIT param in BAPI_TRANSACTION_COMMIT, so the standars SAP How many micro seoconds.

Using this  you will be  average  in 600 Microseconds

                                               

Read only

yuri_ziryukin
Product and Topic Expert
Product and Topic Expert
0 Likes
1,470

naveen kumar wrote:

some times we pass 'X' falg for WAIT param in BAPI_TRANSACTION_COMMIT, so the standars SAP How many micro seoconds.

Using this  you will be  average  in 600 Microseconds

                                               

Read only

0 Likes
1,470

Better give the link to documentation like COMMIT WORK [AND WAIT]. than copy/paste part of the documentation

always thought the answer was 42 and not 600

Regards,

Raymond

Read only

0 Likes
1,470

The SAP document seems not explaining "AND WAIT" clearly.

Regards,

Yuping

Read only

0 Likes
1,470

Effect, Chapter 2, paragraph 3