‎2009 Jul 07 6:48 AM
hello experts,
i am facing a problem in ALV grid output (editable) - when user editing and saving data into the ztable - other user should not able to save the data and error msg to be displayed.
i am using the function modules for locking the whole table - enqueue_eztable and dequeue_eztable. i can see the table as locked in sm12, but i can also do the updating and save data.
is there anyother function module to work with?
another way i am doing is -
DATA: text4 TYPE c,
text5 TYPE c.
IMPORT text4 TO text5 FROM MEMORY ID 'Y222'.
IF sy-subrc = 0.
IF text5 = 'X'.
MESSAGE e000(z1) WITH 'SOME USER IS ACCESSING THE PROGRAM'.
ENDIF.
ELSE.
EXPORT text4 = 'X' TO MEMORY ID 'Y222'.
PERFORM update_dbase.
FREE MEMORY ID 'Y222'.
ENDIF.this method also not working.
plz help me, how to avoid other user accessing the data when another user is working on it?
thanks.
‎2009 Jul 07 6:55 AM
Hi,
Create lock object for the table and use below method
Lock Table ZWMDASHBOARD
CALL FUNCTION 'ENQUEUE_EZWMDASHBOARD'
EXPORTING
mode_zwmdashboard = 'E'
mandt = sy-mandt
EXCEPTIONS
foreign_lock = 1
system_failure = 2
OTHERS = 3.
IF sy-subrc <> 0.
RAISE unable_to_lock. " Exception
ELSE.
Modify Table ZWMDASHBOARD.
MODIFY zwmdashboard FROM TABLE t_zwmdashboard[].
IF sy-subrc <> 0.
Do Nothing
ENDIF.
Unlock table ZWMDASHBOARD.
CALL FUNCTION 'DEQUEUE_EZWMDASHBOARD'
EXPORTING
mode_zwmdashboard = 'E'
mandt = sy-mandt.
ENDIF.
Hope this helps..
‎2009 Jul 08 9:51 AM
HI,
It is always better to use ENQUEUE/DEQUEUE for locking/unlocking functionality
If you want to use the memory ID, you can use the below format
IMPORT text4 TO text5 FROM MEMORY ID 'Y222'. (Here you will get values to text5 )
EXPORT text4 FROM text5 TO MEMORY ID 'Y222'. (Value of text5 will be stored to Memory ID)
Regards,
Seema