‎2007 Jul 05 3:19 PM
Hi frnds,
I am using a parameter to extract a file from the local server. but i m not getting the way how to do that so that once i get the selection-screen if i press f4 it will ak for location where i can browse and give the file location.
I am not getting the logic for the same.
Thanks®ards,
suraj
‎2007 Jul 05 3:23 PM
Check with below logic :
parameters: p_name like rlgrap-filename
default 'C:\My Documents\InputFile.txt'.
possible entry list (F4 dropdown) for input file name
at selection-screen on value-request for p_name.
*-SELECT FILE FROM USERS LOCAL PC
call function 'WS_FILENAME_GET'
exporting
DEF_FILENAME = ' '
def_path = 'C:\Temp\'
mask = ',.,..'
mode = 'O'
title = 'Select File '(007)
importing
filename = p_name
RC =
exceptions
inv_winsys = 1
no_batch = 2
selection_cancel = 3
selection_error = 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.
*
also you can use f4_filename for F4
Thanks
Seshu
‎2007 Jul 05 3:24 PM
Hi
Try this:
PARAMETERS P_FILE(80) TYPE C.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_FILE.
DATA:
d_rc TYPE sysubrc,
d_title TYPE string,
t_files TYPE filetable,
s_files TYPE file_table.
* popup file open dialog
CALL METHOD cl_gui_frontend_services=>file_open_dialog
EXPORTING
window_title = 'Open file'
CHANGING
file_table = t_files
rc = d_rc
EXCEPTIONS
OTHERS = 1.
IF sy-subrc = 0.
IF d_rc > 0.
READ TABLE t_files INDEX 1 INTO s_files.
p_file = s_files-filename.
ENDIF.
ENDIF.Max
‎2007 Jul 05 3:28 PM
How about this.
[code]
report zrich_0001.
data: ifiletable type filetable.
data: xfiletable like line of ifiletable.
data: rc type i.
parameters: p_file1 type localfile default'C:\test.txt'.
at selection-screen on value-request for p_file1.
call method cl_gui_frontend_services=>file_open_dialog
EXPORTING
WINDOW_TITLE =
DEFAULT_EXTENSION =
DEFAULT_FILENAME =
FILE_FILTER =
INITIAL_DIRECTORY = 'C:\'
MULTISELECTION =
changing
file_table = ifiletable
rc = rc
USER_ACTION =
EXCEPTIONS
FILE_OPEN_DIALOG_FAILED = 1
CNTL_ERROR = 2
ERROR_NO_GUI = 3
others = 4.
.
read table ifiletable into xfiletable index 1.
if sy-subrc = 0.
p_file1 = xfiletable-FILENAME.
endif.
[/code
Regards,
Rich Heilman]