Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

FM to get file path (windows)

Former Member
0 Kudos

Hi abapers!

Greetings from Brazil!

Please I need your wisdom, I am having a big problem to find a function to take the file address(folder) in a browse. But I need to select the folder not the file like happens in WS_FILENAME_GET function for example. Do you guys have any idea??

Thanks for your help.

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Does'nt it return the absolute file name with the directory. In anycase, you can use CL_GUI_FRONTEND_SERVICES=>DIRECTORY_BROWSE

Albert

2 REPLIES 2

Former Member
0 Kudos

Does'nt it return the absolute file name with the directory. In anycase, you can use CL_GUI_FRONTEND_SERVICES=>DIRECTORY_BROWSE

Albert

Former Member

Hi,

Here is the example code

SELECTION-SCREEN: BEGIN OF BLOCK b2 WITH FRAME.
PARAMETERS : p_file LIKE rlgrap-filename OBLIGATORY.
SELECTION-SCREEN: END OF BLOCK b2.

*Select the file from the Local system
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.
  DATA: directory TYPE string,
        filetable TYPE filetable,
        line      TYPE LINE OF filetable,
        rc        TYPE i.
  CALL METHOD cl_gui_frontend_services=>get_temp_directory
    CHANGING
      temp_dir = directory.
  CALL METHOD cl_gui_frontend_services=>file_open_dialog
    EXPORTING
      window_title      = 'SELECT THE FILE'
      initial_directory = directory
      file_filter       = '*.XLS'
      multiselection    = ' '
    CHANGING
      file_table        = filetable
      rc                = rc.
  IF rc = 1.
    READ TABLE filetable INDEX 1 INTO line.
    p_file = line-filename.
  ENDIF.

Regards,

Satish