相关需求:
-
选择屏幕按照功能分类屏幕界面
-
增加弹出选择屏幕
相关代码:
*&---------------------------------------------------------------------*
*& Report Y
*&---------------------------------------------------------------------*
*&
*&---------------------------------------------------------------------*
REPORT y.
TABLES: sscrfields,bkpf,mara.
*&---------------------------------------------------------------------*
*& SELECTION-SCREEN
*&---------------------------------------------------------------------*
SELECTION-SCREEN FUNCTION KEY 1. "弹窗屏幕
SELECTION-SCREEN: BEGIN OF BLOCK b0 WITH FRAME TITLE TEXT-001.
PARAMETERS r1 TYPE char1 RADIOBUTTON GROUP rgp1 USER-COMMAND gp1 DEFAULT 'X'.
PARAMETERS r2 TYPE char1 RADIOBUTTON GROUP rgp1.
SELECTION-SCREEN: END OF BLOCK b0.
SELECTION-SCREEN: BEGIN OF BLOCK b1 WITH FRAME TITLE TEXT-002.
SELECT-OPTIONS: s_bukrs FOR bkpf-bukrs MODIF ID g1, "公司代码
s_belnr FOR bkpf-belnr MODIF ID g1, "凭证编号
s_gjahr FOR bkpf-gjahr MODIF ID g1. "财年
PARAMETERS: p_filenm TYPE rlgrap-filename MODIF ID g2. "文件上传
SELECTION-SCREEN: END OF BLOCK b1.
SELECTION-SCREEN BEGIN OF SCREEN 9000 AS WINDOW TITLE TEXT-003.
SELECTION-SCREEN BEGIN OF BLOCK b2 WITH FRAME TITLE TEXT-004.
SELECT-OPTIONS s_matnr FOR mara-matnr.
SELECTION-SCREEN END OF BLOCK b2.
SELECTION-SCREEN END OF SCREEN 9000.
*&---------------------------------------------------------------------*
*& AT SELECTION-SCREEN
*&---------------------------------------------------------------------*
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_filenm.
PERFORM fm_get_file_name USING p_filenm.
AT SELECTION-SCREEN OUTPUT.
IF r1 = 'X'.
LOOP AT SCREEN.
IF screen-group1 = 'G2'.
screen-active = 0.
screen-required = 0.
ENDIF.
MODIFY SCREEN.
ENDLOOP.
ELSEIF r2 = 'X'.
LOOP AT SCREEN.
IF screen-group1 = 'G1'.
screen-active = 0.
screen-required = 0.
ENDIF.
MODIFY SCREEN.
ENDLOOP.
ENDIF.
AT SELECTION-SCREEN.
IF sscrfields-ucomm = 'FC01'.
CALL SELECTION-SCREEN 9000 STARTING AT 10 5 ENDING AT 120 15.
ENDIF.
*&---------------------------------------------------------------------*
*& INITIALIZATION
*&---------------------------------------------------------------------*
INITIALIZATION.
sscrfields-functxt_01 = '弹窗屏幕'.
*&---------------------------------------------------------------------*
*& 获取上传文件的路径
*&---------------------------------------------------------------------*
FORM fm_get_file_name USING fu_filename.
DATA:
lt_table TYPE filetable WITH HEADER LINE,
l_rc TYPE i.
CALL METHOD cl_gui_frontend_services=>file_open_dialog
EXPORTING
window_title = '请选择上传文件的路径'
default_filename = '*.xlsx'
file_filter = 'Excel 文档|*.xlsx;*.xls'
CHANGING
file_table = lt_table[]
rc = l_rc
EXCEPTIONS
file_open_dialog_failed = 1
cntl_error = 2
error_no_gui = 3
not_supported_by_gui = 4
OTHERS = 5.
IF sy-subrc = 0.
READ TABLE lt_table INDEX 1.
fu_filename = lt_table-filename.
ENDIF.
ENDFORM.
相关测试:
点击弹窗屏幕