Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Table level lock not working

former_member212001
Participant
0 Likes
2,200

Hi,

Row level locking by creating lock objects is working but entire table level locking is not working.

I have used Function module ENQUEUE_E_TABLE and DEQUEUE_E_TABLE which is not working for locking the entire table

Since I am doing insertion alone in the table always.

Please let me know if any function module exists.

Thanks & Regards,

Priya


11 REPLIES 11
Read only

ramkumar007
Participant
0 Likes
1,691

Hi,

Type the action is E.

Thanks

RAM

Read only

0 Likes
1,691

Hi Ram,

Even after passing action as E, its same.

After executing function module, sy-subrc eq 0 ( its enqued ) but diectly able to add entries in table in other session.

@Sanjeev,

row level locking is working.

but i need table level locking.

Read only

former_member187748
Active Contributor
0 Likes
1,691

Hi Priya,

while calling both ENQUEUE_E_TABLE and DEQUEUE_E_TABLE

Please modify your entries as shown in this link


Read only

Former Member
0 Likes
1,691

Hi Priya,

It should work in this way!

call function 'ENQUEUE_E_TABLE'
         exporting
           mode_rstable   = 'E'
           tabname        = p_table
         exceptions
           foreign_lock   = 1
           system_failure = 2
           others         = 3.

       if sy-subrc = 0.

*       Modify the database table with these changes
         modify (p_table) from table <dyn_tab_temp>.

         refresh <dyn_tab_temp>.

*       Unlock the table
         call function 'DEQUEUE_E_TABLE'
           exporting
             mode_rstable = 'E'
             tabname      = p_table.

       endif.

Read only

0 Likes
1,691

Hi Kiran,

I have followed the same thing but not working.


after 'ENQUEUE_E_TABLE'

In  if sy-subrc = 0. ( yes sy-sub rc is 0)

In another session I have opened the table in SE 11 , Utilities -> Table contents -> Create entries

Its allowing to create entries eventhough dequeue is not executed.

Please let me know if am doing wrong.

        

Read only

0 Likes
1,691

Hi,

tested, it is working fine for me!  cehck the table name, how you are passing

call function 'ENQUEUE_E_TABLE'

         exporting

           mode_rstable   = 'E'

           tabname        = 'ZAAK_CONTACTS'

         exceptions

           foreign_lock   = 1

           system_failure = 2

           others         = 3.

Read only

0 Likes
1,691

hi Priya,

U tried to check or you actually created an entry. if not try creating bcoz it shud work.

regards,

Read only

0 Likes
1,691

Hi Karan,

CALL FUNCTION 'ENQUEUE_E_TABLE'
EXPORTING
   MODE_RSTABLE         = 'E'
   TABNAME              = 'ZMM_KANBAN_HIST'
*   VARKEY               =
*   X_TABNAME            = ' '
*   X_VARKEY             = ' '
*   _SCOPE               = '2'
*   _WAIT                = ' '
*   _COLLECT             = ' '
EXCEPTIONS
   FOREIGN_LOCK         = 1
   SYSTEM_FAILURE       = 2
   OTHERS               = 3.

    IF sy-subrc EQ 0.

      refresh gt_zmm_kanban_hist.
      CLEAR gs_zmm_kanban_hist_c.
      SELECT * FROM zmm_kanban_hist
             INTO TABLE gt_zmm_kanban_hist.

      IF sy-subrc EQ 0.
        SORT gt_zmm_kanban_hist BY zrecord DESCENDING.
        CLEAR gs_zmm_kanban_hist_c.
        READ TABLE gt_zmm_kanban_hist INTO gs_zmm_kanban_hist_c INDEX 1.
        IF sy-subrc EQ 0.
          gs_zmm_kanban_hist-zrecord = gs_zmm_kanban_hist_c-zrecord + 1.
          INSERT zmm_kanban_hist FROM gs_zmm_kanban_hist.
        ENDIF.
      ELSE.
        gs_zmm_kanban_hist-zrecord = 1.
          INSERT zmm_kanban_hist FROM gs_zmm_kanban_hist.
      ENDIF.


CALL FUNCTION 'DEQUEUE_E_TABLE'
EXPORTING
   MODE_RSTABLE       = 'E'
   TABNAME            = 'ZMM_KANBAN_HIST'.
*   VARKEY             =
*   X_TABNAME          = ' '
*   X_VARKEY           = ' '
*   _SCOPE             = '3'
*   _SYNCHRON          = ' '
*   _COLLECT           = ' '


    ENDIF.

I have used the same like you but am not getting popup with locked message.

Read only

0 Likes
1,691


Hi Kiran,

Created entry with my code changes.

In another session ,

Utilities -> Table contents -> Create entries 

Its allowing to create entries even dequeue function module is not executed.

Read only

0 Likes
1,691

Hi Priya

When you execute your program did you put a breakpoint at sy-subrc if it returns zero then you open another session and try to maintain entry it will show error

Nabheet

Read only

Former Member
0 Likes
1,691


Hi Priya,

              Please follow what ever is suggested by Kiran Kumar. Once you have locked, I suggest you to try closing all other sessions and reopen a new session or even try logging off and logging in.

Hope this helps!

Happy Coding,

Santhosh Yadav