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

Modifying a Z table and 'ENQUEUE_E_TABLE'

Former Member
0 Likes
6,658

Hello,

I am updating/modifying/deleting the records from a Z table. I am thinking to use the standard FMs 'ENQUEUE_E_TABLE' and 'DEQUEUE_E_TABLE' while am working with it.

Or do i need to create a lock object and use that lock object, while am working with this Z table in my prog.?

When i have to use 'ENQUEUE_E_TABLE' and 'DEQUEUE_E_TABLE' FMs and when i have to use a lock object?

Thank you

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
3,865

Hello,

You do not to create lock object. You can lock the table with 'ENQUEUE_E_TABLE' and unlock with 'DEQUEUE_E_TABLE'.

CALL FUNCTION 'ENQUEUE_E_TABLE'

EXPORTING

MODE_RSTABLE = W_MODE

TABNAME = W_TABLE

VARKEY = W_VARKEY

_SCOPE = '3'

EXCEPTIONS

FOREIGN_LOCK = 1

SYSTEM_FAILURE = 2.

Thanks,

Venu

2 REPLIES 2
Read only

Former Member
0 Likes
3,866

Hello,

You do not to create lock object. You can lock the table with 'ENQUEUE_E_TABLE' and unlock with 'DEQUEUE_E_TABLE'.

CALL FUNCTION 'ENQUEUE_E_TABLE'

EXPORTING

MODE_RSTABLE = W_MODE

TABNAME = W_TABLE

VARKEY = W_VARKEY

_SCOPE = '3'

EXCEPTIONS

FOREIGN_LOCK = 1

SYSTEM_FAILURE = 2.

Thanks,

Venu

Read only

naveen_inuganti2
Active Contributor
0 Likes
3,865

Hi,

Yes, there is no need to go for Lock object. Just check this code:

call function 'ENQUEUE_E_TABLE'
        EXPORTING
          mode_rstable   = 'E'
          tabname        = 'ZTABLE'
        EXCEPTIONS
          foreign_lock   = 1
          system_failure = 2
          others         = 3.
      if sy-subrc = 0.
        modify ZTABLE from table itab.
        if sy-subrc = 0.
          commit work.
        endif.
        call function 'DEQUEUE_E_TABLE'
          EXPORTING
            mode_rstable = 'E'
            tabname      = 'ZTABLE'.
      endif.

http://wiki.sdn.sap.com/wiki/display/Snippets/lockingandunlocking+tables

Thanks,

Naveen Inuganti