‎2007 Jun 04 2:20 PM
hi..
i have an equipment number eqnr .. i want to check that if any lock exists on tat eqnr..
can any one suggest me any FM tat will help me uot wid this..?
thnx.
‎2007 Jun 04 2:24 PM
‎2007 Jun 04 2:24 PM
‎2007 Jun 04 2:51 PM
hi..
ENQUEUE_EIEQUI
can u please explain if i want to check the lock for an equipment and if i find tat there exists a lock..then i have to wait for 2 sec and then chk it again ..if the lock still exists..
in this case the WAIT parameter if i pass WAIT = '5'.
will work..
thnx
‎2007 Jun 04 2:59 PM
Simply call it like this. The WAIT parameter needs a value of "X". It will wait a predetermined amount of time for the lock to be released, You could do this in a loop if necessary, keep checking sy-subrc untill it = 0.
report zrich_0001.
parameters: p_equnr type equi-equnr.
start-of-selection.
call function 'ENQUEUE_EIEQUI'
exporting
mode_equi = 'E'
mandt = sy-mandt
equnr = p_equnr
* X_EQUNR = ' '
* _SCOPE = '2'
_wait = 'X'
* _COLLECT = ' '
exceptions
foreign_lock = 1
system_failure = 2
others = 3.
if sy-subrc <> 0.
message id sy-msgid type sy-msgty number sy-msgno
with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
endif.
Regards,
RIch Heilman
‎2007 Jun 04 3:10 PM
hi..
wait = 'X' will for for how long can we define it ....?
and loop in the sence
can u give example for loop.. i m new to abap so i m not aware of this...
thnx..
‎2007 Jun 04 3:33 PM
‎2007 Jun 04 3:41 PM
So in this example, I am doing a loop and check for a lock, if I don't get one, I wait for 5 seconds, this loop continues untill 30 seconds, no lock then it quits and gives message.
report zrich_0001.
data: counter type i.
parameters: p_equnr type equi-equnr.
start-of-selection.
clear counter.
do.
* Exhausted, no luch in getting a lock, get of of DO loop.
if counter > 6.
sy-subrc = 1.
exit.
endif.
* Try for lock
call function 'ENQUEUE_EIEQUI'
exporting
mode_equi = 'E'
mandt = sy-mandt
equnr = p_equnr
* _wait = 'X'
exceptions
foreign_lock = 1
system_failure = 2
others = 3.
* Got a lock, get out of DO loop.
if sy-subrc = 0.
exit.
endif.
* Still here? Then wait another 5 seconds
wait up to 5 seconds.
counter = counter + 1.
enddo.
* Report status
case sy-subrc.
when 0.
message s001(00) with 'Lock could not be established'.
when 1.
message i001(00) with 'Lock could not be established'.
endcase.
Regards,
Rich Heilman
‎2007 Jun 04 2:26 PM
Hi Neha,
Just go to SE37, type DEQUEUE* and hit F4. Provide additional parameters which would help you zero in on the appropriate FM. Use this FM to unlock your object. To lock your record, use ENQUEUE*..and find the appropriate FM.
Regards
Anil Madhavan
‎2007 Jun 04 3:20 PM