BAPI Commit Delay Solution

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 wait

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

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s