Code: Alles auswählen.
DATA: l_filetab LIKE FILE_TABLE OCCURS 0 .
DATA: l_count TYPE i.
data: dir type string.
dir = 'C:\Windows\Fonts'.
CALL METHOD CL_GUI_FRONTEND_SERVICES=>DIRECTORY_LIST_FILES
EXPORTING
DIRECTORY = dir
FILES_ONLY = 'X'
CHANGING
FILE_TABLE = l_filetab
COUNT = l_count
EXCEPTIONS
CNTL_ERROR = 1
DIRECTORY_LIST_FILES_FAILED = 2
WRONG_PARAMETER = 3
ERROR_NO_GUI = 4
NOT_SUPPORTED_BY_GUI = 5
others = 6
.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
Lg.
Code: Alles auswählen.
:
:
DATA lv_exist(1).
* abap_true TYPE abap_bool VALUE 'X',
* abap_false TYPE abap_bool VALUE ' ',
CONCATENATE l_workdir '\' l_filename INTO l_filepath.
CALL METHOD cl_gui_frontend_services=>file_exist
EXPORTING
file = l_filepath
RECEIVING
result = lv_exist
EXCEPTIONS
cntl_error = 1
error_no_gui = 2
wrong_parameter = 3
not_supported_by_gui = 4
OTHERS = 5.
IF sy-subrc <> 0.
ENDIF.
IF lv_exist IS INITIAL.
"-Store file----------------------------------------------------------
CALL FUNCTION 'SCMS_XSTRING_TO_BINARY'
EXPORTING
buffer = l_file
IMPORTING
output_length = l_len
TABLES
binary_tab = l_dtab.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
bin_filesize = l_len
filename = l_filepath
filetype = 'BIN'
TABLES
data_tab = l_dtab
EXCEPTIONS
OTHERS = 1.
ENDIF.
"-Execute file--------------------------------------------------------
CALL METHOD cl_gui_frontend_services=>execute
:
:
: