首页 > ABAP 加锁与解锁-ty

ABAP 加锁与解锁-ty

互联网 2021-04-21 12:50:23

具體加鎖及解鎖的使用可參考以下代碼:(Table:ZTESTING,key: fieldKey)

加鎖:form lock_record using p_key.data: it_seqg3 type seqg3 occurs 01 with header line.data: gname like seqg3-gname, garg like seqg3-garg.data: begin of %ZTESTING,mandt type ZTESTING-mandt,fieldkey type ZTESTING-fieldkey,end of %ZTESTING.

call 'C_ENQ_WILDCARD' id 'HEX0' field %ZTESTING.

move sy-mandt to: %ZTESTING-mandt.

if not p_key is initial.move p_key to: %ZTESTING-fieldkey.endif.

gname = 'ZTESTING'.garg = %ZTESTING.

call function 'ENQUEUE_READ'exportinggclient = sy-mandtgname = gnamegarg = gargtablesenq = it_seqg3.

if sy-subrc0.message id sy-msgid type sy-msgty number sy-msgno with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.endif.

if it_seqg3 is not initial.data:cmessage(100) type c.concatenate p_key '正由' it_seqg3-guname '處理!' into cmessage.condense cmessage.message cmessage type 'E'.

else.

call function 'ENQUEUE_EZTESTING'exportingmode_ztesting = 'E'mandt = sy-mandtzfieldkey = p_keyx_zfieldkey = ' '_scope = '2'_wait = ' '_collect = ' 'exceptionsforeign_lock = 1system_failure = 2others = 3.if sy-subrc0.message id sy-msgid type sy-msgty number sy-msgno with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.endif.

endif.endform.

解鎖:form unlock_record using p_key.call function 'DEQUEUE_EZTESTING'exportingmode_ztesting = 'E'mandt = sy-mandtzfieldkey = p_keyx_zfieldkey = ' '_scope = '3'_synchron = ' '_collect = ' '.

endform.

免责声明:非本网注明原创的信息,皆为程序自动获取互联网,目的在于传递更多信息,并不代表本网赞同其观点和对其真实性负责;如此页面有侵犯到您的权益,请给站长发送邮件,并提供相关证明(版权证明、身份证正反面、侵权链接),站长将在收到邮件12小时内删除。

一周热门

查看更多