Subject: RE: Validate data in maintanence view
SM30的Maintenance View是通过SE11里面的工具生成的,所有的显示和增删改查的逻辑都是自动生成的代码,通常这些代码在和Maintenance View同名的Function Group里面。
Function Group: CRMV_PR_SUBSTRAC

同时SAP提供了一些事件可以加到Maintenance View让USER可以自定义一些逻辑,进入上面的Table Maintenance Generator之后,再进入下面的Menu:

Maintenance View支持事件: http://help.sap.com/saphelp_47x200/helpdata/en/91/ca9f0ea9d111d1a5690000e82deaaa/frameset.htm
每个事件是一个Sub Routine, 工具自动生成的代码预留了调用这些Sub Routine的地方,其中有一个事件是’Before Save Data to Database’,我觉得这个事件是最适合验证数据的地方.

把验证逻辑写完之后,可以验证用户输入的数据是否和Allow Product Set type Change里面的数据冲突,也可以提示用户Error Message.
Input data.

Save


现在的问题是,Save之后,用户正在编辑的行灰掉了,不能重新点击Change继续编辑,只能回退,取消Save.
我研究得出的原因是,系统生成打代码调用了用户自定义的事件之后,不管结果如何,都会执行后续的逻辑,所以Screen无法停留在刚才的状态。而且所有的控制都是由系统生成代码完成,USER无法干预。
要获取更多Jerry的原创文章,请关注公众号"汪子熙":

网友评论