Skip to end of metadata
Go to start of metadata

How to lock and unlock delivery document
 DATA: d_vbeln LIKE likp-vbeln.        "For storing vbeln
 CLEAR d_vbeln.
   d_vbeln = it_vbrp-vgbel.
*---locking delevery document
   CALL FUNCTION 'ENQUEUE_EVVBLKE'
     EXPORTING
       mode_likp      = c_e
       mandt          = sy-mandt
       vbeln          = d_vbeln
     EXCEPTIONS
       foreign_lock   = 1
       system_failure = 2
       OTHERS         = 3.
 CLEAR d_vbeln.
   d_vbeln = it_vbrp-vgbel.
*---fun mod to unlock delivery doc
   CALL FUNCTION 'DEQUEUE_EVVBLKE'
     EXPORTING
       mode_likp = c_e
       mandt     = sy-mandt
       vbeln     = d_vbeln.
  
Note: After lock do unlock.