Application Development 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: 

Exporting a report to Excel

Former Member
0 Kudos

Hi Guys,

Is it possible for a simple report (NOT an ALV) to be exported into an excel file?

Please let me know how...

Thanks a lot!

Regards,

Mark

1 ACCEPTED SOLUTION

Former Member
0 Kudos

While doing tht report u will be getting the values into the internal table..

Bfr printing try to call the funtion module GUI_DOWNLOAD..

Give the file format as excel format..

First u use DOWNLOAD FM..After tht if its working fine u can call the FM GUI_DOWNLOAD..

Reward if useful!!!!!!!!1111

6 REPLIES 6

Former Member
0 Kudos

While doing tht report u will be getting the values into the internal table..

Bfr printing try to call the funtion module GUI_DOWNLOAD..

Give the file format as excel format..

First u use DOWNLOAD FM..After tht if its working fine u can call the FM GUI_DOWNLOAD..

Reward if useful!!!!!!!!1111

former_member188829
Active Contributor
0 Kudos

Hi,

Use The FM:

XXL_FULL_API

Former Member
0 Kudos

Hi,

Try using this fn module,

SAP_CONVERT_TO_XLS_FORMAT

This converts data to Microsoft Excel format.

Former Member
0 Kudos

Hi

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.

and try this

Try FM

XXL_FULL_API.

<b>Reward if usefull</b>

Former Member
0 Kudos

HI

you can do in this way also

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.

<b>Reward if usefull</b>

Former Member
0 Kudos

Hi Mark,

his function lets you export the entire report in XXL format (a special format for transferring data to a spreadsheet). This means that all characteristics of the report are available in the Excel List Viewer. This function makes it possible to execute a drilldown report in the Excel List Viewer. This factor distinguishes this function from the one which you can call up with transfer page to XXL

Note that if you wish to transfer a drilldown list, it may contain no more than 16 384 lines / 256 columns. The exact formula for the data transferred by the application is:

26 + number of data columns + 5 * ( 1 + number of characteristics) < 256

As this function transfers all columns in the report list, all columns also go into the formula (not just the columns currently displayed).

Note that for each column transferred, an additional column is transferred for the unit of measure.

Prerequisites

You can only transfer a report to XXL under the following conditions:

You are displaying a drilldown list in a report. This function is not possible for detail lists due to technical reasons.

You have set the report display to "Absolute" using the function Settings ® Percentage/absolute. Transfer to XXL is deactivated as soon as you switch the display to "Percentage".

You chose the setting 'Read all data' in the performance settings for the report. Reports, for which data is dynamically reloaded at each navigation step, cannot be transferred to XXL.

Procedure

In a dialog box, choose the characteristics you want to transfer. It is recommended that you choose the option "All characteristics". If the report list is so large that your spreadsheet program cannot process it, you should only choose some of the characteristics.

When you transfer a report to Microsoft Excel, the data you transfer can consist of up to 16,384 rows or 256 columns. The formula for calculating the amount of data transferred from the application is:

26 + number of data columns + 5 * (1 + number of characteristics) < 256

Since this function transfers all the columns of the report list, you can use all the columns in formulas, not just those on the displayed list.

Note that an additional column for the unit is transferred along with each normal column transferred.

If you have chosen a characteristic with a hierarchy display, you should note that it is not possible to display hierarchy lists in XXL in the same form as in R/3. The data is therefore transferred as if there were no hierarchical structure for this data.

If you use an operating system which does not let you operate a spreadsheet program, you can still transfer the report to XXL; however, you can only store the XXL object in SAPoffice or in a PC file.

Regards,

Chandru

Message was edited by:

Chandra Prakash