问题就如下面的网址所描述的,在VK11时,做一些检查,然后返回给用户某些消息
https://forums.sdn.sap.com/message.jspa?messageID=655894
解决办法:
参考这里的代码:http://forums.sdn.sap.com/thread.jspa?threadID=1687027
DATA: BEGIN OF num_wa ,
old_number TYPE konh-knumh,
new_number TYPE konh-knumh,
END OF num_wa.
DATA: num_tab LIKE TABLE OF num_wa.
FIELD-SYMBOLS: <fs_num> TYPE ANY TABLE.
DATA: lw_var(40) TYPE c.
*******某些判断,如果出现错误*******
MESSAGE s015 DISPLAY LIKE 'E' WITH var1 var2.
"删除主程序中取条件记录号的内表的数据
lw_var = '(SAPMV13A)NUMBER_CHANGE[]'.
ASSIGN (lw_var) TO <fs_num>.
IF sy-subrc = 0 AND <fs_num> IS ASSIGNED.
num_tab = <fs_num>.
REFRESH num_tab.
ENDIF.
<fs_num> = num_tab.
LEAVE TO SCREEN sy-dynnr.
这样虽然解决了在返回屏幕后还能更改数据的操作,但是会造成条件记录号浪费的情况
就是在上面的网址中所描述的那样,在主程序中每次都会取新的条件记录号。修改数据
时取到的条件记录号将会被浪费掉。
如果你有更好的办法解决这个问题,请与我联系。谢谢
附:
In BADI SD_COND_SAVE_A implementation, a validation check is added to prevent pricing condition from saving if the price entered is lower than the standard price of the material and an error message is issued using Message EXXX to indicate the error to the user. However, in the case of the validation check does fail, after the error message is issued, if user presses enter key or back key to re-activate the field for re-entering data, a cancel popup window is displayed with the error message (from message class NR number 001). Then, the transaction is terminated and user loses all data entered previously.