Saturday, March 15, 2014
CL_GUI_FRONTEND_SERVICES=>GUI_DOWNLOAD method is used to download file into PC. This method uses GUI_DOWNLOAD function module.
REPORT ztest_download. "&-------------------------------------------------------------* "& Declarations "&-------------------------------------------------------------* TYPES: BEGIN OF ty_pa0001, pernr TYPE pa0001-pernr, bukrs TYPE pa0001-bukrs, werks TYPE pa0001-werks, persg TYPE pa0001-persg, ename TYPE pa0001-ename, END OF ty_pa0001. DATA:it_pa0001 TYPE STANDARD TABLE OF ty_pa0001. DATA:wa_pa0001 TYPE ty_pa0001. "&-------------------------------------------------------------* "& Start Of selection "&-------------------------------------------------------------* START-OF-SELECTION. SELECT pernr bukrs werks persg ename FROM pa0001 INTO TABLE it_pa0001 UP TO 100 ROWS. CALL METHOD cl_gui_frontend_services=>gui_download EXPORTING * BIN_FILESIZE = filename = 'C:\IT0001.txt' filetype = 'ASC' * APPEND = SPACE write_field_separator = 'X' * HEADER = '00' * TRUNC_TRAILING_BLANKS = SPACE * WRITE_LF = 'X' * COL_SELECT = SPACE * COL_SELECT_MASK = SPACE * DAT_MODE = SPACE * CONFIRM_OVERWRITE = SPACE * NO_AUTH_CHECK = SPACE * CODEPAGE = SPACE * IGNORE_CERR = ABAP_TRUE * REPLACEMENT = '#' * WRITE_BOM = SPACE * TRUNC_TRAILING_BLANKS_EOL = 'X' * WK1_N_FORMAT = SPACE * WK1_N_SIZE = SPACE * WK1_T_FORMAT = SPACE * WK1_T_SIZE = SPACE * SHOW_TRANSFER_STATUS = 'X' * FIELDNAMES = * WRITE_LF_AFTER_LAST_LINE = 'X' * VIRUS_SCAN_PROFILE = '/SCET/GUI_DOWNLOAD' * IMPORTING * FILELENGTH = CHANGING data_tab = it_pa0001 * EXCEPTIONS * FILE_WRITE_ERROR = 1 * NO_BATCH = 2 * GUI_REFUSE_FILETRANSFER = 3 * INVALID_TYPE = 4 * NO_AUTHORITY = 5 * UNKNOWN_ERROR = 6 * HEADER_NOT_ALLOWED = 7 * SEPARATOR_NOT_ALLOWED = 8 * FILESIZE_NOT_ALLOWED = 9 * HEADER_TOO_LONG = 10 * DP_ERROR_CREATE = 11 * DP_ERROR_SEND = 12 * DP_ERROR_WRITE = 13 * UNKNOWN_DP_ERROR = 14 * ACCESS_DENIED = 15 * DP_OUT_OF_MEMORY = 16 * DISK_FULL = 17 * DP_TIMEOUT = 18 * FILE_NOT_FOUND = 19 * DATAPROVIDER_EXCEPTION = 20 * CONTROL_FLUSH_ERROR = 21 * NOT_SUPPORTED_BY_GUI = 22 * ERROR_NO_GUI = 23 * others = 24 . IF sy-subrc <> 0. * Implement suitable error handling here ELSE. WRITE :/ 'Successfully downloaded'. ENDIF.
Followers
Popular Posts
- ABAP - ALV Report example with steps
- ABAP - Step by step tutorial on Smart Forms - Template Node
- ABAP - Sending email with pdf attachment
- SAP Adobe Form - Steps to create simple ADOBE Form and calling it from ABAP Program
- SAP ABAP - CL_ABAP_CHAR_UTILITIES class usage
- ABAP - Multiple value selection from F4 help for SELECT-OPTIONS
- Execute ABAP Report using SUBMIT statement
- ABAP - Select all or Deselect all in ALV or Check box handling in ALV
- Web Dynpro ABAP ALV - ON_CLICK event
- ABAP - Dynamic WHERE clause
0 comments:
Post a Comment
Your useful comments, suggestions are appreciated.Your comments are moderated.