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

Selection Screen help,

Hai,

I have a report to be downloaded to excel where the file name with the path is being input through a parameter in the selection screen.

How can I attach a F4 help to this selection screen parameter so that when we click it the windows browser opens so that we can navigate to the folder we like and open it instead of typing the path like C:\... etc.

Pls help.

Regards

Binoo

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

8 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Dec 06, 2005 at 09:30 AM

    Hi again,

    1. Some event keyword is missing.

    2. write START-OF-SELECTION

    just before your code (which should get executed on F8)

    Just check ur code once again. The event name

    might be missing.

    regards,

    amit m.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Dec 06, 2005 at 09:06 AM

    Hi,

    You can make use of function modules at selection screen on value request event to achieve this, use F4_FILENAME in at selection-screen on value-request event,

    Rgds,

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Dec 06, 2005 at 09:08 AM

    Hi,

    Data: p_pcfile LIKE rlgrap-filename

    ----


    • AT SELECTION-SCREEN ON VALUE-REQUEST *

    ----


    AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_pcfile.

    • F4 for PC File Name search

    CLEAR: it_filetab, it_filetab[].

    CALL METHOD cl_gui_frontend_services=>file_open_dialog

    EXPORTING

    initial_directory = v_initdir

    CHANGING

    file_table = it_filetab[]

    rc = v_rc

    EXCEPTIONS

    file_open_dialog_failed = 1

    cntl_error = 2

    error_no_gui = 3

    not_supported_by_gui = 4

    OTHERS = 5.

    IF sy-subrc <> 0.

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

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

    ENDIF.

    READ TABLE it_filetab INDEX 1.

    p_pcfile = it_filetab-filename.

    Regards,

    Sudhakar.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Dec 06, 2005 at 09:08 AM

    juST RUN TIS CODE..PRESS f4 IN SELECTION SCREEN AND SEE THE RESULT.

    PLZ REWARD POINT IF IT HELPS YOU.

    Report ZANID_TEST3.

    tables rlgrap.

    data: it_tab type filetable,

    gd_subrc type i.

    selection-screen begin of block m with frame.

    select-options so_fpath for rlgrap-filename.

    selection-screen end of block m.

    at selection-screen on value-request for so_fpath-low.

    REFRESH: it_tab.

    CALL METHOD CL_GUI_FRONTEND_SERVICES=>FILE_OPEN_DIALOG

    EXPORTING

    WINDOW_TITLE = 'Select File'

    DEFAULT_FILENAME = '.'

    MULTISELECTION = 'X'

    CHANGING

    FILE_TABLE = it_tab

    RC = gd_subrc.

    loop at it_tab into so_fpath-low.

    so_fpath-sign = 'I'.

    so_fpath-option = 'EQ'.

    append so_fpath.

    endloop.

    START-OF-SELECTION.

    **YOUR MAIN CODE GOES HERE..

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Dec 06, 2005 at 09:08 AM

    Hi

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

    CALL FUNCTION 'TMP_GUI_FILE_OPEN_DIALOG'

    IMPORTING

    RC = V_RET

    TABLES

    FILE_TABLE = IT_FILE

    EXCEPTIONS

    CNTL_ERROR = 1

    OTHERS = 2.

    IF SY-SUBRC = 0.

    IF V_RET = 1.

    READ TABLE IT_FILE INTO X_FILE INDEX 1.

    IF SY-SUBRC = 0.

    P_PFNAME = X_FILE-PATHNAME.

    ENDIF.

    ENDIF.

    ELSE.

    MESSAGE I002 WITH 'File Error'(006).

    ENDIF.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Dec 06, 2005 at 09:11 AM

    Hi Binoo,

    1. This is the easiest way.

    2. use FM

    F4_FILENAME

    3. Suppose ur parameter name is p_file.

    PARAMETERS : p_file LIKE rlgrap-filename OBLIGATORY.

    (Define it as above)

    4. Then Use This Event

    AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.

    CLEAR p_file.

    CALL FUNCTION 'F4_FILENAME'

    IMPORTING

    file_name = p_file.

    I have used the same. It works fine.

    Hope it helps.

    Regards,

    Amit M.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Dec 06, 2005 at 09:12 AM

    Hi Binoo,

    1. This is the easiest way.

    2. use FM

    F4_FILENAME

    3. Suppose ur parameter name is p_file.

    PARAMETERS : p_file LIKE rlgrap-filename OBLIGATORY.

    (Define it as above)

    4. Then Use This Event

    AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.

    CLEAR p_file.

    CALL FUNCTION 'F4_FILENAME'

    IMPORTING

    file_name = p_file.

    I have used the same. It works fine.

    Hope it helps.

    Regards,

    Amit M.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Dec 06, 2005 at 09:20 AM

    Hi Binoo,

    You can use below function ...

    AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.

    FM CALL FUNCTION 'KD_GET_FILENAME_ON_F4'

    EXPORTING

    program_name = syst-repid

    mask = '*'

    CHANGING

    file_name = p_file

    EXCEPTIONS

    mask_too_long = 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.

    Regards,

    Raj

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member

      I am getting the browser window, but there is a problem. As soon as I select a file and click open or double cllick it the program is executed automatically, ie before I press execute or F8.

      Binoo

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.