Delete Foreign Lock Entries in Debug

Share on Facebook14Share on LinkedIn3Tweet about this on TwitterShare on Google+2
Please Share!!

We know, we can manually delete ours lock using t-code SM12. In some project, you might not have access to t-code SM12 at all. In some, you might have access to t-code SM12 but only in display mode. And in some clients like I am in now, you can only delete your locks, not the foreign locks i.e. you cannot delete objects locked by other users.

Inspiration of this post.
Your colleague was editing an object (program) in the office at offshore. When he left for the day, he just locked his desktop (window + L) and went. He did not close the windows he was working on and also did not shut down his desktop.

At a distant land, in a different time zone, you are starting your day and you need to correct/modify the same object which your colleague has locked. You try to call him but he is not reachable; may be he is partying somewhere. Β πŸ™‚

You have 3 options.
1) Park this object to be worked on some other day. Work on some other issue/development now.
2) Wait till SAP Auto Logs out the user with message ‘maximum user idle time exceeded‘ and all sessions of the users are closed.
3) Delete/Release that lock entry and start working on that object immediately.

This page is for option 3.

Disclaimer: This page is not to encourage you to delete others locks. Please use it ethically and responsibly.

[adToAppearHere]

SAP says:
Before you can manually delete lock entries, you must make sure that there are no processes active that need the objects in question to be locked (transaction, update). Otherwise, there is a danger that the objects that are no longer protected can be changed by several processes at once and, as a result, become inconsistent and incorrect.

Before you delete any lock, make sure you know what you are doing and there would not be any inconsistency.

Enough, caution. Let move on!!

Check, user is not able to edit the program as it is locked by another user.

Locked

Go to T-Code SM12. Provide the user id of the person who has locked the program and hit list.

sap abap locks

You will get the list of all locks under his id.

Lock concept in SAP

Identify and select your program which you want to release/unlock. Hit the Delete icon.

Foreign lock

Check you get the message, ‘You are not authorized to delete foreign lock entries‘.

As we know, ABAPer with debug and change role can enter and break even the safest bank lockers. Select the line you want to unlock. Type ‘/h’ at the command entry section. Hit enter. You will get ‘debugging switched on‘ message. Hit the Delete icon.

5

You are in the debugger mode now.

6

Type sy-uname. You would find your user id by default.

Locks in SAP

Now, we just need to fool the system. In the sy-uname variable, replace your user id with the userid of the person who has locked this object.

8

You are done. You will get a pop up confirmation message. Just hit Yes. Β The lock entry is gone. Without wasting any time, you can change your object now. πŸ™‚

Earlier too, I use to delete the locks in debug mode by by-passing the validation and authorization section. But, recently, I figured out that just replacing the sy-uname is the simplest way to fool the system if you want to delete foreign locks.

Hope you enjoyed this tweak. You might also like to check our other post about changing variants in production system without Fire Fighter.

If you want to get such practical issues and resolutions straight to your inbox, please SUBSCRIBE.

Thank you very much for your time!!

 

 

Image courtesy : www.123rf.com

Share on Facebook14Share on LinkedIn3Tweet about this on TwitterShare on Google+2
Please Share!!

10 Comments on "Delete Foreign Lock Entries in Debug"

  1. Steve Oldner | August 31, 2015 at 11:39 am |

    Nice. I have a requirement to delete locks for CATS webdynpro when the user is out and the Time keeper is waiting to enter corrections thru PTMW.

    This might help.

    • Thanks Steve!! Good to see your feedback after some time.. HR guys are tough nut to crack.. Not sure if this tweak would be able to break them.. πŸ™‚

      By the way, were you able to delete that lock?

      Regards,
      Raju.

  2. Simple and logical πŸ™‚

  3. Mohamed Haarish | September 3, 2015 at 2:25 am |

    Very Nice πŸ™‚ πŸ™‚ πŸ™‚ πŸ™‚ !!

    Regards,
    Haarish
    Fujitsu Japan.

  4. Shishira Shastri H | September 4, 2015 at 3:08 pm |

    WOW!! SAPYARD you are full of Surprises.
    Very nicely explained and thanks for the self-explanatory snaps.

  5. Very useful, Thanks πŸ™‚

Comments are closed.