Preventing Duplicate ABAP Executions

If you want to prevent a specific ABAP program from being executed in multiple sessions simultaneously, you can implement this simple workaround:

 
 

  • Create a Z-Table with the fields MANDT, REPID (like sy-repid)
  • Create a lock object based upon this table
  • When your program is executed, try to ENQUEUE the lock. If you can’t, this means that the lock has been set in another session (the program is running already). In that case, display a polite warning message and “leave list-processing” =)
  • Don’t forget to DEQUEUE as well

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