Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

How to apply lock logic on a z table?

hi gurus,

we want to apply application lock on one of our ztables, the requirements are

when some read an entry, there will be a lock on it, then nobody could read it, until the user closes the applicaiton or after a cetain period of time ,say 1 hours.

thanks and best regards.

Jun

Tags:
replied

hi

use ENQUE_SLEEP FM

check this part of code

DO 360 TIMES.

CALL FUNCTION 'ENQUEUE_EY_YTSD0091'

EXPORTING

mode_ytsd0091 = 'E'

mandt = sy-mandt

yestockpoint = fu_h_tbl_input-yestockpoint

matnr = fu_h_tbl_input-matnr

kunwe = fu_h_tbl_input-kunwe

charg = fu_h_tbl_input-charg

EXCEPTIONS

foreign_lock = 1

system_failure = 2

OTHERS = 3.

IF sy-subrc <> 0.

IF sy-index = 360.

MOVE cns_on TO fc_flg_err.

fc_ctr_wlock = fc_ctr_wlock + 1.

ELSE.

CALL FUNCTION 'ENQUE_SLEEP'

EXPORTING

seconds = 5

EXCEPTIONS

system_failure = 1

OTHERS = 2.

CASE sy-subrc.

WHEN 1.

WHEN OTHERS.

ENDCASE.

ENDIF.

ELSE.

MOVE cns_off TO fc_flg_err .

EXIT.

ENDIF.

ENDDO.

ENDIF.

0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question