‎2007 Feb 01 2:30 AM
Hi SDN's
I created a a lock object for a Z table, so that when the user tries to access the same record from a Z Tcode.
it is getting locked fine, and geting unlocked also ...
but what i want to know is how do i know the user name who has locked it?
can i know it from the function modules ENQUEUE or DEQUEUE or is there any other way where i can know the User Name who has locked it?
Regards
Pratyusha
‎2007 Feb 01 2:37 AM
I believe this will come automatically if you have the exceptions uncommented and the IF statement after the ENQUEUE function call uncommented.
.........
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 Feb 01 2:37 AM
I believe this will come automatically if you have the exceptions uncommented and the IF statement after the ENQUEUE function call uncommented.
.........
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 Feb 01 2:43 AM
Hi Rich, Yes it is as what u said. But i gave a msg of my own saying 'Record Locked'
but now when i uncommented it, i dont get any msg, where as i can open the same in 2 diff sessions.
Please check my part of code
Lock the transaction if the same MO is being changed else
loop at IT_RFQITEM into IS_RFQITEM.
call function 'ENQUEUE_EZ_ENQUE_RFQ'
exporting
MODE_ZES_RFQ_ITEM = 'E'
MANDT = SY-MANDT
RFQ_NO = IS_RFQITEM-RFQ_NO
SER_NO = 1
RFQ_LN = IS_RFQITEM-RFQ_LN
X_RFQ_NO = ' '
X_SER_NO = ' '
X_RFQ_LN = ' '
_SCOPE = '2'
_WAIT = ' '
_COLLECT = ' '
exceptions
FOREIGN_LOCK = 1
SYSTEM_FAILURE = 2
others = 3.
if SY-SUBRC <> 0.
message E138(ZSM) with 'MO is locked'.
endif.
clear : IS_RFQITEM.
endloop.
Regards
Pratyusha
‎2007 Feb 01 2:52 AM
‎2007 Feb 01 3:12 AM
Thanks Rich, its working fine
i did a silly mistake..
Thanks
Pratyusha