Skip to Content
author's profile photo Former Member
Former Member

FM to get file path (windows)

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.

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

2 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Dec 03, 2007 at 05:02 PM

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

    Albert

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Dec 03, 2007 at 05:02 PM

    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

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.