ENQUEUE_FOREIGN
mediumLock Entry Already Held by Another User or Process
Module: BASIS / Enqueue
What this means
ENQUEUE_FOREIGN occurs when a program tries to set an SAP enqueue lock on an object that is already locked by a different user or work process. SAP's enqueue server maintains a central lock table — if process A holds a lock on order 1000 and process B tries to lock the same order, process B receives ENQUEUE_FOREIGN. The dump occurs when the program does not handle this cleanly (no EXCEPTIONS FOREIGN_LOCK in the ENQUEUE call). Common in: parallel posting jobs competing for the same document number ranges; users leaving transactions open with held locks; and background jobs running while online users are editing the same master data.
Check SM12 for the current lock entries on the affected object — it will show which user or process holds the lock and when it was set. If the lock is stale (the user has logged off or the job has ended), delete it from SM12 after confirming the originating transaction is complete. If this is a regular occurrence, review whether parallel jobs need serialisation via job dependencies. For custom code, always include EXCEPTIONS FOREIGN_LOCK in ENQUEUE calls and handle the case gracefully.
Quick Info