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

how to know whether the table has been locked using lock objects

Former Member
0 Likes
868

Hi,

how to know whether the table has been locked or not when we are executing and modifying the DB table.

I created the program and used the enqueue and dequeue fm for respective tables. But how do i know whether the table is locked at runtime

regards

Mac

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
839

You can see locks via transaction SM12

Hi,

how to know whether the table has been locked or not when we are executing and modifying the DB table.

I created the program and used the enqueue and dequeue fm for respective tables. But how do i know whether the table is locked at runtime

regards

Mac

6 REPLIES 6
Read only

Former Member
0 Likes
840

You can see locks via transaction SM12

Read only

0 Likes
839

hi,

use fm ENQUEUE_E_TABLE

A.

Read only

0 Likes
839

Hi,

I have tried the t.code and given the table name but it does not show any locked tables.

I want to know that the table is been locked while executing the program.

my code is in this manner. If found any thing wrong please help me

CALL FUNCTION 'ENQUEUE_E_EASTE'

EXPORTING

MODE_EASTE = 'E'

MANDT = SY-MANDT

LOGIKZW = p_logikz

AB = p_ab

  • X_LOGIKZW = ' '

  • X_AB = ' '

  • _SCOPE = '2'

_WAIT = 'X'

  • _COLLECT = ' '

EXCEPTIONS

FOREIGN_LOCK = 1

SYSTEM_FAILURE = 2

OTHERS = 3

.

IF sy-subrc <> 0.

MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

*MODIFY consuption value with new consumption

w_easte-perverbr = p_pervbr .

MODIFY easte FROM w_easte .

IF SY-SUBRC NE 0.

MESSAGE s968(/vfs/biljett) WITH 'EASTE' .

ELSE.

MESSAGE s969(/vfs/biljett) WITH 'EASTE'.

ENDIF.

*UNLOCK the TABLE EASTE.

CALL FUNCTION 'DEQUEUE_E_EASTE'

EXPORTING

  • MODE_EASTE = 'E'

MANDT = SY-MANDT

LOGIKZW = p_logikz

AB = p_ab

    • X_LOGIKZW = ' '

    • X_AB = ' '

    • _SCOPE = '3'

_SYNCHRON = 'X'

    • _COLLECT = ' '

.

    • Commit Work

COMMIT WORK.

regards

mac

Read only

0 Likes
839

Hello

I know how to create and use the lock objects .

I want to find out is my table getting locked during runtime of my program

Mac

Read only

0 Likes
839

Hi, put a break point after the ENQUEUE function module and before the DEQUEUE.

CALL FUNCTION 'ENQUEUE_E_EASTE'
EXPORTING
MODE_EASTE = 'E'
MANDT = SY-MANDT
LOGIKZW = p_logikz
AB = p_ab
* X_LOGIKZW = ' '
* X_AB = ' '
* _SCOPE = '2'
_WAIT = 'X'
* _COLLECT = ' '
EXCEPTIONS
FOREIGN_LOCK = 1
SYSTEM_FAILURE = 2
OTHERS = 3
.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.

<b>BREAK-POINT.</b>


*MODIFY consuption value with new consumption
w_easte-perverbr = p_pervbr .

MODIFY easte FROM w_easte .

IF SY-SUBRC NE 0.
MESSAGE s968(/vfs/biljett) WITH 'EASTE' .
ELSE.
MESSAGE s969(/vfs/biljett) WITH 'EASTE'.
ENDIF.


*UNLOCK the TABLE EASTE.

CALL FUNCTION 'DEQUEUE_E_EASTE'
EXPORTING
* MODE_EASTE = 'E'
MANDT = SY-MANDT
LOGIKZW = p_logikz
AB = p_ab
** X_LOGIKZW = ' '
** X_AB = ' '
** _SCOPE = '3'
_SYNCHRON = 'X'
** _COLLECT = ' '
.
** Commit Work
COMMIT WORK

Now when the program stops in debug mode, open another session and to to SM12, Enter you user id in the field on the screen and hit enter, your lock should be there.

Regards,

Rich Heilman

Read only

0 Likes
839

ENQUEUE_READ would give the list of objects that are currently locked by a specific user.

Regards,

ravi