cancel
Showing results for 
Search instead for 
Did you mean: 

Selection Screen help,

Former Member
0 Kudos

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

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

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.

Answers (7)

Answers (7)

Former Member
0 Kudos

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

Former Member
0 Kudos

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

Former Member
0 Kudos

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.

Former Member
0 Kudos

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.

former_member188685
Active Contributor
0 Kudos

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.

Former Member
0 Kudos

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

Former Member
0 Kudos

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.

Former Member
0 Kudos

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,