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

Search help for filename+path

Hello,

When i need to get a file name and its path , i use the f.m. "WS_FILENAME_GET" that popup an explorer window.

I'm looking for a search help that do the same, so i can link it to a data element .

Thank you,

koby

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

4 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Jan 25, 2010 at 05:43 PM

    Hi,

    there is no such search help. You need to do it like this:

    PARAMETERS: p_file TYPE rlgrap-filename.
    DATA: gt_filetab TYPE filetable,
          gs_file TYPE file_tab,
          gv_rc TYPE i.
    
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.
      CLEAR gt_filetab.
      CALL METHOD cl_gui_frontend_services=>file_open_dialog
        EXPORTING
          multiselection    = space
        CHANGING
          file_table        = gt_filetab
          rc                = gv_rc.
    
      LOOP AT gt_filetab INTO gs_file.
        p_file = gs_file-filename.
      ENDLOOP.

    Regards,

    Adrian

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Jan 25, 2010 at 06:15 PM
    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jan 25, 2010 at 04:45 PM

    Hi Kobby,

    Use rlgrap-filename.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jan 27, 2010 at 12:00 PM

    hi,

    DATA : lv_dir TYPE string,

    lv_file TYPE string,

    lv_result(1) TYPE c.

    DATA : lv_filename TYPE string.

    PARAMETERS : p_file TYPE rlgrap-filename.

    AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file. -


    >getting f4 help

    CALL FUNCTION 'F4_FILENAME'

    EXPORTING

    program_name = syst-cprog

    dynpro_number = syst-dynnr

    field_name = 'P_FILE'

    IMPORTING

    file_name = p_file.

    IF sy-subrc NE 0.

    MESSAGE e000.

    ENDIF.

    AT SELECTION-SCREEN. -


    >validating the path

    CALL FUNCTION 'SO_SPLIT_FILE_AND_PATH'

    EXPORTING

    full_name = p_file

    IMPORTING

    stripped_name = lv_file

    file_path = lv_dir

    EXCEPTIONS

    x_error = 1

    OTHERS = 2.

    IF sy-subrc <> 0.

    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno

    WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

    ENDIF.

    CALL METHOD cl_gui_frontend_services=>directory_exist

    EXPORTING

    directory = lv_dir

    RECEIVING

    result = lv_result

    EXCEPTIONS

    cntl_error = 1

    error_no_gui = 2

    wrong_parameter = 3

    not_supported_by_gui = 4

    OTHERS = 5.

    IF lv_result IS INITIAL.

    MESSAGE 'Invalid Directory' TYPE 'E'.

    ENDIF.

    CLEAR lv_result.

    CALL METHOD cl_gui_frontend_services=>file_exist

    EXPORTING

    file = lv_file

    RECEIVING

    result = lv_result

    EXCEPTIONS

    cntl_error = 1

    error_no_gui = 2

    wrong_parameter = 3

    not_supported_by_gui = 4

    OTHERS = 5.

    IF lv_result IS INITIAL.

    MESSAGE 'Invalid File' TYPE 'E'.

    ENDIF.

    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.