‎2008 May 05 11:49 AM
see the below code all the selects and locking are happening on the same table xxxxx.
SELECT * FROM xxxxx
INTO TABLE i_vbeln
WHERE vbeln IN s_vbeln
AND bukrs IN s_bukrs
AND vkorg IN s_vkorg
AND vkbur IN s_vkbur
AND vkgrp IN s_vkgrp
AND auart IN s_auart.
if sy-subrc = 0.
LOOP AT i_vbeln.
CALL FUNCTION 'ENQUEUE_EXXXXX'
EXPORTING
mode_zse32 = 'X'
mandt = sy-mandt
vbeln = i_vbeln-vbeln
EXCEPTIONS
foreign_lock = 1
system_failure = 2
OTHERS = 3.
IF sy-subrc EQ 0.
*SELECT SINGLE FOR UPDATE **
FROM xxxxx
INTO i_vbeln
WHERE vbeln EQ i_vbeln-vbeln.
xxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxx
CALL FUNCTION 'DEQUEUE_EXXXXX'
EXPORTING
mode_zse32 = 'X'
mandt = sy-mandt
vbeln = i_vbeln-vbeln.
endloop.
endif.
now my question is..
is it mandatory to have the the below select for updating the table xxxxx
*SELECT SINGLE FOR UPDATE **
FROM xxxxx
INTO i_vbeln
WHERE vbeln EQ i_vbeln-vbeln.
or can i go directly with enque and deque without the above select before updating the table
‎2008 May 05 11:51 AM
hi,
You can just call FM ENQUEUE_E_XXXX and DEQUEUE_E_XXXX for locking and unlocking the tables with out any select statements ..
Regards,
santosh
‎2008 May 05 11:54 AM