ABAP Screen的常用语句
(1).Screen 设计
TABLES: SSCRFIELDS.
PARAMETERS: P_EBLEN LIKE VBRK-EBLEN DEFAULT ' '.
PARAMETERS: P_CK1 AS CHECKBOX DEFAULT 'X'.
PARAMETERS: P_CK2 AS CHECKBOX.
PARAMETERS: P_RAD1 RADIOBUTTON GROUP SG1 DEFAULT 'X'.
PARAMETERS: P_RAD2 RADIOBUTTON GROUP SG1 .
SELECT-OPTIONS: S_EBLEN FOR VBRK-EBLEN NO-EXTENSTION. “无后边的箭头
SELECT-OPTIONS: S_EBLEN FOR VBRK-EBLEN NO INTERVALS. ”无到后边的选项
SELECTION-SCREEN SKIP 1. "产生空行
SELECTION-SCREEN BEGIN OF LINE . "将元素排列到一行
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN ULINE. "画直线
SELECTION-SCREEN COMMENT 10(20) TEXT-001."屏幕上输出文本
SELECTION-SCREEN BEGIN OF BLOCK BK1 WITH FRAME TITLE TEXT-002.
SELECTION-SCREEN END OF BLOCK BK1.
SELECTION-SCREEN PUSHBUTTON 50(10) TEXT-003 USER-COMMAND BUT1. "产生按钮
SELECTION-SCREEN FUNCTION KEY 1. "工具条按钮 最多为5个.
PARAMETERS: <P> .... MEMORY ID <PID>. "从全局SAP内存(SPA/GPA参数)使用缺省值
SET PARAMETERS ID 'HK' FIELD 'Test Parameters' "以'HK'为名称在全局SAP内存中存储值.
PARAMETERS: P_TEST(16) TYPE C MEMORY ID HK. "使用缺省值
GET PARAMETERS ID ' ' FIELD ' '.
INITIALIZATION.
SSCRFIELDS-FUNCTXT_01 = 'Button 1'.
SSCRFIELDS-UCOMM = 'FC01'.
(2).修改Screen
NAME “字段名称
GROUP1 ”字段组1
GROUP2 “字段组2
GROUP3 ”字段组3
GROUP4 “字段组4
ACTIVE ”可见并准备输入的字段
REQUIRED “强制输入的字段
INPUT ”字段准备输入
OUTPUT ”字段仅用来显示
INTENSIFIED ”高亮显示字段
INVISIBLE “字段不可见
LENGTH “设置字段长度
DISPLAY_3D “以3围框架显示字段
VALUE_HELP ”显示有值帮助的字段
在PBO模块中对字段进行属性修改
MODULE MODIFY_SCREEN OUTPUT.
LOOP AT SCREEN.
CHECK SCREEN-GROUP1 = 'MOD'.
SCREEN-INPUT = 0.
MODIFY SCREEN.
ENDLOOP.
ENDMODULE.
(3) 使用子屏幕
CALL SUBSCREEN <AREA> INCLUDING <PROGRAM> <SCREEN>
(4)设置光标位置
SET CURSOR FIELD <FIELD_NAME> OFFSEY <POSITION> 设置光标的特定位置
(5)设置下一个屏幕
SET SCREEN <SCREEN_NUMBER>.
CALL SCREEN <SCREEN_NUMBER>.调用新的屏幕序列
LEAVE TO SCREEN 0.
SET SCREEN 0.
LEAVE SCREEN.
(6)后台处理屏幕
可以使用SUPPRESS DIALOG 取消所有屏幕.
*---------PBO MODULE OF SCREEN 100.
CALL SCREEN 110 STARTING AT 10 5.
*---------SCREEN 110 FLOW LOGIC
MODULE DIALOG_WINDOWS OUTPUT.
SUPPRESS DIALOG.
LEAVE TO LIST-PROCESSING AND RETURN TO SCREEN 0.
WRITE: /.
WRITE: /.
ENDMODULE.
(7)报表及选择屏幕事件过程
报表事件过程
INITIALIZATION 用于屏幕初始化,例如屏幕字段默认值的填充
START-OF-SELECTION
END-OF-SELECTION
选择屏幕事件 在INITIALIZATION之前 STATR-OF-SELECTION之后触发
AT SELECTION-SCREEN OUTPUT."对选择屏幕字段进行修改
AT SELECTION-SCREEN INPUT.
处理特殊输入字段
AT SELECTION-SCREEN ON <FIELD>
创建值输入列表
AT SELECTION-SCREEN ON VALUE-REQUEST FOR <FIELD>.
创建输入字段的帮助
AT SELECTION-SCREEN ON HELP-REQUEST FOE <FIELD>.
处理单选按钮组
AT SELECTION-SCREEN ON RADIOBUTTON GROUP <RADIO>
处理输入字段块
AT SELECTION-SCREEN ON BLOCK <BK1>.