描述:某些单据进行修改时,需要锁定数据
方法步骤:
1、se11:可copy创建新锁 EZSDDH

2、输入需要锁定的主表,锁参数会根据主键自动补填

3、激活后,会生成对应的锁函数
ENQUEUE_EZSDDH :锁定表
DEQUEUE_EZSDDH:解锁表
4、代码使用如下:
FORM frm_lock USING p_mode
p_bukrs
p_zsddh.
IF p_mode = 'L'. "LOCK
CALL FUNCTION 'ENQUEUE_EZSDDH'
EXPORTING
mode_ztyddh = 'E'
mandt = sy-mandt
zsddh = p_zsddh
bukrs = p_bukrs
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.
ELSEIF p_mode = 'U'. "UNLOCK
CALL FUNCTION 'DEQUEUE_EZSDDH'
EXPORTING
mode_ztyddh = 'E'
mandt = sy-mandt
zsddh = p_zsddh
bukrs = p_bukrs.
ENDIF.
ENDFORM.








![[全网首发]2024国赛数学建模ABCE题完整思路+py(matlab)代码+成品论文参考+持续更新](https://img-home.csdnimg.cn/images/20230724024159.png?origin_url=file%3A%2F%2F%2FC%3A%5CUsers%5CASUS%5CAppData%5CLocal%5CTemp%5Cksohtml12064%5Cwps1.jpg&pos_id=XCRKFvdS)










