‎2008 Feb 04 8:55 PM
Hi Experts,
I am trying to use the method GUI_UPLOAD of the class CL_GUI_FRONTEND_SERVICES.
But the problem is I am not getting a dialog box where we can select the file by browsing our computer.( like the browse button in Windows).
I remember getting this dialog box when using the FM WS_UPLOAD.
But this is obsolete and cannot use in Unicode programs.
What should I do? and how?
can anybody help me?
Thanks in advance.
Goldie.
‎2008 Feb 04 8:58 PM
May be this way
*&---------------------------------------------------------------------*
* At selection screen event *
*&---------------------------------------------------------------------*
at selection-screen on value-request for p_file1.
perform f_get_f4_filename using p_file1 changing p_file1.
*&---------------------------------------------------------------------*
* Form f_get_f4_filename *
*&---------------------------------------------------------------------*
* For F4 help for file name *
*&---------------------------------------------------------------------*
form f_get_f4_filename using pfile changing pfile1.
* Private Variables
data :v_subrc type i.
refresh : i_file1. clear i_file1.
call method cl_gui_frontend_services=>file_open_dialog
exporting
window_title = 'Select Files'
default_extension = '*.xls'
default_filename = '*.xls'
initial_directory = 'c:'
multiselection = ' '
changing
file_table = i_file1
rc = v_subrc
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.
loop at i_file1 assigning <fs>.
pfile1 = <fs>.
exit.
endloop.
else.
message id sy-msgid type sy-msgty number sy-msgno
with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
endif.
endform. " F_get_f4_filename
*
a®
‎2008 Feb 04 8:58 PM
May be this way
*&---------------------------------------------------------------------*
* At selection screen event *
*&---------------------------------------------------------------------*
at selection-screen on value-request for p_file1.
perform f_get_f4_filename using p_file1 changing p_file1.
*&---------------------------------------------------------------------*
* Form f_get_f4_filename *
*&---------------------------------------------------------------------*
* For F4 help for file name *
*&---------------------------------------------------------------------*
form f_get_f4_filename using pfile changing pfile1.
* Private Variables
data :v_subrc type i.
refresh : i_file1. clear i_file1.
call method cl_gui_frontend_services=>file_open_dialog
exporting
window_title = 'Select Files'
default_extension = '*.xls'
default_filename = '*.xls'
initial_directory = 'c:'
multiselection = ' '
changing
file_table = i_file1
rc = v_subrc
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.
loop at i_file1 assigning <fs>.
pfile1 = <fs>.
exit.
endloop.
else.
message id sy-msgid type sy-msgty number sy-msgno
with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
endif.
endform. " F_get_f4_filename
*
a®
‎2008 Feb 04 9:05 PM
Hi,
Why do we have to loop at i_file1.
wont we be selecting only 1 file?
‎2008 Feb 04 9:07 PM
Here
changing
file_table = i_file1
comes as a table. that's way. if you select MULTISELECTION = "X' you can select multiple files
a®
‎2008 Feb 04 9:13 PM
I got it now..
Thanks as/ars (sorry!! didn't quite understand your name.)