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

Exporting Classical Report to Excel

Former Member
0 Likes
1,316

Hi,

I have a classical report in which I am adding a Button "Export to Excel". Now, if I click that button, I should be able to export my Classical Report to excel. Can somebody please help me on this.

Thanks,

Venkat.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
885

Hi Phani,

Try FM

XXL_FULL_API.

regards,

Paras Gupta

Hi,

I have a classical report in which I am adding a Button "Export to Excel". Now, if I click that button, I should be able to export my Classical Report to excel. Can somebody please help me on this.

Thanks,

Venkat.

5 REPLIES 5
Read only

naimesh_patel
Active Contributor
0 Likes
885

You can do it with the FM GUI_DOWNLOAD.

Do like this:

AT USER-COMMAND.
  CASE SY-UCOMM.
    WHEN 'EXCEL'.

DATA: BEGIN OF it_fieldnames occurs 0, "saving the log file structure
l_f(256) TYPE c,
END OF it_fieldnames.

it_fieldnames = 'Field1'.
Append it_fieldnames.
 
it_fieldnames = 'Field2'.
append it_fieldnames.

 CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
filename = P_FNAME
filetype = 'DATE'
TABLES
data_tab = IT_DATA    " << data tab
fieldnames = it_fieldnames    " << for header
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
OTHERS = 8.
IF sy-subrc <> 0.
MESSAGE e999 WITH 'Error File Write Error: ' sy-subrc.
ENDIF.
ENDCASE.

Regards,

Naimesh Patel

Read only

Former Member
0 Likes
886

Hi Phani,

Try FM

XXL_FULL_API.

regards,

Paras Gupta

Read only

Former Member
0 Likes
885

Hi,

assign a function code to your button & call any one of the following fn modules,

SAP_CONVERT_TO_XLS_FORMAT - it converts data to Microsoft Excel format.

RH_START_EXCEL_WITH_DATA - it starts microsoft excel with the contents of an internal table.

Read only

Former Member
0 Likes
885

Thanks for your rewards....

paras

Read only

Former Member
0 Likes
885

HI

use this function module

XXL_FULL_API

with this you can send output of a report to the excel sheet

<b>Reward if usefull</b>