标签:
SELECT-SCREEN语句用于创建屏幕的框架结构,主要包括屏幕元素的创建、子屏幕的创建等。子程序主要分为两种,一种为Include Screen,可以通过Report端程序直接调用;另一种为SubScreen,需要通过Screen Painter所创建的屏幕调用。SELECT-SCREEN具体的应用语法如下:
(1)SELECTION-SCREEN BEGIN OF SCREEN src.
.......
SELECTION-SCREEN END OF SCREEN src.
该语法用于定义一个INCLUDE SUREEN,可通过CALL方法在Report程序中引用,CALL屏幕窗体时加入STARTING AT ... ENDING AT ...参数可以将所定义屏幕窗体作为一个新的对话框窗体来引用,并指定期创建的具体大小及位置,如下代码所示:
REPORT ZZWEISTSCREEN.
SELECTION-SCREEN BEGIN OF SCREEN 1314 AS WINDOW TITLE TEXT-W01. "TEXT-W01为对话框的标题,在文本符号中可以设置
PARAMETERS:MATNR LIKE MARA-MATNR.
PARAMETERS:T AS CHECKBOX.
SELECTION-SCREEN END OF SCREEN 1314.
CALL SCREEN 1314 STARTING AT 30 5 ENDING AT 90 5. "调用SELECTION-SCREEN
程序执行结果如下:
需要注意的是,此时窗体的名称必须为Numeric(数字)类型的的,如将上面代码中的1314改为myscreen,那么程序将提示以下错误:
注意:当从一个主屏幕中来调用其程序中的另一窗体时,必须使用CALL SELECTION-SCREEN方法,如下通过SELECTION-SCREEN调用Include Screen。
REPORT ZZWEISTSCREEN.
PARAMETERS:T AS CHECKBOX. "第一个窗体元素
CALL SELECTION-SCREEN 1314."SELECTION-SCREEN调用另一个窗体
SELECTION-SCREEN BEGIN OF SCREEN 1314 AS WINDOW TITLE TEXT-W01.
PARAMETERS:MATNR LIKE MARA-MATNR.
SELECTION-SCREEN END OF SCREEN 1314.
(2)SELECTION-SCREEN BEGIN OF SCREEN sra AS SUBSCREEN.
该语法用于定义一个SUBSCREEN,SUBSCREEN主要用于SCREEN PAINTER所创建屏幕。
(3)SELECTION-SCREEN BEGIN OF BLOCK block.
......
SELECTION-SCREEN END OF BLOCK.
该语法在屏幕中定义一个BLOCK,其扩展语法包括:
...WITH FRAME:创建一个框架
...TITLE title:创建一个带标题的框架。
...NO INTERVALS:所创建的框架中限制SELECT只有一个输入项。
以下为示例代码:
DATA MAT LIKE MARA-MATNR.
*不包含扩展语法
SELECTION-SCREEN BEGIN OF BLOCK block1.
SELECT-OPTIONS:MATNR1 FOR MAT.
SELECTION-SCREEN END OF BLOCK block1.
*包含框架
SELECTION-SCREEN BEGIN OF BLOCK block2 WITH FRAME.
SELECT-OPTIONS:MATNR2 FOR MAT.
SELECTION-SCREEN END OF BLOCK block2.
*包含框架及标头
SELECTION-SCREEN BEGIN OF BLOCK block3 WITH FRAME TITLE TEXT-W01.
SELECT-OPTIONS:MATNR3 FOR MAT.
SELECTION-SCREEN END OF BLOCK block3.
*包含框架及标头且只有一个输入框
SELECTION-SCREEN BEGIN OF BLOCK block4 WITH FRAME TITLE TEXT-W01 NO INTERVALS.
SELECT-OPTIONS:MATNR4 FOR MAT.
SELECTION-SCREEN END OF BLOCK block4.
代码运行界面如下:
标签:
原文地址:http://www.cnblogs.com/eric0701/p/4235625.html