Register Login

SAP_CONVERT_TO_XLS_FORMAT Function Module

Updated Jul 23, 2018

Q How can I download my internal table into an Excel file?

SOLUTION

We can use the function module SAP_CONVERT_TO_XLS_FORMAT in order to download the internal table to an excel file.

Please use the code below in order to download your internal table into Excel file

call function 'SAP_CONVERT_TO_XLS_FORMAT'

exporting

i_field_seperator = '#'  //This denotes field seprator in internal table//

i_line_header = 'X'

i_filename = 'C:xyz.xls'

I_APPL_KEEP = ' '

tables

i_tab_sap_data = gt_itab "Internal table data

CHANGING

I_TAB_CONVERTED_DATA =

exceptions

conversion_failed = 1

others = 2

Q How to use FM SAP_CONVERT_TO_XLS_FORMAT?

SOLUTION

PARAMETERS: p_file LIKE rlgrap-filename DEFAULT 'c:tmptest.xls'.

DATA: t100_Lines TYPE STANDARD TABLE OF t001 WITH DEFAULT KEY.

SELECT * FROM t001 INTO TABLE t100_Lines.

CALL FUNCTION 'SAP_CONVERT_TO_XLS_FORMAT'

EXPORTING

i_filename = p_file

TABLES

i_tab_sap_data = t100_Lines.

 


×