Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Enqueue lock failure and subsequent program failure

Hi,

I tried reading all the posts and SAP resources on the SAP Lock concept but I still have some questions left unanswered, hence I posting a new question here.

Every day the production system receives sales orders through EDI. After the sales order is generated, an user exit is triggered to update the custom fields in the VBAK table. The custom fields are sometimes not updated and I am guessing that this happens only in case of large orders since the sales order may not yet be completely saved even though the sales order number is generated.

This is the code currently used in the user exit of the EDI

DO 20 TIMES.
      CALL FUNCTION 'ENQUEUE_EVVBAKE'
        EXPORTING
          vbeln          = sales_document
          _wait          = 'X'
        EXCEPTIONS
          foreign_lock   = 1
          system_failure = 2
          OTHERS         = 3.
      IF sy-subrc EQ 0.
        MOVE 'X' TO l_lock_set.
        EXIT.
      ENDIF.
ENDDO.

    UPDATE vbak SET ............

    IF l_lock_set IS NOT INITIAL.
      CALL FUNCTION 'DEQUEUE_EVVBAKE'
        EXPORTING
          vbeln = sales_document.
    ENDIF.

My questions are

1. Is there a way I can find whether the VBAK sales order is still being updated before I use the FM 'ENQUEUE_EVVBAKE' ?

2. If I use a COMMIT WORK AND WAIT before 'ENQUEUE_EVVBAKE', does it wait for the VBAK update LUW to complete before it triggers FM 'ENQUEUE_EVVBAKE' ?

3. The program tries 20 times to lock the VBAK header data. Could you tell me how much time it waits before it goes through the 'do.. endo' loop, I read that the value of parameter '_wait' is set by BASIS team, is there any way I can find this value.

4. Will the UPDATE VBAK statement fail if the lock failed ?

5. Does the DEQEUE FM automatically perform 'COMMIT WORK' or should I do write this statement explicitly ?

Edited by: Grame Smith on Jun 2, 2011 5:56 PM

Not what you were looking for? View more on this topic or Ask a question