Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

excel download

Former Member
0 Likes
621

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

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
589

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

3 REPLIES 3
Read only

Former Member
0 Likes
589

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

Read only

Former Member
0 Likes
590

Hi ,

You can use the FM ALSM_EXCEL_TO_INTERNAL_TABLE.

Regards

Arun

Read only

Former Member
0 Likes
589

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.