| |||||||||||||||
The following template works until V4.5A *** Internal table to be downloaded data: begin of z_sales occurs 10000, kunnr like kna1-kunnr, "Customer number name1 like kna1-name1, "Name end of z_sales. data: begin of t_colnames occurs 10, name(15), "Column names for download end of t_colnames.
selection-screen begin of block g2 with frame title text-001. parameters: p_print radiobutton group l1, “View p_down radiobutton group l1, “Download p_file like rlgrap-filename default 'C:\'. selection-screen end of block g2.
* Selection Screen processing * *----------------------------------------------------------------------* at selection-screen on p_file. * If download is checked, but no file name is entered, error if p_down eq 'X' and p_file eq space. message e000 with 'Please enter file name for download.'. endif.
*** Populate Itabs for download * Column names move 'Sold-to' to t_colnames-name. append t_colnames. move 'Name' to t_colnames-name. append t_colnames.
* Data move vbak-kunnr to zsales-kunnr. move kna1-name1 to zsales-name1. append zsales.
* Call function module to download file call function 'WS_DOWNLOAD' exporting filename = p_file filetype = 'DAT' * col_select = 'X' tables data_tab = z_sales fieldnames = t_colnames * EXCEPTIONS * FILE_OPEN_ERROR = 1 * FILE_WRITE_ERROR = 2 * INVALID_FILESIZE = 3 * INVALID_TABLE_WIDTH = 4 * INVALID_TYPE = 5 * NO_BATCH = 6 * UNKNOWN_ERROR = 7 * GUI_REFUSE_FILETRANSFER = 8 * OTHERS = 9 . if sy-subrc <> 0. message id sy-msgid type sy-msgty number sy-msgno with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4. endif. |
|