2006 Dec 07 11:47 AM
Hi all,
I want to download file from report to an excel file. The path to download will be given through selection screen. Could anyone explain how to do the same.
Thanks in advance,
John
2006 Dec 07 11:49 AM
Hi ,
You can use the FM ALSM_EXCEL_TO_INTERNAL_TABLE.
Regards
Arun
Hi all,
I want to download file from report to an excel file. The path to download will be given through selection screen. Could anyone explain how to do the same.
Thanks in advance,
John
2006 Dec 07 11:48 AM
Hi,
Refer the link:
http://www.sap-img.com/abap/download-to-excel-with-format-border-color-cell-etc.htm
Please use the following FM
CALL FUNCTION 'SAP_CONVERT_TO_XLS_FORMAT'
EXPORTING
I_FIELD_SEPERATOR =
I_LINE_HEADER =
i_filename =
I_APPL_KEEP = ' '
tables
i_tab_sap_data =
CHANGING
I_TAB_CONVERTED_DATA =
EXCEPTIONS
CONVERSION_FAILED = 1
OTHERS = 2
.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
Another FM
MS_EXCEL_OLE_STANDARD_DAT
A simple option:
a) form download_file .
call function 'WS_EXCEL'
importing
filename = excel_name
tables
data = itab.
b) call function 'WS_DOWNLOAD'
exporting
filename = o_file
filetype = 'DAT'
tables
data_tab = i_tab
exceptions
file_open_error = 1
file_write_error = 2
invalid_filesize = 3
invalid_type = 4
no_batch = 5
unknown_error = 6
invalid_table_width = 7
gui_refuse_filetransfer = 8
customer_error = 9
no_authority = 10
others = 11.
if sy-subrc = 0.
message 'File is downloaded successfully' type 'I'.
endif.
Reward points if this Helps.
Manish
2006 Dec 07 11:49 AM
Hi ,
You can use the FM ALSM_EXCEL_TO_INTERNAL_TABLE.
Regards
Arun
2006 Dec 07 12:05 PM
In the report program create a generic internal table and populate it with the report data. After that call FM WS_EXCEL and give the internal table as the parameter. It will donload the data in excel.