Application Development 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: 

How to Lock a Table?

Former Member
0 Kudos

Hi Friends

I want to know how to lock a table manually...

For example, I want to lock this table T000 so that no one should access this....

can someone explain me step by step plss

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi

According to me, if you donot want anybody to change the table T000 as it is changed occasionally.

Then you can do this by this method (after creating all the clients)

Tcode SE11 -> Change -> Enter table name T000 -> Go to Tab "Delivery and Maintenance" ->

Change the option to "Display/Maintenance not allowed".

It would not let any users to do anything with the table.

-


But I found this one on Internet explorer.

We can use the function modules ENQUEUE_E_TABLE for locking tables and the function module DEQUEUE_E_TABLE for unlocking tables. With this method, we don't need to lock objects in order to lock the tables. In other words, any table can be locked/unlocked using these function modules.

report zsubhas_enqueue.

  • testing the locking of tables...

data:

varkey like rstable-varkey.

varkey = sy-mandt.

  • locking the tables............................

call function 'ENQUEUE_E_TABLE'

exporting

  • MODE_RSTABLE = 'E'

tabname = 'MARA'

varkey = varkey

  • X_TABNAME = ' '

  • X_VARKEY = ' '

  • _SCOPE = '2'

  • _WAIT = ' '

  • _COLLECT = 'X'

exceptions

foreign_lock = 1

system_failure = 2

others = 3

.

case sy-subrc.

when 1.

message i184(bctrain) with 'Foreignlock'.

when 2.

message i184(bctrain) with 'system failure'.

when 0.

message i184(bctrain) with 'success'.

when others.

message i184(bctrain) with 'others'.

endcase.

  • unlocking the table...............

call function 'DEQUEUE_E_TABLE'

exporting

  • MODE_RSTABLE = 'E'

tabname = 'MARA'

varkey = varkey

  • X_TABNAME = ' '

  • X_VARKEY = ' '

  • _SCOPE = '3'

  • _SYNCHRON = ' '

  • _COLLECT

-


Also try this blog

Thanks

2 REPLIES 2

Former Member
0 Kudos

Hi

According to me, if you donot want anybody to change the table T000 as it is changed occasionally.

Then you can do this by this method (after creating all the clients)

Tcode SE11 -> Change -> Enter table name T000 -> Go to Tab "Delivery and Maintenance" ->

Change the option to "Display/Maintenance not allowed".

It would not let any users to do anything with the table.

-


But I found this one on Internet explorer.

We can use the function modules ENQUEUE_E_TABLE for locking tables and the function module DEQUEUE_E_TABLE for unlocking tables. With this method, we don't need to lock objects in order to lock the tables. In other words, any table can be locked/unlocked using these function modules.

report zsubhas_enqueue.

  • testing the locking of tables...

data:

varkey like rstable-varkey.

varkey = sy-mandt.

  • locking the tables............................

call function 'ENQUEUE_E_TABLE'

exporting

  • MODE_RSTABLE = 'E'

tabname = 'MARA'

varkey = varkey

  • X_TABNAME = ' '

  • X_VARKEY = ' '

  • _SCOPE = '2'

  • _WAIT = ' '

  • _COLLECT = 'X'

exceptions

foreign_lock = 1

system_failure = 2

others = 3

.

case sy-subrc.

when 1.

message i184(bctrain) with 'Foreignlock'.

when 2.

message i184(bctrain) with 'system failure'.

when 0.

message i184(bctrain) with 'success'.

when others.

message i184(bctrain) with 'others'.

endcase.

  • unlocking the table...............

call function 'DEQUEUE_E_TABLE'

exporting

  • MODE_RSTABLE = 'E'

tabname = 'MARA'

varkey = varkey

  • X_TABNAME = ' '

  • X_VARKEY = ' '

  • _SCOPE = '3'

  • _SYNCHRON = ' '

  • _COLLECT

-


Also try this blog

Thanks

Former Member
0 Kudos

Hello Rakesh,

refer this link for more about locks:

http://help.sap.com/saphelp_nw04/helpdata/en/7b/f9813712f7434be10000009b38f8cf/frameset.htm

Regards,

Raju.