Copyright 2021 - BV TallVision IT

Need to help your end user to a PC file to be uploaded or downloaded ? Here's howThe same F4 processing rules apply, however, there is a function module that will allow the end user to browse through a directory structure to find his/her file, from Windows point of view: The selection screen:

 

PARAMETERS: pa_file type LOCALFILE.

Processing at value request:

at selection-screen on value-request for pa_file.
*----------------------------------------------------------------------
  perform get_file_name using 'Filename to download to'(011)
    changing pa_file.

With the routine handling the rest:

*----------------------------------------------------------------------
*  Form  get_file_name
*----------------------------------------------------------------------
*  F4 help for file name
*----------------------------------------------------------------------
form get_file_name using lo_text
                   changing lo_file.

  data: lt_files type standard table of sdokpath,
lw_file type sdokpath. call function 'TMP_GUI_FILE_OPEN_DIALOG' EXPORTING window_title = lo_text TABLES file_table = lt_files EXCEPTIONS others = 4. if sy-subrc = 4. message 'GUI error: please contact the helpdesk' type 'E'. endif. read table ll_files index 1 into lw_file. lo_file = lw_file-pathname.
endform. " get_file_name

Alternatively

Module F4_FILENAMEis also available as alternative to the one in the example above.

Class CL_RSAN_UT_FILES method F4 is there for you too, example call:

AT SELECTION-SCREEN ON VALUE-REQUEST FOR pa_mfile.
  CL_RSAN_UT_FILES=>F4(
    exporting i_applserv = space
              i_gui_extension = space
              i_gui_ext_filter = space
              i_title = 'Choose file to UPLOAD from'
    changing  c_file_name = pa_mfile ).

Need a directory instead of a file ? Check out TMP_GUI_BROWSE_FOR_FOLDER.