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

Lock Object

Former Member
0 Likes
702

Hi,

Can we create a lock on any data base object with out creating a lock object. i.e is there any generic way to lock data base objects?

Thanks.

1 ACCEPTED SOLUTION
Read only

andreas_mann3
Active Contributor
0 Likes
573

yes,

try fm ENQUEUE_E_TABLE

example:

  sptab-tabname = 'ZTAB001'.
  sptab-varkey  = sy-mandt.
*
  CALL FUNCTION 'ENQUEUE_E_TABLE'
       EXPORTING
            tabname        = sptab-tabname
            varkey         = sptab-varkey
       EXCEPTIONS
            foreign_lock   = 1
            system_failure = 2
            OTHERS         = 3.

  IF sy-subrc <> 0.
    MESSAGE x030(zzz1) WITH sptab-tabname.
  ENDIF.

Andreas

3 REPLIES 3
Read only

andreas_mann3
Active Contributor
0 Likes
574

yes,

try fm ENQUEUE_E_TABLE

example:

  sptab-tabname = 'ZTAB001'.
  sptab-varkey  = sy-mandt.
*
  CALL FUNCTION 'ENQUEUE_E_TABLE'
       EXPORTING
            tabname        = sptab-tabname
            varkey         = sptab-varkey
       EXCEPTIONS
            foreign_lock   = 1
            system_failure = 2
            OTHERS         = 3.

  IF sy-subrc <> 0.
    MESSAGE x030(zzz1) WITH sptab-tabname.
  ENDIF.

Andreas

Read only

0 Likes
573

fm used...<b>ENQUEUE_E_TABLE</b>

ex...

*----


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

refer for more....

Read only

Former Member
0 Likes
573

Hi,

To lock and unlock the data base 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

Regards,