增强RSR00001:
i_step = 3.
CLEAR:ls_msg,lt_msg.
IF i_s_rkb1d-compid = ‘ZM_BCS01_Q001‘.
READ TABLE i_t_var_range TRANSPORTING NO FIELDS
WITH KEY iobjnm = ‘0COMP_CODE‘.
IF sy-subrc = 0.
READ TABLE i_t_var_range TRANSPORTING NO FIELDS
WITH KEY iobjnm = ‘0CS_GROUP‘.
IF sy-subrc = 0.
ls_msg-msgty = ‘E‘.
ls_msg-msgid = ‘RSAR‘.
ls_msg-msgno = ‘051‘.
ls_msg-msgv1 = ‘合并层级与公司代码不能同时输入‘.
APPEND ls_msg TO lt_msg.
ENDIF.
ELSE.
READ TABLE i_t_var_range TRANSPORTING NO FIELDS
WITH KEY iobjnm = ‘0CS_GROUP‘.
IF sy-subrc NE 0.
ls_msg-msgty = ‘E‘.
ls_msg-msgid = ‘RSAR‘.
ls_msg-msgno = ‘051‘.
ls_msg-msgv1 = ‘合并层级与公司代码必须至少输入一个‘.
APPEND ls_msg TO lt_msg.
ENDIF.
ENDIF.
IF lt_msg IS NOT INITIAL.
CALL FUNCTION ‘RRMS_MESSAGES_INPUT‘ "重点使用这个函数将消息抛出去
EXPORTING
i_t_msg = lt_msg
EXCEPTIONS
dummy = 1
OTHERS = 2.
RAISE 1. "Raise不能少,否则消息不会显示
ENDIF.
ENDIF.