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

problems with locking the table

Former Member
0 Likes
314

Hi friends,

please look into the following code

DATA : lw_time TYPE t,

lw_wait_time TYPE t VALUE '001000',

lw_date TYPE d,

lw_uname LIKE sy-msgv1.

CLEAR: lw_time, lw_date.

  • Get cumulative total for condition record

  • Lock the table first; unlock takes places in USEREXIT_SAVE_DOCUMENT:

CALL FUNCTION 'ENQUEUE_EZ_QUANT'

EXPORTING

mode_zsd_quotas_quant = 'E'

mandt = sy-mandt

knumh = xkomv-knumh

  • X_KNUMH = ' '

  • _SCOPE = '2'

_wait = 'X'

  • _COLLECT = ' '

EXCEPTIONS

foreign_lock = 1

system_failure = 2

OTHERS = 3.

IF sy-subrc <> 0.

  • Try to set the lock on the record for next 10 minutes.

  • If still you don't then raise the error message.

GET TIME.

  • To add 10 minutes to the existing time, we can use the following

  • function module 'DIMP_ADD_TIME'

CALL FUNCTION 'DIMP_ADD_TIME'

EXPORTING

iv_starttime = sy-uzeit

iv_startdate = sy-datum

iv_addtime = lw_wait_time

IMPORTING

ev_endtime = lw_time

ev_enddate = lw_date.

WHILE sy-uzeit LT lw_time.

CALL FUNCTION 'ENQUEUE_EZ_QUANT'

EXPORTING

mode_zsd_quotas_quant = 'E'

mandt = sy-mandt

knumh = xkomv-knumh

  • X_KNUMH = ' '

  • _SCOPE = '2'

_wait = 'X'

  • _COLLECT = ' '

EXCEPTIONS

foreign_lock = 1

system_failure = 2

OTHERS = 3.

IF sy-subrc = 0.

CLEAR lw_time.

EXIT.

ENDIF.

ENDWHILE.

IF sy-uzeit >= lw_time AND sy-subrc NE 0.

MOVE sy-msgv1 TO lw_uname.

MESSAGE e064(zsdsls) WITH

'User' lw_uname 'is locking the table ZSD_quant.

ENDIF.

ENDIF.

......................

the problem here is i am not getting the error message when i run the transacton VA02 and wait for 10minutes . But when i run VA02 ,debug and reach the error message i am getting the message exactly after 10 minutes. please help me what could be the problem

1 REPLY 1
Read only

andreas_mann3
Active Contributor
0 Likes
286

better use abap command wait :

WAIT UP TO time SECONDS.

A.