Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

F4 help for file name

madan_ullasa
Contributor
0 Kudos

frnds,

Im using the FM "KD_GET_FILENAME_ON_F4" to get F4 help for file name in presentation server... but it does not seem to work...Y?????????

and is there any FM to get the file name from the application server..

points assured to all the answers...

regrds,

Madan...

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Try to use WS_FILENAME_GET

call function 'WS_FILENAME_GET'

exporting def_filename = space

  • def_path =

mask = ',. ,..'

mode = 'O'

title = text-038

importing filename = os_name

  • RC = DUMMY

exceptions inv_winsys = 04

no_batch = 08

selection_cancel = 12

selection_error = 16.

or

at selection-screen on value-request for p_file1.

data wa_file like file_table.

refresh filetable.

call method cl_gui_frontend_services=>file_open_dialog

  • EXPORTING

  • WINDOW_TITLE =

  • DEFAULT_EXTENSION =

  • DEFAULT_FILENAME =

  • FILE_FILTER =

  • INITIAL_DIRECTORY =

  • MULTISELECTION =

  • WITH_ENCODING =

changing

file_table = filetable

rc = rc

  • USER_ACTION =

  • FILE_ENCODING =

exceptions

file_open_dialog_failed = 1

cntl_error = 2

error_no_gui = 3

not_supported_by_gui = 4

others = 5.

if sy-subrc = 0.

if rc = 1.

read table filetable into wa_file index 1.

move wa_file-filename to p_file1.

endif.

endif.

Max

Message was edited by: max bianchi

12 REPLIES 12

Former Member
0 Kudos

Use FM

call function 'F4_FILENAME'

exporting

program_name = sy-cprog

dynpro_number = sy-dynnr

importing

file_name = s_path.

Former Member
0 Kudos

USe F4_FILENAME..

Plz reward points.

you also can use CL_GUI_FRONTEND_SERVICES=>FILE_OPEN_DIALOG

as in the working code below..

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.

Former Member
0 Kudos

Try to use WS_FILENAME_GET

call function 'WS_FILENAME_GET'

exporting def_filename = space

  • def_path =

mask = ',. ,..'

mode = 'O'

title = text-038

importing filename = os_name

  • RC = DUMMY

exceptions inv_winsys = 04

no_batch = 08

selection_cancel = 12

selection_error = 16.

or

at selection-screen on value-request for p_file1.

data wa_file like file_table.

refresh filetable.

call method cl_gui_frontend_services=>file_open_dialog

  • EXPORTING

  • WINDOW_TITLE =

  • DEFAULT_EXTENSION =

  • DEFAULT_FILENAME =

  • FILE_FILTER =

  • INITIAL_DIRECTORY =

  • MULTISELECTION =

  • WITH_ENCODING =

changing

file_table = filetable

rc = rc

  • USER_ACTION =

  • FILE_ENCODING =

exceptions

file_open_dialog_failed = 1

cntl_error = 2

error_no_gui = 3

not_supported_by_gui = 4

others = 5.

if sy-subrc = 0.

if rc = 1.

read table filetable into wa_file index 1.

move wa_file-filename to p_file1.

endif.

endif.

Max

Message was edited by: max bianchi

Former Member
0 Kudos

Hi Madan,

1. F4_DXFILENAME_TOPRECURSION

This is the FM.

(This is for app server)

regards,

amit m.

Former Member
0 Kudos

Have a look at this Forum thread:

Sudha

Former Member
0 Kudos

Hi Madan,

Please try FM F4_FILENAME.

This should sole ur problem.

Regards

Saurabh.

Former Member
0 Kudos

Hi,

Look at the example code..........

selection-screen: begin of block b2 with frame title text-002.

parameters: p_file type rlgrap-filename obligatory.

selection-screen: end of block b2.

----


at selection-screen on value-request for p_file.

----


call function 'F4_FILENAME'

exporting

field_name = 'p_file'

importing

file_name = p_file.

Start-of-selection.

call function 'WS_UPLOAD'

Thanx.

If this helps u reward with points.

Message was edited by: KDeepak

hymavathi_oruganti
Active Contributor
0 Kudos

hi it should be written under

AT SELECTION-SCREEN ON VALUE REQUEST FOR <PARAM>

jayanthi_jayaraman
Active Contributor
0 Kudos

Hi,

Here is the sample code.Kindly reward points by clikcing the star on the left of reply,if it helps.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_FILE.

  • F4 help for the flat file path - Presentation Serevr

PERFORM SUB_F4_FILEPATH USING 'P_FILE' P_FILE.

FORM SUB_F4_FILEPATH USING P_APPFILE P_PRESFILE.

CALL FUNCTION 'WS_FILENAME_GET'

EXPORTING

DEF_PATH = P_FILE

MASK = ',..'

MODE = '0 '

TITLE = 'Choose File'

IMPORTING

FILENAME = P_FILE

EXCEPTIONS

INV_WINSYS = 1

NO_BATCH = 2

SELECTION_CANCEL = 3

SELECTION_ERROR = 4

OTHERS = 5.

ENDFORM. " F4_FILEPATH

Former Member
0 Kudos

Hi Madan,

The FM KD_GET_FILENAME_ON_F4 will work. Check out if you are defined and passing the values properly.

variable to take the selected file name should be of type <b>RLGRAP-FILENAME</b>

Regards,

Raj

0 Kudos

It should work. Why do you say it is not working? We are using it in all our programs that upload files.

0 Kudos

Hi

Check out the code below and try the same

Regards

Santosh

V_FILENAME = 'C:\TEMP\MP CNCsftwBOMSTest.csv'.

CALL METHOD CL_GUI_FRONTEND_SERVICES=>FILE_SAVE_DIALOG

EXPORTING

WINDOW_TITLE ='PLC BOM file Upload in ".CSV" format.'

  • DEFAULT_EXTENSION =

DEFAULT_FILE_NAME = V_FILENAME

  • WITH_ENCODING =

  • FILE_FILTER =

  • INITIAL_DIRECTORY =

  • PROMPT_ON_OVERWRITE = 'X'

CHANGING

FILENAME = V_FILENAME

PATH = V_PATH

FULLPATH = V_FULLPATH

  • USER_ACTION =

  • FILE_ENCODING =

EXCEPTIONS

CNTL_ERROR = 1

ERROR_NO_GUI = 2

NOT_SUPPORTED_BY_GUI = 3

others = 4.

IF NOT V_FULLPATH IS INITIAL.

CALL FUNCTION 'GUI_UPLOAD'

EXPORTING

FILENAME = V_FULLPATH

FILETYPE = 'ASC'

HAS_FIELD_SEPARATOR = 'X'

  • HEADER_LENGTH = 0