It happens to us all. Sometimes, SAP runs asynchronous processes. If we have to make multiple BAPI calls (or run multiple batch inputs) in a loop, we might get lock errors at the 2nd, 3rd, etc BAPI call (even if we say “COMMIT WORK AND WAIT”).
Here is a simple but effective solution to this problem:
loop at itab.
” do stuff
” call function ‘BAPI…’
” commit work and waitdo.
wait up to 1 seconds.
” check if BAPI recording is finished
” look at tables, locks, etc.
” if process has finished.
exit.
endif.
enddo.endloop.
Leave a Reply