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

ABAP LOCK TABLE

Former Member
0 Likes
862

hi

i have a problem about lock table now .

i have a program(A) to LOCK TABLE ZSTUDENT.

NOW program(A) have locked TABLE ZSTUDENT ,before TABLE ZSTUDENT was unlocked, i open anther program(B) to lock TABLE ZSTUDENT,now sy-subrc mustn't be 0, now i hope the program(B) could wait until program(A) unlock TABLE ZSTUDENT ,how should i do?

if program(A) lock the TABLE ZSTUDENT for 20mins,i hope program(B) could wait for 20mins.

thanks.

2 REPLIES 2
Read only

Former Member
0 Likes
460

Hello,

Use the below function module. Then sy-subrc will not be 0 when called from program B.

CALL FUNCTION 'ENQUEUE_E_TABLES'

EXPORTING

mode_rstable = 'E'

tabname = <table name>

EXCEPTIONS

foreign_lock = 1

system_failure = 2

OTHERS = 3.

In program B, you can call this in Do - EndDo and exit when sy-subrc is 0

Regards,

Janani

Edited by: janani chakrapani on Jan 8, 2010 1:42 PM

Read only

MarcinPciak
Active Contributor
0 Likes
460

In program B check if table is unlocked each minute. If so proceed the processing


"program B
do.
  "check if table unlocked
  if sy-subrc = 0.
    exit.  "exit to proceed furhter
  else.
   wait up to 60 seconds.
  endif.
enddo.

....

Regards

Marcin