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 comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

3 Answers

  • Best Answer
    avatar image
    Former Member
    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 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

  • 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 comment
    10|10000 characters needed characters exceeded

  • Oct 23, 2015 at 03:02 PM

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

    Add comment
    10|10000 characters needed characters exceeded