Skip to Content

Data locked by user ( display only)

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.

data.png (24.1 kB)
Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

3 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Oct 23, 2015 at 11:01 AM

    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?

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member Dipin Munjal

      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

  • Posted on Oct 23, 2015 at 11:37 AM

    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.

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Oct 23, 2015 at 03:02 PM

    Thank you.. Issue resolved by using the FM Dequeue_all.

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.