CONSTANTS:
c_win_title TYPE string VALUE 'Open Excel Workbook',
c_int_dir TYPE string VALUE '/',
c_def_filename TYPE string VALUE '*.XLSX' .
DATA: g_it_file_table TYPE TABLE OF file_table,
g_wa_filetable TYPE file_table,
g_usr_act TYPE i,
g_rc TYPE i.
PARAMETERS:
p_file type rlgrap-filename.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.
PERFORM f4_excel_file USING p_file.
*&---------------------------------------------------------------------*
*& Form F4_EXCEL_FILE
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
FORM f4_excel_file USING pa_file TYPE localfile.
CLEAR: g_wa_filetable,g_rc,g_usr_act.
REFRESH: g_it_file_table.
CALL METHOD cl_gui_frontend_services=>file_open_dialog
EXPORTING
window_title = c_win_title
default_filename = c_def_filename
initial_directory = c_int_dir
CHANGING
file_table = g_it_file_table
rc = g_rc
user_action = g_usr_act
EXCEPTIONS
file_open_dialog_failed = 1
cntl_error = 2
error_no_gui = 3
not_supported_by_gui = 4
OTHERS = 5.
IF sy-subrc EQ 0 AND g_usr_act NE
cl_gui_frontend_services=>action_cancel.
READ TABLE g_it_file_table INTO g_wa_filetable INDEX 1.
pa_file = g_wa_filetable.
ELSEIF g_usr_act eq cl_gui_frontend_services=>action_cancel.
MESSAGE s398(00) WITH text-e64.
ENDIF.
IF p_file IS INITIAL.
MESSAGE s398(00) WITH text-e63.
ENDIF.
ENDFORM.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
4 | |
3 | |
2 | |
2 | |
1 | |
1 | |
1 | |
1 | |
1 |