There have been several tips submitted that show you how to query a user for a filename on the frontend using a nice windows browser dialog. However, all these examples only allow the return of one file. The following example can be used when you want to return multiple files. This code can be used in an AT SELECTION-SCREEN ON VALUE-REQUEST or anywhere within your code.
form load_files using clear_list. ****List of possible filenames. data: file_tab type filetable. data: file_line like line of file_tab. ****File Open Return Code data: rc type i. ****Call the file open dialog only ****showing MP3 call method cl_gui_frontend_services=>file_open_dialog exporting * WINDOW_TITLE = default_extension = '*.MP3' * DEFAULT_FILENAME = file_filter = 'MP3 (*.MP3)|*.MP3|' * INITIAL_DIRECTORY = multiselection = abap_true changing file_table = file_tab rc = rc * USER_ACTION = * EXCEPTIONS * FILE_OPEN_DIALOG_FAILED = 1 * CNTL_ERROR = 2 * ERROR_NO_GUI = 3 * others = 4 . if sy-subrc = 0 and rc ne 0. clear imp3_list. ****For each new Item - Move the data ****we have to the playlist loop at file_tab into file_line. clear imp3_list. move sy-uname to imp3_list-user_id.
move playlist to imp3_list-playlist. move sy-tabix to imp3_list-list_index. move file_line-filename to imp3_list-filename. append imp3_list. endloop. endform. " load_files
This was first published in October 2001