Hi Senthil,
Firstly google on " Fighting problems of asynchronous processing in ABAP". Try out the suggestion posted in that blog.
If still the issue persists, debug the transaction.
I) Put a breakpoint on 'BAPI_ALM_ORDER_MAINTAIN'.
2) In ST05, activate enqueue trace.
3) Execute the transaction.
4) Press F8, and check in SM12, where the lock is being set.
5) Once debugger reaches 'BAPI_TRANSACTION_COMMIT' , press 'F8'. Normally it takes between 20-80 ms to release a lock. In parallel, refresh SM12 to check whether lock has been released or not.
6) Even after that, if lock is not released. Do a lookup in DB to check whether the entry has been updated or not.
7) If entry exists in DB table , release the lock by calling 'DEQUEUE_EMRESB' or 'DEQUEUE_ALL'.
While dequeueing, you can also set synchron parameter to 'X', to ensure that the lock is actually released.
Normally, dequeue fails, if the call for enqueue and dequeue occur in separate user sessions or the mode used in enqueue is different from that in dequeue. While updating, we should ensure that all the updates take place in the same session or the same process handles all the updates.
Regards,
DPM