Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

how to use FM enqueue_read

Former Member
0 Kudos

hi experts,

i already used fms ENQUEUE_EVVBAKE and DEQUEUE_EVVBAKE for identifying locked quotations but i had trouble when the last entry for quotation is locked, all documents shows tahat they are locked too.

i wanted to know how to use enqueue_read FM.

Please tell me what's wrong with the concept i know.

This is what i've tried:

PARAMETER: p_vbeln type vbeln. == the document number which i wanted to check if on process

DATA: it_enq TYPE STANDARD TABLE OF seqg3 WITH DEFAULT KEY, == to be used in the TABLES

c_garg type seqg3-garg. == to be used in GARG parameter

clear: c_garg, it_enq.

refresh: it_enq.

concatenate sy-mandt p_vbeln into c_garg. == concatenated the client and the document number to be used in garg

CALL FUNCTION 'ENQUEUE_READ'

EXPORTING

GCLIENT = SY-MANDT == client

GNAME = 'EVVBAKE' == lock object name found in sm12

GARG = c_garg == combination of client and the document number

GUNAME = ' ' == space

  • LOCAL = ' '

  • FAST = ' '

  • IMPORTING

  • NUMBER =

  • SUBRC =

TABLES

ENQ = it_enq. == the table initailized above

  • EXCEPTIONS

  • COMMUNICATION_FAILURE = 1

  • SYSTEM_FAILURE = 2

  • OTHERS = 3

.

IF SY-SUBRC <> 0.

write: 'processed'.

else.

write 'no'.

ENDIF.

this code always returns 'no' even if i'm currently processing the document.

Thanks in advance!

1 ACCEPTED SOLUTION

Clemenss
Active Contributor

Hi karshbax,

>

when the last entry for quotation is locked, all documents shows tahat they are locked too.

Please check that you do not call ENQUEUE with initial document number - this will lead to lock for all.

Usually you do not need the ENQUEUE_READ, it is used for display of all locks in SM12.

Regards,

Clemens

2 REPLIES 2

Former Member
0 Kudos

Hi,

try this way...


  call function 'ENQUEUE_EVVBAKE'
    exporting
      mode_vbak      = 'E'
      vbeln          = rmaorder
    exceptions
      foreign_lock   = 1
      system_failure = 2
      others         = 3.
  if sy-subrc = 0. "Lock on sales order?
    w_lock = 'X'.
  else.
    perform unlock_salesorder.
    call function 'ENQUEUE_EVVBAKE'
      exporting
        mode_vbak      = 'E'
        vbeln          = rmaorder
      exceptions
        foreign_lock   = 1
        system_failure = 2
        others         = 3.
  endif.
*&---------------------------------------------------------------------*
*&      Form  UNLOCK_SALESORDER
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
form unlock_salesorder .

  call function 'DEQUEUE_EVVBAKE'
    exporting
      mode_vbak = 'E'
      vbeln     = rmaorder.

  call function 'DEQUEUE_ALL'.
endform.

Prabhudas

Clemenss
Active Contributor

Hi karshbax,

>

when the last entry for quotation is locked, all documents shows tahat they are locked too.

Please check that you do not call ENQUEUE with initial document number - this will lead to lock for all.

Usually you do not need the ENQUEUE_READ, it is used for display of all locks in SM12.

Regards,

Clemens