10-23-2015 12:00 PM
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.
10-23-2015 12:01 PM
I wonder why do you want to let more than one user to maintain the same data at the same time and possibly lead to database inconsistencies?
10-23-2015 12:01 PM
I wonder why do you want to let more than one user to maintain the same data at the same time and possibly lead to database inconsistencies?
10-23-2015 12:07 PM
Ya true but that is the user requirement.. I am able to maintain the table entries for more than 1 user but this issue happens only when there is a display mode (In one session (display mode)--> Open another session (Display mode)--> Go to change mode in 2nd session)
10-23-2015 12:13 PM
What is happening is pretty standard set by SAP and the correct way to handle table maintenance.
If you want to give more than One user to modify the same table data , I would suggest to go fora custom solution instead of playing with standard lock concept. So create separate maintenance program and ask user to use that instead of SM30.
R
10-23-2015 12:37 PM
Hi Dipin,
in se11 you have to create two different maintenance view for same table and generate TMG for that,
or you have to create module pool and save data using insert / update query, in Module pool do not use
Enque and Deque, Standard never allow you to edit simultaneously in more than one
editor.
10-23-2015 4:02 PM