Tip

Browse for a file on input parameter using F4 button - Another alternative, Again

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.

    Requires Free Membership to View

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

There are Comments. Add yours.

 
TIP: Want to include a code block in your comment? Use <pre> or <code> tags around the desired text. Ex: <code>insert code</code>

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
Sort by: OldestNewest

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to:

Disclaimer: Our Tips Exchange is a forum for you to share technical advice and expertise with your peers and to learn from other enterprise IT professionals. TechTarget provides the infrastructure to facilitate this sharing of information. However, we cannot guarantee the accuracy or validity of the material submitted. You agree that your use of the Ask The Expert services and your reliance on any questions, answers, information or other materials received through this Web site is at your own risk.