‎2010 Dec 22 10:26 AM
Hi
we were using FM "WS_FILENAME_GET" to get the name of file but now my requirement has changed now I can select more than one file at once wit the help of ctrl key . this FM is not able to do so.
Can any one help me in doing this.
Thanks in advance
Edited by: Suchender Dagar on Dec 22, 2010 11:29 AM
‎2010 Dec 22 1:10 PM
Don't use WS_ Fms anymore......These are obsolete......
Use method FILE_OPEN_DIALOG of class CL_GUI_FRONTEND_SERVICES......Use parameter MULTISELECTION and get all the file names in FILE_TABLE.......
‎2010 Dec 22 10:35 AM
Try using CL_GUI_FRONTEND_SERVICES... this is really cool for frontend things.
‎2010 Dec 22 10:36 AM
I think you need to handle only one file at a time.
It may not be possible for you to take multiple files./
‎2010 Dec 22 10:53 AM
Hi,
Please declare filepath variable as :-
select-OPTIONS p_cucrin FOR dbtable-string NO INTERVALS..
Then use below code :-
CONSTANTS :c_txt(4) TYPE c VALUE '.txt'.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_cucrin-low.
DATA: is_file_tab TYPE filetable.
DATA: w_default_extension TYPE string VALUE c_txt.
DATA: is_file_line TYPE file_table.
DATA: w_rc TYPE i.
CLEAR : is_file_tab,
is_file_line.
CLEAR: w_rc,
w_default_extension.
CALL METHOD cl_gui_frontend_services=>file_open_dialog
EXPORTING
default_extension = w_default_extension
multiselection = abap_false
CHANGING
file_table = is_file_tab
rc = w_rc
EXCEPTIONS
file_open_dialog_failed = 1
cntl_error = 2
error_no_gui = 3
not_supported_by_gui = 4
OTHERS = 5.
IF sy-subrc EQ 0.
*w_rc will hold number of filepaths probably
Loop at is_file_tab INTO is_file_line . " This table will hold the filepaths row by row.
MOVE is_file_line-filename TO p_cucrin. " move this as per your requirement to diff fields
ENDLOOP
ENDIF.
Using above code will provide you filepath length as 1024 characters with F4 help option. also multiple values can be provided to filepath selection screen field. Pass the file names to GUI_UPLOAD FM.
Thanks,
Rupali
Edited by: Rupali Punekar on Dec 22, 2010 11:55 AM
‎2010 Dec 22 1:10 PM
Don't use WS_ Fms anymore......These are obsolete......
Use method FILE_OPEN_DIALOG of class CL_GUI_FRONTEND_SERVICES......Use parameter MULTISELECTION and get all the file names in FILE_TABLE.......