当前位置:网站首页>ABAP-SM30删除前检查
ABAP-SM30删除前检查
2022-06-27 17:57:00 【Tab Zhu】
Title
SM30增强-删除前校验
之前发表过一篇关于SM30增强的文章,今天算是一点补充:使用EVENT来实现删除前的检查
一
方法1-增加事件-EVENT
TCODE: SE54 输入视图名称,然后点击环境->事件
添加序号为03的条目,写入包含检查代码的例程名称
保存后,点击编辑器,编写代码
说明:对于下面的代码主要有几点说明:
- EXTRACT-MARK字段为X表示选中了该行
- 文中代码为当CONTEXT = '标准订单'时,MARK = SPACE,同时报出警告不允许删除
- 注意在执行SM30功能前需要激活程序,保存SE54的配置,然后退出,在运行SM30(PS:我在测试的时候一直都是保存,激活程序,没有退出SE54配置界面,测试SM30一直不行,导致我一度怀疑维护事件03不能实现删除前检查的功能) FORM frm_before_delete
FIELD-SYMBOLS <field> TYPE any. FIELD-SYMBOLS <value> TYPE any. DATA ls_zvjxzhu TYPE zvjxzhu_01. DATA lv_message TYPE c. LOOP AT extract. ASSIGN COMPONENT 'MARK' OF STRUCTURE extract TO <field>. IF <field> IS ASSIGNED AND <field> IS NOT INITIAL. ASSIGN COMPONENT 'CONTEXT' OF STRUCTURE extract TO <value>. IF sy-subrc EQ 0 AND <value> = '标准订单'. lv_message = 'X'. clear <field>. MODIFY extract. ENDIF. ENDIF. ENDLOOP. IF lv_message = 'X'. MESSAGE '标准订单不允许删除' TYPE 'I' DISPLAY LIKE 'S'. ENDIF. ENDFORM.
二
方法2-直接在函数组屏幕过程中修改代码
对于这个方法2点说明:
- VIM_MARKED表示是否选择该行
- FUNCTION为当前功能按钮,删除为'DELE'
MODULE delete_before_check INPUT. DATA ls_zvjxzhu TYPE zvjxzhu_01. IF vim_marked NE space AND function = 'DELE'. IF zvjxzhu_01-context = '标准订单'. CLEAR vim_marked. ENDIF. ENDIF. ENDMODULE.
第一种方法的效果如下图:点击删除按钮
边栏推荐
- 【云驻共创】高校数字化差旅建设“解决之道”
- 广发期货开户安全吗?
- Minmei new energy rushes to Shenzhen Stock Exchange: the annual accounts receivable exceeds 600million and the proposed fund-raising is 450million
- 网络传输是怎么工作的 -- 详解 OSI 模型
- 基于STM32F103ZET6库函数蜂鸣器实验
- openssl客户端编程:一个不起眼的函数导致的SSL会话失败问题
- 【登录界面】
- Market status and development prospect forecast of phenethyl resorcinol for skin care industry in the world in 2022
- 形参的默认值-及return的注意事项-及this的使用-和箭头函数的知识
- 深度学习和神经网络的介绍
猜你喜欢
实战回忆录:从Webshell开始突破边界
Crawl national laws and Regulations Database
新中大冲刺科创板:年营收2.84亿 拟募资5.57亿
SQL Server - Window Function - 解决连续N条记录过滤问题
MySQL表的增删改查(基础)
OpenSSL client programming: SSL session failure caused by an obscure function
工作流自动化 低代码是关键
MySQL初学者福利
What is ICMP? What is the relationship between Ping and ICMP?
数仓的字符截取三胞胎:substrb、substr、substring
随机推荐
在线文本按行批量反转工具
NVIDIA Clara-AGX-Developer-Kit installation
Cdga | what is the core of digital transformation in the transportation industry?
《第五项修炼》(The Fifth Discipline):学习型组织的艺术与实践
Is it safe to buy stocks and open an account on the account opening link of the securities manager? Ask the great God for help
Core dynamic Lianke rushes to the scientific innovation board: with an annual revenue of 170million yuan, Beifang Electronics Institute and Zhongcheng venture capital are shareholders
Market status and development prospect of resorcinol derivatives for skin products in the world in 2022
Running lantern experiment based on stm32f103zet6 library function
MySQL表的增删改查(基础)
经纬度分析
Current market situation and development prospect forecast of global 3,3 ', 4,4' - biphenyltetracarboxylic dianhydride industry in 2022
形参的默认值-及return的注意事项-及this的使用-和箭头函数的知识
Mathematical derivation from perceptron to feedforward neural network
金源高端IPO被终止:曾拟募资7.5亿 儒杉资产与溧阳产投是股东
openssl客户端编程:一个不起眼的函数导致的SSL会话失败问题
网络传输是怎么工作的 -- 详解 OSI 模型
PCB线路板蛇形布线要注意哪些问题?
深度学习和神经网络的介绍
Minmei new energy rushes to Shenzhen Stock Exchange: the annual accounts receivable exceeds 600million and the proposed fund-raising is 450million
Labelimg usage guide