[ABAP]选择屏幕4-功能分类/子屏幕

27 篇文章 0 订阅

相关需求:

  1. 选择屏幕按照功能分类屏幕界面

  1. 增加弹出选择屏幕

相关代码:

*&---------------------------------------------------------------------*
*& 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.

相关测试:

点击弹窗屏幕

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值