I am writing a BAPI to update several materials asynchronously.
1. The BAPI will lock those materials for update by ENQUEUE_EMMARAE with scope 2
2. Calls another function module IN UPDATE TASK, which calls BAPI_MATERIAL_SAVEDATA several times to update those materials.
However, the BAPI_MATERIAL_SAVEDATA fails to accumulate the lock on EMMARAE and rejects the changes.
The BAPI is to return without waiting for the material changes, but block other change attempts in the mean time.
As a work around, I tried to release the lock in the FM before locking again, but it could not be done by DEQUEUE_ALL nor DEQUEUE_EMMARAE.