Application Development and Automation 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: 
Read only

Multiple file name selection

Former Member
0 Likes
1,280

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

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,007

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

4 REPLIES 4
Read only

Former Member
0 Likes
1,007

Try using CL_GUI_FRONTEND_SERVICES... this is really cool for frontend things.

Read only

former_member242255
Active Contributor
0 Likes
1,007

I think you need to handle only one file at a time.

It may not be possible for you to take multiple files./

Read only

0 Likes
1,007

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

Read only

Former Member
0 Likes
1,008

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