Saturday, March 15, 2014
CL_GUI_FRONTEND_SERVICE=>FILE_OPEN_DIALOG method is used to open file from the PC.



REPORT ztest_download.
"&-------------------------------------------------------------*
"& Declarations
"&-------------------------------------------------------------*

DATA:it_filetable TYPE filetable.
DATA ls_filetable LIKE LINE OF it_filetable.

DATA gv_rc TYPE i.
"&-------------------------------------------------------------*
"& Selection-screen
"&-------------------------------------------------------------*
PARAMETERS:
    p_file TYPE string.

"&-------------------------------------------------------------*
"& At Selection-Screen
"&-------------------------------------------------------------*

AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.

  CALL METHOD cl_gui_frontend_services=>file_open_dialog
    EXPORTING
      window_title            = 'Open file'
*    default_extension       =
*    default_filename        =
*    file_filter             =
*    with_encoding           =
*    initial_directory       =
*    multiselection          =
    CHANGING
      file_table              = it_filetable
      rc                      = gv_rc
*    user_action             =
*    file_encoding           =
*  EXCEPTIONS
*    file_open_dialog_failed = 1
*    cntl_error              = 2
*    error_no_gui            = 3
*    not_supported_by_gui    = 4
*    others                  = 5
          .
  IF sy-subrc <> 0.
* Implement suitable error handling here
  ELSE.
    READ TABLE it_filetable INTO ls_filetable INDEX 1.
    p_file = ls_filetable-filename.
  ENDIF.

0 comments:

Post a Comment

Your useful comments, suggestions are appreciated.Your comments are moderated.

Followers

Contact Form

Name

Email *

Message *

Web Dynpro ABAP Book

An SAP Consultant

Follow US


Want to Contribute ?

If you are interested in writing about the new stuff you learn everyday while working, please write to the.sap.consultants@gmail.com.

Click on Contribution for more details.