Skip to Content
0
Oct 23, 2015 at 11:00 AM

Data locked by user ( display only)

1723 Views

Issue when update the entries in sm30. In one session (display mode)--> Open another session (Display mode)--> Go to change mode in 2nd session--> Now if I try to go to change mode in first then giving the below error


"Data locked by user ( display only)"


I have used lock object and also Enqueue and dequeue function modules. Even though it is giving this message. Please suggest me how to avoid this.


Code:


MODULE M_CHANGE_LOCKING OUTPUT.
*Call the function module corresponding to the lock object we created
CALL FUNCTION 'ENQUEUE_EZXXXX'
EXPORTING
* MODE_Tablename = 'E'
* MANDT = SY-MANDT
EKORG = ZXXXX-EKORG
WERKS = ZXXXX-WERKS
X_EKORG = 'X'
* X_WERKS = 'X'
* _SCOPE = '2'
* _WAIT = ' '
* _COLLECT = ' '
EXCEPTIONS
FOREIGN_LOCK = 1
SYSTEM_FAILURE = 2
OTHERS = 3.
IF SY-SUBRC <> 0.
* Implement suitable error handling here
* row is locked..hence gray..
* LOOP AT SCREEN.
* screen-input = 0.
* MODIFY SCREEN.
* ENDLOOP.
ENDIF.



CALL FUNCTION 'DEQUEUE_EZXXXXX'
EXPORTING
* MODE_Tablename = 'E'
* MANDT = SY-MANDT
EKORG = ZXXXX-EKORG
* WERKS = ZXXXX-werks
X_EKORG = 'X'
* X_WERKS = 'X'
* _SCOPE = '3'
* _SYNCHRON = 'X'
* _COLLECT = ' '.
.


*Read all the lock details in system
CALL FUNCTION 'ENQUE_READ2'
EXPORTING
gclient = sy-mandt
gname = ''
guname = '*'
TABLES
enq = lt_enq_read.

*We will search entry for table level lock for our table
LOOP AT lt_enq_read INTO lw_enq_read
WHERE gname EQ 'RSTABLE'
AND garg CS 'Tablename'.
MOVE-CORRESPONDING lw_enq_read TO lw_enq_del.
APPEND lw_enq_del TO lt_enq_del.
ENDLOOP.

*Delete table level lock entry for our table
CALL FUNCTION 'ENQUE_DELETE'
EXPORTING
check_upd_requests = 1
IMPORTING
subrc = lv_subrc
TABLES
enq = lt_enq_del.

Attachments

data.png (24.1 kB)