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 in modified DB tables: howto?

matteo_montalto
Contributor
0 Likes
559

Hello all @ SAP forums,

I experienced a strange behaviour on an SRM machine... kinda be an ABAP question, that's why I'm asking here.

Basically: I execute some FM calls that lead to the creation of a new Purchase Order. This implies that some data are written into DB tables, and that's the point. Consider this stack in pseudocode:

- create the order;

- update the order;

- save the order;

- COMMIT WORK;

- (*);

- go searching for an entry in a DB table (BBP_PDBEI); it SHOULD be present since it is create during the PO update phase (SELECT SINGLE * FROM BBP_PDBEI INTO WA_BBP_PDBEI WHERE GUID = item-GUID).

Well; often the search returns no result (sy-subrc =4), even though I can see after the execution that the entry exists in BBP_PDBEI.

Here's the point: if I insert a WAIT UP TO 10 SECONDS in the place marked with (*), then the entry is found. Sounds like a short amount of time is necessary to commit that DB table... could it be?

And in this case, since the complexity of the PO currently created cannot allow to predict a time-to-commit, how can I be sure that the SELECT statement is executed in a consistent and up-to-date DB table?

Thanks in advance

1 ACCEPTED SOLUTION
Read only

ThomasZloch
Active Contributor
0 Likes
522

Without knowing the exact setting and whether/how you are registering the FMs as update tasks, I recommend you try the COMMIT WORK AND WAIT statement to ensure synchronous processing.

Thomas

4 REPLIES 4
Read only

ThomasZloch
Active Contributor
0 Likes
523

Without knowing the exact setting and whether/how you are registering the FMs as update tasks, I recommend you try the COMMIT WORK AND WAIT statement to ensure synchronous processing.

Thomas

Read only

0 Likes
522

Hi Thomas, I'm gonna trying it rite now... How does it work? Will it work for complete commit even in update task?

Read only

0 Likes
522

Here some additional info from ABAP documentation.

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

> 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).

Sounds like this is what you want here.

Thomas

Read only

0 Likes
522

Thanks mate... I'll re-open the thread again in case of problems, but as far as I've seen now it seems to work.