SELECTION-SCREEN屏幕范例
1. SELECTIION-SCREEN的語法:
SELECTION-SCREEN BEGIN OF SCREEN SCR.
...
SELECTION-SCREEN END OF SCREEN SCR.
2. 通过SELECTION-SCREEN定义窗体。(当从一个主屏幕中来调用基程序中的另一个窗体时,必须使用CALL SELECTION-SCREEN的方法)
SELECTION-SCREEN BEGIN OF SCREEN 123 AS WINDOW TITLE TEXT-001.
PARAMETERS:S_MATNR LIKE MARA-MATNR.
PARAMETERS:TYPE AS CHECKBOX.
SELECTION-SCREEN END OF SCREEN 123.
CALL SCREEN 123
STARTING AT 10 10
ENDING AT 80 10. "调用SELECTION-SCREEN

3. 通过SELECTION-SCREEN调用Include screen.
PARAMETERS:TYPE AS CHECKBOX. "第一个窗体元素
CALL SELECTION-SCREEN 123."SELECTION-SCREEN调用另一个窗体
SELECTION-SCREEN BEGIN OF SCREEN 123 AS WINDOW TITLE TEXT-001.
PARAMETERS:MATNR LIKE MARA-MATNR.
SELECTION-SCREEN END OF SCREEN 123.

按【F8】执行,会出现如下画面

4.SELECTION-SCREEN BEGIN OF SCREEN scr AS SUBSCREEN.
该语法用于定义一个Subscreen, Subscreen主要应用于Screen Painter所创建屏幕。
5.
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-001.
SELECT-OPTIONS:MATNR3 FOR MAT.
SELECTION-SCREEN END OF BLOCK BLOCK3.
*包含框架及标头且只有一个输入框
SELECTION-SCREEN BEGIN OF BLOCK BLOCK4 WITH FRAME TITLE TEXT-002 NO INTERVALS.
SELECT-OPTIONS:MATNR4 FOR MAT.
SELECTION-SCREEN END OF BLOCK BLOCK4.

6. SELECTION-SCREEN INCLUDE
参照某一个已经定义的屏幕元素来创建.
CALL SCREEN 1234.
SELECTION-SCREEN BEGIN OF SCREEN 1111.
SELECTION-SCREEN BEGIN OF BLOCK BLK1.
SELECT-OPTIONS SEL0 FOR SY-REPID.
SELECTION-SCREEN ULINE. "换行线
PARAMETERS PAR0.
SELECTION-SCREEN END OF BLOCK BLK1.
SELECTION-SCREEN END OF SCREEN 1111.
SELECTION-SCREEN BEGIN OF SCREEN 1234.
SELECTION-SCREEN INCLUDE BLOCKS BLK1."參照SCREEN 111中的BLOCK
SELECTION-SCREEN END OF SCREEN 1234.
7. SELECTION-SCREEN ULINE. 輸出橫線,必須用在BLOCK中才生效.
8. SELECTION-SCREEN SKIP n. 在BLOCK中產生換行.
9. SELECTION-SCREEN POSITION pos. 在BLOCK中产生空格.
10. 将所产生的屏幕元素控制在一行.
SELECTION-SCREEN BEGIN OF LINE.
...
SELECTION-SCREEN END OF LINE.
11. AT SELECTION-SCREEN . 用于屏幕输入检验,其扩展语法如下:
...ON <Field>: 该语法用于控制屏幕元素输入时的遇错处理,检查某具体输入字段
(SELECT-OPTIONS 或PARAMETERS)是否完整或正确,若输入有错或不满足条件,其他字段会变灰色直到该字段输入正确.
...ON RADIOBUTTON GROUP <radio>:按制RadioButto组值的输入;
...ON BLOCK <block>:控制框架中的屏幕元素值的输入;
...OUTPUT:用于屏幕输出时的各屏幕元素值的管控;
...ON EXIT-COMMAND:用于响应"Back"、"Canne"、及"Exit"等事件。
SELECT-OPTIONS SEL0 FOR SY-TVAR0.
SELECTION-SCREEN BEGIN OF BLOCK BL0.
SELECT-OPTIONS SEL1 FOR SY-TVAR1.
SELECTION-SCREEN BEGIN OF BLOCK BL1.
PARAMETERS P1 RADIOBUTTON GROUP RAD1.
PARAMETERS P2 RADIOBUTTON GROUP RAD1.
SELECTION-SCREEN BEGIN OF BLOCK BL2.
PARAMETERS P3.
SELECTION-SCREEN END OF BLOCK BL2.
SELECT-OPTIONS SEL2 FOR SY-TVAR2.
SELECTION-SCREEN END OF BLOCK BL1.
SELECTION-SCREEN END OF BLOCK BL0.
AT SELECTION-SCREEN ON SEL1.
AT SELECTION-SCREEN ON RADIOBUTTON GROUP RAD1.
AT SELECTION-SCREEN ON P3.
AT SELECTION-SCREEN ON BLOCK BL1.
AT SELECTION-SCREEN ON BLOCK BL2.

12.SELECTION-SCREEN PUSHBUTTION fmt name USER-COMMAND ucom
用于在SELECTION SCREEN中产生一个按钮(pushbutton),fmt name为定义该按钮的属性值。可以对其赋值描述及添加图标,USER-COMMAND ucom定义该按钮在Screen中的组件名,
对按钮属性赋值可以包括两种方式。
REPORT Y001.
INCLUDE <ICON>.
SELECTION-SCREEN PUSHBUTTON /1(20) PUBU1 USER-COMMAND ABCD.
SELECTION-SCREEN SKIP."加入空行以便区分
SELECTION-SCREEN PUSHBUTTON /1(20) PUBU2 USER-COMMAND ABCD.
AT SELECTION-SCREEN OUTPUT.
MOVE 'My Button' TO PUBU1."定义第一个按钮并赋值描述
WRITE ICON_GRAPHICS AS ICON TO PUBU2."定义第二个按钮并添加图标
CONCATENATE PUBU2 'MY BUTTON'INTO PUBU2 SEPARATED BY SPACE.

(若要更换按钮图标,请参考 Tcode: ICON)

13. SELECTION-SCREEN COMMENT fmt name.
用于定义或修改本地元素 的注释,包括Parameter、Checkbox Button等。例如Checkbox Button的描述,其在Selection texts中最长字段只有30位,通过SELECTION-SCREEN COMMENT语法可以按Text Symbols设置值对其属性重新定义。
REPORT Y001.
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN COMMENT (40) TEXT-A01 FOR FIELD PARM.
SELECTION-SCREEN POSITION 45.
PARAMETERS PARM LIKE MARA-MATNR.
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN SKIP 1.
SELECTION-SCREEN BEGIN OF LINE.
PARAMETERS:TYPE AS CHECKBOX.
SELECTION-SCREEN COMMENT (40) TEXT-A02 FOR FIELD TYPE.
SELECTION-SCREEN END OF LINE.

14. SELECTION-SCREEN FUNCTION KEY n.
用于在工具栏上新增一个功能按钮。该按钮的定义保存在系统结构体SSCRFIELDS中,n为一个整数的序数,例如当n等于1时,其按钮描述保存在字段SSCRFIELDS-FUNCTXT_01中,其按钮对象命名为“FC01",保存在字段SSCRFIELDS-UCOMM中。具体使用方法如下:
REPORT Y001.
PARAMETERS PARM LIKE MARA-MATNR.
TABLES SSCRFIELDS.
SELECTION-SCREEN FUNCTION KEY 1.
SELECTION-SCREEN FUNCTION KEY 2.
INITIALIZATION.
MOVE 'BUTTON1' TO SSCRFIELDS-FUNCTXT_01.
MOVE 'BUTTON2' TO SSCRFIELDS-FUNCTXT_02.

REPORT Y001.
PARAMETERS PARM LIKE MARA-MATNR.
TABLES SSCRFIELDS.
SELECTION-SCREEN FUNCTION KEY 1.
SELECTION-SCREEN FUNCTION KEY 2.
SELECTION-SCREEN FUNCTION KEY 3.
INITIALIZATION.
MOVE 'BUTTON1' TO SSCRFIELDS-FUNCTXT_01.
MOVE 'BUTTON2' TO SSCRFIELDS-FUNCTXT_02.
MOVE 'BUTTON3' TO SSCRFIELDS-FUNCTXT_03.
AT SELECTION-SCREEN.
IF SSCRFIELDS-UCOMM = 'FC01'.
CALL SELECTION-SCREEN 123.
ENDIF.
对工具栏按钮的操作同样通过屏幕时间来实现,如上所述,对象命我为”FC01",保存存在字段SSCRFIELDS-UCOMM中。
TYPE-POOLS ICON.
TABLES SSCRFIELDS.
DATA FUNCTXT TYPE SMP_DYNTXT."SMP_DYNTXT(菜单制作器:动态文本的程序接口)
PARAMETERS: P_CARRID TYPE S_CARR_ID,
P_CITYFR TYPE S_FROM_CIT.
SELECTION-SCREEN: FUNCTION KEY 1,
FUNCTION KEY 2.
INITIALIZATION. "屏幕初始化
FUNCTXT-ICON_ID = ICON_WS_PLANE."文本字段中的图标(替换显示,别名)
FUNCTXT-QUICKINFO = 'Preselected Carrier'."菜单制作器:信息文本 (4.0),滑鼠移去过去显示的信息TIP
FUNCTXT-ICON_TEXT = 'LH'."菜单制作器:图标文本 (4.0),菜单名称
SSCRFIELDS-FUNCTXT_01 = FUNCTXT.
FUNCTXT-ICON_TEXT = 'UA'.
SSCRFIELDS-FUNCTXT_02 = FUNCTXT.
AT SELECTION-SCREEN.
CASE SSCRFIELDS-UCOMM.
WHEN 'FC01'.
P_CARRID = 'LH'.
P_CITYFR = 'Frankfurt'.
WHEN 'FC02'.
P_CARRID = 'UA'.
P_CITYFR = 'Chicago'.
ENDCASE.

15.SELECTION-SCREEN BEGIN OF TABBED BLOCK <block> FOR n LINES.
用于在屏幕上定义一个分页控件(tab),每个页签都是由一个子屏幕控制,n代表分页控件的高度,屏幕载入时必须先通过INTIALIZATION事件对其司性初始化,如定义两个分页的TAB控件,具体如下:
REPORT Y001.
TABLES:MARA.
*定义子屏幕100
SELECTION-SCREEN BEGIN OF SCREEN 100 AS SUBSCREEN.
SELECTION-SCREEN BEGIN OF BLOCK A1 WITH FRAME TITLE TEXT-001.
SELECT-OPTIONS:S_MATNR FOR MARA-MATNR NO INTERVALS.
SELECTION-SCREEN SKIP 1.
PARAMETERS:TYPE AS CHECKBOX DEFAULT 'X'.
SELECTION-SCREEN END OF BLOCK A1.
SELECTION-SCREEN END OF SCREEN 100.
*定义子屏幕200
SELECTION-SCREEN BEGIN OF SCREEN 200 AS SUBSCREEN.
PARAMETERS:S_MATNR2 LIKE MARA-MATNR.
SELECTION-SCREEN END OF SCREEN 200.
*定义一个TAB空间,取名为MYTAB,控件高为5,共人两个选项卡BUTTON1\BUTTON2
*两个选项卡的功能代码分别为PUSH1\PUSH2
SELECTION-SCREEN:BEGIN OF TABBED BLOCK MYTAB FOR 5 LINES,*指框框高度為5LINES.
TAB (20) BUTTON1 USER-COMMAND PUSH1,
TAB (20) BUTTON2 USER-COMMAND PUSH2,
END OF BLOCK MYTAB.
INITIALIZATION.
BUTTON1 = TEXT-010.
BUTTON2 = TEXT-020.
MYTAB-PROG = SY-REPID.
MYTAB-DYNNR = 100.
*TAB控件选项卡单击事件,选择不同选项卡显示不同子屏幕
AT SELECTION-SCREEN.
CASE SY-UCOMM.
WHEN 'PUSH1'.
MYTAB-DYNNR = 100.
MYTAB-ACTIVETAB = 'BUTTON1'.
WHEN 'PUSH2'.
MYTAB-DYNNR = 200.
MYTAB-ACTIVETAB = 'BUTTON2'.
ENDCASE.

TABLES SSCRFIELDS.
* 定义子屏幕为100
SELECTION-SCREEN BEGIN OF SCREEN 100 AS SUBSCREEN.
SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-010.
PARAMETERS: P1(10) TYPE C,
P2(10) TYPE C,
P3(10) TYPE C.
SELECTION-SCREEN END OF BLOCK B1.
SELECTION-SCREEN END OF SCREEN 100.
* 定义子屏幕为200
SELECTION-SCREEN BEGIN OF SCREEN 200 AS SUBSCREEN.
SELECTION-SCREEN BEGIN OF BLOCK B2 WITH FRAME TITLE TEXT-020.
PARAMETERS: Q1(10) TYPE C,
Q2(10) TYPE C,
Q3(10) TYPE C.
SELECTION-SCREEN END OF BLOCK B2.
SELECTION-SCREEN END OF SCREEN 200.
*定义子屏幕为300
SELECTION-SCREEN BEGIN OF SCREEN 300 AS SUBSCREEN.
SELECTION-SCREEN BEGIN OF BLOCK B3 WITH FRAME TITLE TEXT-030.
PARAMETERS: R1(10) TYPE C,
R2(10) TYPE C,
R3(10) TYPE C.
SELECTION-SCREEN END OF BLOCK B3.
SELECTION-SCREEN END OF SCREEN 300.
* STANDARD SELECTION SCREEN
SELECTION-SCREEN: FUNCTION KEY 1, "工具栏按钮
FUNCTION KEY 2.
SELECTION-SCREEN: BEGIN OF TABBED BLOCK SUB FOR 10 LINES,
END OF BLOCK SUB.
INITIALIZATION.
SSCRFIELDS-FUNCTXT_01 = '@0D@'. "按钮描述字段,图标形貌
SSCRFIELDS-FUNCTXT_02 = '@0E@'. "按钮描述字段,图标形貌
SUB-PROG = SY-REPID. "必选项
SUB-DYNNR = 100.
AT SELECTION-SCREEN.
CASE SY-DYNNR. "当前显示屏幕的名称
WHEN 100.
IF SSCRFIELDS-UCOMM = 'FC01'. "触发事件的TOOL BAR CONTROL
SUB-DYNNR = 300. "指定显示哪个屏幕
ELSEIF SSCRFIELDS-UCOMM = 'FC02'.
SUB-DYNNR = 200.
ENDIF.
WHEN 200.
IF SSCRFIELDS-UCOMM = 'FC01'.
SUB-DYNNR = 100.
ELSEIF SSCRFIELDS-UCOMM = 'FC02'.
SUB-DYNNR = 300.
ENDIF.
WHEN 300.
IF SSCRFIELDS-UCOMM = 'FC01'.
SUB-DYNNR = 200.
ELSEIF SSCRFIELDS-UCOMM = 'FC02'.
SUB-DYNNR = 100.
ENDIF.
ENDCASE.
START-OF-SELECTION.
WRITE: / 'P1:', P1,'Q1:', Q1, 'R1:', R1,
/ 'P2:', P2,'Q2:', Q2, 'R2:', R2,
/ 'P3:', P3,'Q3:', Q3, 'R3:', R3.


REPORT Y001.
TABLES SSCRFIELDS.
SELECTION-SCREEN:
ULINE /1(83),
COMMENT /30(30) TEXT-001,
ULINE /1(83),
SKIP.
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN COMMENT 2(15) TXT1.
PARAMETER OUT(3) TYPE C.
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN:
SKIP 1,
BEGIN OF BLOCK BLK WITH FRAME TITLE T1,
BEGIN OF LINE,
PUSHBUTTON 2(10) BTN1 USER-COMMAND COMM1,
PUSHBUTTON 12(10) BTN2 USER-COMMAND COMM2,
PUSHBUTTON 22(10) BTN3 USER-COMMAND COMM3,
END OF LINE,
END OF BLOCK BLK.
*&---------------------------------------------------------------------*
INITIALIZATION.
TXT1 = '总分: '.
T1 = '给选择屏幕添加按钮'.
BTN1 = '汤姆'.
BTN2 = '露西'.
BTN3 = '韩梅梅'.

SELECTION-SCREEN屏幕范例的更多相关文章
- 选择屏幕(Selection Screen)
声明:原创作品,转载时请注明文章来自SAP师太技术博客( 博/客/园www.cnblogs.com):www.cnblogs.com/jiangzhengjun,并以超链接形式标明文章原始出处,否则将 ...
- 【ABAP系列】SAP ABAP选择屏幕(SELECTION SCREEN)事件解析
公众号:SAP Technical 本文作者:matinal 原文出处:http://www.cnblogs.com/SAPmatinal/ 原文链接:[ABAP系列]SAP ABAP选择屏幕(SEL ...
- javascript之BOM编程Screen(屏幕)对象
这个对象属性相对比较简单.掌握四个方法即可. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" & ...
- javascript之Screen(屏幕)对象
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/ ...
- 【ABAP系列】SAP abap dialog screen屏幕参数简介
公众号:SAP Technical 本文作者:matinal 原文出处:http://www.cnblogs.com/SAPmatinal/ 原文链接:[ABAP系列]SAP abap dialog ...
- 记录screen屏幕日志
1.建立日志存放目录#mkdir /var/log/screen/ 2.修改配置文件,在末尾添加配置内容#vi /etc/screenrclogfile /var/log/screen/%t.log ...
- 列表屏幕(List Screen)
声明:原创作品,转载时请注明文章来自SAP师太技术博客( 博/客/园www.cnblogs.com):www.cnblogs.com/jiangzhengjun,并以超链接形式标明文章原始出处,否则将 ...
- ABAP屏幕基础
Select语句的使用 关键字into后可以加 structure(结构体), internal table(内表) 和 fieldlist(字段列表) Authority 权限 程序员可以根据权限对 ...
- ALV报表——选择屏幕选项卡
ALV选择屏幕选项卡 运行效果: 代码: *&--------------------------------------------------------------------* *&a ...
随机推荐
- install - 复制文件并设置属性
SYNOPSIS[总览] install [options] [-s] [--strip] source dest install [options] [-s] [--strip] source... ...
- 将shell脚本的执行过程和执行结果导入到log文件中
[root@localhost scripts]# vim ping.sh #!/bin/bash set -x ##分步执行 exec &> /tmp/log.txt ##脚本执行的过 ...
- Linux学习--第十二天--服务、ps、top、pstree、kill、&、jobs、fg、vmstat、dmesg、free、uptime、uname、crontab、ls
服务分类 linux服务分为rpm包默认安装的服务和源码包安装的服务. rpm包默认安装的服务分为独立的服务和基于xinetd服务. 查询已安装的服务 rpm包安装的服务 chkconfig --li ...
- static静态和非静态详解
static 作为Java中的一个关键字,用于修饰方法.成员变量(Field),统称为成员. 有static修饰的成员 属于类 1.方法称为静态方法(类方法),Field称为类的属性. 2.静态成 ...
- Linux中配置jdk环境变量出错:bad ELF interpreter: No such file or directory解决方法
yum install glibc.i686 重新安装,javac成功 如果还有如下类系错误 再继续安装包 error while loading shared libraries: libstdc+ ...
- python算法(一)基本知识&冒泡排序&选择排序&插入排序
本节内容: 算法基本知识 冒泡排序 选择排序 插入排序 1. 算法基本知识 1.1 什么是算法? 算法(algorithm):就是定义良好的计算过程,他取一个或一组的值为输入,并产生出一个或一组值作为 ...
- Elasticsearch:hanlp 中文分词器
HanLP 中文分词器是一个开源的分词器,是专为Elasticsearch而设计的.它是基于HanLP,并提供了HanLP中大部分的分词方式.它的源码位于: https://github.com/Ke ...
- Ubuntu利用ROS搭建手机移动网络摄像头(Android)
所需设备 PC -> Ubuntu 16.04 - > ROS Kinetic Android系统手机 1.Android移动端APP下载安装 配置手机端:(一般默认即可RTSP) 2.源 ...
- 使用tensorflow训练word2vec
from http://blog.csdn.net/wangyangzhizhou/article/details/77530479?locationNum=1&fps=1 使用了tensor ...
- Haproxy-4层和7层代理负载实战
目录 HAProxy是什么 HAProxy的核心能力和关键特性 HAProxy的核心功能 HAProxy的关键特性 HAProxy的安装和运行 安装 运行 添加日志 使用HAProxy搭建L7负载均衡 ...