文章目录
1.基本介绍
SAP的基本屏幕元素定义语句包括: SELECT-OPTIONS, PARAMETERS, SELECTION-SCREEN.
2.SELECT-OPTIONS:
SELECT-OPTIONS:DATA FOR SY-DATUM.
出现以下是样的提示(效果)
3.PARAMETERS:
可以参照数据字典具体字段或自定义数据类型创建文本输入域以及单选框/复选框。
PARAMETERS:MATNR LIKE MARA-MATNR.
PARAMETERS:TYPE AS CHECKBOX.
PARAMETERS:P1 RADIOBUTTON GROUP GRP1 DEFAULT'X',
P2 RADIOBUTTON GROUP GRP1,
P3 RADIOBUTTON GROUP GRP1.
4.SELECTION-SCREEN
用于创建屏幕的框架结构,主要包括屏幕元素的创建,子屏幕的创建等。
CALL SCREEN 123
STARTING AT 10 10
ENDING AT 80 10.
SELECTION-SCREEN BEGIN OF SCREEN 123 AS WINDOW TITLE TEXT-A01.
PARAMETERS:MATNR LIKE MARA-MATNR.
PARAMETERS:TYPE AS CHECKBOX.
SELECTION-SCREEN END OF SCREEN 123.
5.INITIALIZATION事件
这个是对于所定义屏幕元素进行初始化赋值。
REPORT Z_HELLOWORLD.
PARAMETERS QUAL_DAY TYPE D DEFAULT SY-DATUM.
INITIALIZATION.
QUAL_DAY+6(2) ='01'.
QUAL_DAY = QUAL_DAY - 1.
6.START-OF-SELECTION
在单击执行按钮后触发该事件。
REPORT Z_HELLOWORLD.
PARAMETERS QUAL_DAY TYPE D DEFAULT SY-DATUM.
INITIALIZATION.
QUAL_DAY+6(2) ='01'.
QUAL_DAY = QUAL_DAY - 1.
START-OF-SELECTION.
WRITE:'DATE:',QUAL_DAY.
7.END-OF-SELECTION
该事件应用于所有数据处理完成,即START-OF-SELECTION相关事件执行完成,但输出屏幕还未显示之前。
PARAMETERS QUAL_DAY TYPE D DEFAULT SY-DATUM.
INITIALIZATION.
QUAL_DAY+6(2) ='01'.
QUAL_DAY = QUAL_DAY - 1.
START-OF-SELECTION.
WRITE:'DATE:',QUAL_DAY.
END-OF-SELECTION.
IF QUAL_DAY <> SYST-DATUM.
WRITE:'Today:',SYST-DATUM.
ENDIF.