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

Function Module to lock the Table

Former Member
0 Likes
8,665

Hi,

I am using Function Module ENQUEUE_E_TABLE and DEQUEUE_E_TABLE for locking PNWTYH table but the table is not getting locked...

Please tell me the reason and also tell me if there is any other Function Module to lock the table.

Thanks,

Amol

5 REPLIES 5
Read only

Former Member
0 Likes
2,880

hI,

Good ... check out the following documentation

Lock objects are used to lock the database table while making the modifications on the database table.

you can create your own lock objects using SE11.

if you create lock objects on any table system will create two function modules.

1.ENQUEUE....

2.DEQUEUE.....

first one is used to lock the table

second one used to removing lock on the table.

*----


lock Table

CALL FUNCTION 'ENQUEUE_E_TABLE'

EXPORTING

tabname = table_name

EXCEPTIONS

foreign_lock = 1

system_failure = 2

OTHERS = 3.

*----


Unlock Table

CALL FUNCTION 'DEQUEUE_E_TABLE'

EXPORTING

tabname = table_name

check this link :

http://help.sap.com/saphelp_40b/helpdata/en/cf/21eea5446011d189700000e8322d00/content.htm

_SCOPE = 1: The lock is not sent to the update program. The lock is removed when the transaction is ended.

_SCOPE = 2: The lock is sent to the update program. The update program is responsible for removing the lock. The dialog program which requested the lock no longer has an influence on the lock behavior. This is the standard setting for the ENQUEUE function module.

_SCOPE = 3: The lock

Managingin lock entries

http://help.sap.com/saphelp_nw04/helpdata/en/37/a2e3ae344411d3acb00000e83539c3/frameset.htm

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

http://help.sap.com/saphelp_nw04/helpdata/en/cb/168237d30d974be10000009b38f8cf/frameset.htm

Thanks.

Read only

0 Likes
2,880

I will definitely provide you full reward points if you solve the problem.

Could you please check the Function Module <b>ENQUEUE_E_TABLE</b> for any of table and let me know if it is working fine....since it is not working fine with me.

Regards,

Amol

Read only

0 Likes
2,880

hi

good

check with this report

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 = ' '

.

thanks

mrutyun^

Read only

0 Likes
2,880

Hey could you please Test the FM -> ENQUEUE_E_TABLE seperately in SE37

and let me know if it is working fine

Regards,

Amol