‎2009 Nov 02 2:12 PM
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
‎2009 Nov 02 2:20 PM
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
‎2009 Nov 02 2:20 PM
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
‎2009 Nov 02 2:22 PM
Hi Thomas, I'm gonna trying it rite now... How does it work? Will it work for complete commit even in update task?
‎2009 Nov 02 2:33 PM
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
‎2009 Nov 02 2:35 PM
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.