12-03-2007 8:26 PM
Hi Experts,
I have a BAPI and I need to execute this BAPI again after a particular waiting time (e.g 10 sec) once it fails.
How can I achieve this functionality?
Any helpful entry will be rewarded.
Warm regards,
Raman
12-03-2007 8:30 PM
You can read the RETURN table and if the error is there you can use the WAIT syntax to wait for some itme.
Like:
WAIT UP TO 10 SECONDS.
Regards,
Naimesh Patel
12-03-2007 8:35 PM
12-03-2007 8:40 PM
Hi Rob,
If I go to debugging mode and execute the BAPI after sometime (after waiting for 10 sec), it runs successfully. That's the reason I want to implement that in my code and try to give it a shot.
Warm regards,
Raman.
12-03-2007 8:46 PM
You can achieve this by calling this FM BAPI_TRANSACTION_COMMIT with wait option after your BAPI call.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
wait = 'X'.
Regards,
Naimesh Patel
12-03-2007 8:52 PM
WAITing may or may not work. Adding the wait parameter to the commit is much better.
Rob
12-03-2007 9:02 PM
In most cases, you get this kind of issues when there is a lock on the object that you trying to update or if you are creating and updating the same object in the same program flow. If it is the first case, introduction of a DO... ENDDO may help. In the later case, BAPI_TRANSACTION_COMMIT with WAIT = 'X' after the create call helps.
DO.
call bapi.
if there is an error in the return messages.
continue.
else.
exit.
ENDDO.