单独执行某个条件,增加单独执行按钮

REPORT  Ztest.
tables: SSCRFIELDS.
TYPE-POOLS icon.

selection-screen begin of line.
selection-screen comment 1(28) text-201 .
selection-screen position 30.
parameters:  p_file1 LIKE rlgrap-filename DEFAULT 'C:/'.
SELECTION-SCREEN PUSHBUTTON 78(10) EXEC1 USER-COMMAND OK1.
selection-screen end of line.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file1.
  PERFORM select_file CHANGING p_file1.

INITIALIZATION.
*  t_repid = sy-repid.
  CALL FUNCTION 'ICON_CREATE'
    EXPORTING
      name   = ICON_EXECUTE_OBJECT
      text   = ''
      info   = 'EXEC'
    IMPORTING
      RESULT = EXEC1
    EXCEPTIONS
      OTHERS = 0.

AT SELECTION-SCREEN.
  CASE SSCRFIELDS-UCOMM.
    WHEN 'OK1'.
      SEARCH p_file1 FOR '.XLS'.

  ENDCASE.
*&---------------------------------------------------------------------*
*&      Form  SELECT_FILE
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*      <--P_P_FILE1  text
*----------------------------------------------------------------------*
FORM select_file CHANGING t_selfile.
  DATA: l_rc         TYPE i,
        l_filetable  TYPE filetable.
* Open The txt File
  CALL METHOD cl_gui_frontend_services=>file_open_dialog
    EXPORTING
      window_title            = '请选择导入文件'
      file_filter             = 'Excel(*.XLS)|*.XLS|全部文件 (*.*)|*.*|'
      multiselection          = space
    CHANGING
      file_table              = l_filetable
      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 AND l_rc = 1.
    READ TABLE l_filetable INTO t_selfile INDEX 1.
  ENDIF.
ENDFORM.                    "SELECT_FILE
 

你可能感兴趣的:(单独执行某个条件,增加单独执行按钮)