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 transaction problem

Former Member
0 Likes
1,024

Hi,

I have a function which uses BAPI_MATERIAL_BOM_GROUP_CREATE to create a BOM. After calling this function module i am doing a explicit commit by using COMMIT WORK AND WAIT.

Now, when i try to read the data immediately after the commit statement, sometimes i get the newly created contents and sometimes not. It happens once in a while. But this is really affecting the functionality of my function module. Can anyone tell me what could be the problem ? Is it related to SAP server load ? What could be other alternatives ?

Thanks in advance,

Srinivas.

8 REPLIES 8
Read only

SuhaSaha
Product and Topic Expert
Product and Topic Expert
0 Likes
902

If you use COMMIT WORK AND WAIT the update should be synchronous. This is what SAP documentation has to say;

... If the addition AND WAIT is specified, program processing after COMMIT WORK will not continue until the update work process has executed the high-priority update function modules (synchronous updating).

[http://help.sap.com/abapdocu_70/en/ABAPCOMMIT.htm]

But sometimes in the forum i have seen members having similar problems though.

BR,

Suhas

Read only

vinod_vemuru2
Active Contributor
0 Likes
902

Hi,

Usually when you add WAIT, control will wait for the update. Introduce explicit wait of 3-4 seconds.

WAIT UP TO 4 SECONDS.

Thanks,

Vinod.

Read only

Former Member
0 Likes
902

Vinod,

I am not sure if explicit wait of 3-4 seconds guarantees that update goes smoothly in all conditions. Assume a production server whose load is pretty high. I want to be very definite about this update as this really affects the entire transaction.

Thanks,

Srini.

Read only

0 Likes
902

Hi,

We had similar issue with triggering of sequential IDOCs.

eg: First IDOC creates material, next creates class characteristics.

We added a WAIT for 5 seconds in characteristics creation FM (Since it is IDOC, time doesn't matter to great extent). Issue got resolved.

I hope your BASIS team will take care of load balancing (May be with multiple application servers) and appropriate number of work processess as per average system load.

Thanks,

Vinod.

Read only

Former Member
0 Likes
902

Hi Srinivas,

try FM BAPI_TRANSACTION_COMMIT.

regards

REA

Read only

Former Member
0 Likes
902

REA,

Saw the code. Didn't find much differences. It also includes the single statement of COMIMIT WORK AND WAIT. Then, it returns the error messages, if any. Lastly,it deletes the buffer.

Do you think this will fix the problem ? Anyways, i will give a shot.

Thank,

Srinivas.

Read only

Former Member
0 Likes
902

Hi Srinivas,

use commad SET UPDATE TASK LOCAL prior to your BAPI call,

then BAPI will use current LUW for Update.

Regards

REA

Read only

0 Likes
902

REA,

I fixed the problem by adding a explicit wait of 2 seconds in a while loop which runs for 20 times so that irrespective of server load the read call gets data. The moment it is able to read data the control comes out of loop.

I will try to test your solution. It is very informative. I was looking for something like this for quite some time.

Thanks !!

Thanks,

Srini.