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

File upload interface with gui_upload

Former Member
0 Likes
2,471

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.

1 ACCEPTED SOLUTION
Read only

former_member194669
Active Contributor
0 Likes
1,104

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®

4 REPLIES 4
Read only

former_member194669
Active Contributor
0 Likes
1,105

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®

Read only

0 Likes
1,104

Hi,

Why do we have to loop at i_file1.

wont we be selecting only 1 file?

Read only

0 Likes
1,104

Here


   changing
      file_table              = i_file1

comes as a table. that's way. if you select MULTISELECTION = "X' you can select multiple files

a®

Read only

0 Likes
1,104

I got it now..

Thanks as/ars (sorry!! didn't quite understand your name.)