选择屏幕组件
主要记录了ABAP编程中选择屏幕常用的组件
- 选择框
- 范围选择框
- radio单选
- check选择
- 单行展现 配合radio和check使用较多
- 下拉框
- 自定义下拉框
- 按钮
- 文件框
- 文字帮助
选择框
图例:
代码:
SELECTION-SCREEN BEGIN OF BLOCK blk1.
PARAMETERS:
p_matnr TYPE makt-matnr.
SELECTION-SCREEN END OF BLOCK blk1.
范围选择框
图例:
代码:SELECTION-SCREEN BEGIN OF BLOCK blk1.
SELECT-OPTIONS:
p_matnr FOR makt-matnr.
SELECTION-SCREEN END OF BLOCK blk1.
radio单选
图例:
代码:SELECTION-SCREEN BEGIN OF BLOCK blk1 WITH FRAME TITLE TEXT-001.
PARAMETERS:
s_hiera TYPE c RADIOBUTTON GROUP g1 USER-COMMAND is_hiera DEFAULT 'X', " 分层
s_hiera1 TYPE c RADIOBUTTON GROUP g1. " 不分层
SELECTION-SCREEN END OF BLOCK blk1.
check选择
图例:
代码:
SELECTION-SCREEN BEGIN OF BLOCK blk1 WITH FRAME TITLE TEXT-001.
PARAMETERS:
s_hiera AS CHECKBOX USER-COMMAND is_hiera. " 分层
SELECTION-SCREEN END OF BLOCK blk1.
单行展现 配合radio和check使用较多
图例:
代码: SELECTION-SCREEN BEGIN OF LINE.
*第一个RADIOBUTTON
SELECTION-SCREEN POSITION 1. "1是RADIOBUTTON横坐标
PARAMETERS:s_add TYPE c RADIOBUTTON GROUP g1 USER-COMMAND is_cur DEFAULT 'X'.
SELECTION-SCREEN COMMENT 2(7) TEXT-003 FOR FIELD s_add. "2是文本横坐标,7是文本长度
*第二个RADIOBUTTON
SELECTION-SCREEN POSITION 11. "11是RADIOBUTTON横坐标
PARAMETERS:s_limit TYPE c RADIOBUTTON GROUP g1.
SELECTION-SCREEN COMMENT 12(7) TEXT-004 FOR FIELD s_limit."12是文本横坐标,7是文本长度
SELECTION-SCREEN END OF LINE.
下拉框
图例:
代码:SELECTION-SCREEN BEGIN OF BLOCK blk1 WITH FRAME TITLE TEXT-001.
PARAMETERS:
s_ydlx type rmmg1-mbrsh AS LISTBOX VISIBLE LENGTH 20.
SELECTION-SCREEN END OF BLOCK blk1.
自定义下拉框
图例:
代码:
SELECTION-SCREEN BEGIN OF BLOCK blk1 WITH FRAME TITLE TEXT-001.
PARAMETERS:
s_zqista TYPE char30 AS LISTBOX VISIBLE LENGTH 20.
SELECTION-SCREEN END OF BLOCK blk1.
"屏幕初始化的时候添加例程
INITIALIZATION .
PERFORM frm_pull_down. " 配置下拉框
"配置自定义展示的例程
FORM frm_pull_down .
```abap
TYPE-POOLS: vrm.
DATA: name TYPE vrm_id,
list TYPE vrm_values,
value LIKE LINE OF list.
REFRESH list.
DEFINE fill_list.
value-key = &1.
value-text = &2.
APPEND value TO list.
END-OF-DEFINITION.
fill_list '测试一' ''.
fill_list '测试二' ''.
fill_list '测试三' ''.
CALL FUNCTION 'VRM_SET_VALUES'
EXPORTING
id = 'S_ZQISTA'
values = list.
ENDFORM.
按钮
图例:
代码:SELECTION-SCREEN BEGIN OF BLOCK blk1 WITH FRAME TITLE TEXT-001.
SELECTION-SCREEN PUSHBUTTON 7(20) but1 USER-COMMAND s_cur.
SELECTION-SCREEN END OF BLOCK blk1.
"屏幕初始化的时候 对按钮显示进行处理
INITIALIZATION .
CALL FUNCTION 'ICON_CREATE'
EXPORTING
name = icon_export " 按钮的图片和文字
text = '测试' " 按钮的文本
info = '测试'
IMPORTING
result = but1
EXCEPTIONS
OTHERS = 0.
文件框
图例:
代码:SELECTION-SCREEN BEGIN OF BLOCK blk1 WITH FRAME TITLE TEXT-001.
PARAMETERS: p_file TYPE rlgrap-filename.
SELECTION-SCREEN END OF BLOCK blk1.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file. "和自定义搜索帮助类似
PERFORM frm_file_open. " 用于上传文件
"上传文件的例程
CALL FUNCTION 'WS_FILENAME_GET'
EXPORTING
mask = ',EXCEL FILE,*.XLS;*XLSX;' "可以指定打开的文件类型
mode = '0' "S是保存,0是打开
IMPORTING
filename = p_file
EXCEPTIONS
inv_winsys = 1
no_batch = 2
selection_cancel = 3
selection_error = 4
OTHERS = 5.
文字帮助
图例:
代码:SELECTION-SCREEN BEGIN OF BLOCK blk2 WITH FRAME TITLE TEXT-001.
SELECTION-SCREEN COMMENT /3(79) TEXT-002.
SELECTION-SCREEN COMMENT /3(79) TEXT-003.
SELECTION-SCREEN COMMENT /3(79) TEXT-004.
SELECTION-SCREEN END OF BLOCK blk2.
标签:SELECTION,END,TEXT,SCREEN,ABAP,类型,屏幕,blk1,BLOCK
From: https://www.cnblogs.com/pnj-owowa/p/16743945.html