SAP BAPIObjectBAPI_EMPLOYEE_ENQUEUEModuleHCM_SUCCESSFACTORS

BAPI_EMPLOYEE_ENQUEUE — BAPI_EMPLOYEE_ENQUEUE Lock Handling and Failures

BAPI_EMPLOYEE_ENQUEUE sets an exclusive lock on a personnel number, mirroring the lock SAP places automatically when a user opens PA30 or PA40 for that employee. It does not write to the database and does not need a commit. Interfaces must inspect the RETURN table, not just RFC subrc, because a locked employee returns a normal RFC call with an error message inside RETURN.

This page covers what BAPI_EMPLOYEE_ENQUEUE actually locks, why its success has nothing to do with COMMIT WORK, and the return-handling mistakes that cause interfaces to silently proceed against a locked employee record. It also separates the developer-side lock-pairing bugs from the functional evidence needed to diagnose a stuck lock.

Published 16 Sept 2026· 904 words

What it does

BAPI_EMPLOYEE_ENQUEUE acts on the personnel number as a whole, not on a single infotype record. It sets the same exclusive lock that SAP places on the enqueue table the moment a user opens an employee in PA30 or PA40 for maintenance. Custom programs, RFC clients, and integration middleware (including flows replicating data from SuccessFactors Employee Central into an on-premise or cloud payroll/HCM backend) call it before invoking any change BAPI against that employee, so the sequence enqueue, change, dequeue reproduces the same concurrency protection a human user gets automatically inside the GUI. Without this call, two processes could update infotype records for the same PERNR at the same time with no warning from the system.

Important parameters

The interface is deliberately narrow because it only manages a lock, not data.

  • NUMBER - the personnel number (PERNR) to be locked, the only business key the BAPI needs
  • RETURN - standard BAPI return table carrying the success or failure of the lock attempt, including which user or process currently holds the lock when the attempt fails

Commit behaviour

There is nothing to commit. The BAPI writes an entry to the lock table (the same mechanism visible in SM12), not to a database table, so calling BAPI_TRANSACTION_COMMIT afterward has no effect on the lock itself. The lock lives for the duration of the calling session or LUW and is released only by an explicit call to the dequeue counterpart, or by the session/work process ending. If the caller forgets to dequeue, the lock is not cleaned up by a commit or by the interface finishing normally at the application level, it stays open until the RFC connection or user session that created it is terminated, which in batch or middleware scenarios can be much later than expected.

Return handling

The RFC call itself almost always succeeds with subrc 0, whether or not the lock was actually granted. The real result lives in RETURN. A message with TYPE E or A means the lock failed, typically because another user or process already holds it, and MESSAGE_V1 to V4 usually identify who and what infotype context they are in. The recurring interface bug is checking only sy-subrc after the RFC call and treating that as proof the employee is now locked, then proceeding straight into a change BAPI. When that happens, the downstream BAPI fails with its own lock error, but the root cause, an enqueue that was silently rejected, is now one step removed from where the failure surfaces, which makes log analysis slower than it needs to be. Correct handling loops the RETURN table, aborts the whole chain on any E or A entry, and logs the message text so support can see exactly who was holding the employee.

ECC vs S/4HANA

The lock concept and this BAPI remain valid in S/4HANA on-premise HCM for classic infotype maintenance, since the underlying enqueue mechanism has not changed. There is no newer released API that replaces it for that scenario. SuccessFactors Employee Central itself does not use SAP's enqueue locking at all, its concurrency model is entirely different, so this BAPI is only relevant on the on-premise or ECP side of a hybrid landscape, typically just before or during replication of employee changes into the backend HR system.

Common pitfalls

Most production issues trace back to lock lifecycle mismanagement rather than the BAPI itself.

  • Long batch jobs that enqueue once at job start and hold the lock across a whole loop of employees instead of per-record, blocking unrelated PA30 users for the job's entire runtime
  • Middleware losing its RFC connection or crashing before the matching dequeue call fires, leaving an orphaned entry in the lock table that has to be cleared manually via SM12
  • Overlapping selection ranges in parallel job variants causing two instances to fight over the same PERNR
  • Skipping the RETURN check entirely and assuming enqueue always succeeds, which turns a routine lock conflict into a confusing failure several calls later
  • Treating the enqueue as a data-level write lock, when a direct table update bypassing the BAPI layer would ignore it completely

Whose problem this is

This is a developer or integration problem in the vast majority of cases, since it almost always comes down to how enqueue and dequeue are paired in custom code or middleware. What functional needs to supply is the affected PERNR, the timestamp of the failure, and confirmation of who else was legitimately working on that employee at the time, checked directly in SM12.

Related SAP objects

Reviewed pages this object connects to in the ERPClimb knowledge graph.

Source: ERPClimb — https://erpclimb.com/sap-bapis/bapi-employee-enqueueERPClimb is an independent platform and is not affiliated with SAP SE. Reference pages are written and reviewed by SAP consultants for learning and troubleshooting.