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

How to select directory path in a selection screen

Hi ,

We can select a file path using the below statement :

DATA : P_FILE TYPE RLGRAP-FILENAME.

But how can the similar be achieved for a directory, that is if one wants to select a folder.

Folder path can be retrieved from the function : "TMP_GUI_BROWSE_FOR_FOLDER" but this doesnt give us the privilege of displaying the path selected in a parameter form as is with the file type.

Any kind of help would be apprecialble.

Thanks!!!!

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

4 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Jul 22, 2009 at 08:31 AM

    use this fm /SAPDMC/LSM_F4_SERVER_FILE

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jul 22, 2009 at 08:35 AM

    Hi,

    Check this

    
    DATA : f_path TYPE string,
          f_pathname TYPE string.
    
    
      CALL METHOD cl_gui_frontend_services=>directory_browse
        CHANGING
          selected_folder      = f_path
        EXCEPTIONS
          cntl_error           = 1
          error_no_gui         = 2
          not_supported_by_gui = 3
          OTHERS               = 4.
    
    if sy-subrc eq 0.
    f_pathname = f_path.
    WRITE: f_pathname.
    endif.
    
    

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      Hi Nitwick,

      the problem with ur code is that statement "PARAMETERS: f_path1 TYPE string." generates syntax error...n so further processing gets difficult as parameter cant be string and "selected_folder" is of string type...

      btw i solved it using the function module :TMP_GUI_BROWSE_FOR_FOLDER...and in this "selected_folder" is of type C...so the problem gets solved...

      thanks for ur help!!!

  • author's profile photo Former Member
    Former Member
    Posted on Jul 22, 2009 at 09:32 AM

    Hi,

    Using the function module '/SAPDMC/LSM_F4_SERVER_FILE' will serve your purpose.

    PARAMETERS: p_fname TYPE localfile.
    
    CALL FUNCTION '/SAPDMC/LSM_F4_SERVER_FILE'
    IMPORTING
          serverfile       = p_fname
    EXCEPTIONS
          canceled_by_user = 1
          OTHERS = 2.

    Edited by: sudipta86 on Jul 22, 2009 11:33 AM

    Edited by: sudipta86 on Jul 22, 2009 11:34 AM

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jul 22, 2009 at 10:05 AM

    Hi ,

    use this

    CALL METHOD cl_gui_frontend_services=>directory_browse

    Please let me know if you still need any more help.

    Thanks and regards,

    Rajeshwar

    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.