SAP 爱好者,记录一些知识点吧
分类:
2009-12-28 17:53:06
需求:在选择屏幕上ANLN1,ANLN2,BUKRS 这个三个字段要么同时都有输入,要么都没有输入,如果只输入其中一个,跳出一个message 提醒用户输入其余的参数,请看下面的代码就可以实现该功能了:
TABLES: sscrfields.
AT SELECTION-SCREEN.
IF sscrfields-ucomm = 'ONLI' OR
sscrfields-ucomm = 'PRIN' OR
sscrfields-ucomm = 'SJOB'.
PERFORM validate_input_para.
ENDIF.
FORM validate_input_para .
*** Validation Rule 1: The full asset number/sub number/company code must
*** be provided. Otherwise the fields should all be
*** blank.
IF NOT ( ( p_anln1 IS INITIAL AND
p_anln2 IS INITIAL AND
p_bukrs IS INITIAL ) OR
( NOT p_anln1 IS INITIAL AND
NOT p_anln2 IS INITIAL AND
NOT p_bukrs IS INITIAL ) ).
*** Issue an error message
*** Additional Code is required to display a message indicating
*** the parameters are not entered properly
IF p_anln1 IS INITIAL.
MESSAGE i000 WITH 'Asset Number need to be entered'.
LEAVE SCREEN.
ELSEIF p_anln2 IS INITIAL.
MESSAGE i000 WITH 'Sub Number need to be entered'.
LEAVE SCREEN.
ELSEIF p_bukrs IS INITIAL.
MESSAGE i000 WITH 'Company Code need to be entered'.
LEAVE SCREEN.
ENDIF.
ENDIF.
ENDFORM. " VALIDATE_INPUT_PARA