cancel
Showing results for 
Search instead for 
Did you mean: 

Downloading data from sap memory to excel in ABAP

Former Member
0 Kudos

Hi,

I have created a dynamic internal table in an ABAP/4 report . I want to know if there is any way of downloading the contents of the dynamic internal table into an excel sheet.If any of you have done any programming of this sort kindly help me out.

Thanks & Regards,

Malathi V.

Accepted Solutions (1)

Accepted Solutions (1)

suresh_datti
Active Contributor
0 Kudos

Hi Malathi,

PL check the example in this <a href="http://www.thespot4sap.com/Articles/Download_to_excel.asp">Link</a>

Regards,

Suresh Datti

Answers (2)

Answers (2)

jaideeps
Advisor
Advisor
0 Kudos

hi,

use this function module..

''MS_EXCEL_OLE_STANDARD_DAT'''

thanks

jaideep

Former Member
0 Kudos

Hi ,

U can download the data Dynamically as below.

U need to concatenate each and every line of the

FM into an Internal table and call the Subroutine pool

where P_OUTFLE will be the file name ,

I_EXPORT_FILE is the dynamically generated table

and I_HEADER will be the dynamically generated header.

*-- Function module to write data to the Excel Sheet

concatenate 'CALL FUNCTION' '''MS_EXCEL_OLE_STANDARD_DAT'''

into v_file separated by space.

append v_file to it_tab.

append 'EXPORTING' to it_tab.

append 'FILE_NAME = P_OUTFLE' to it_tab.

append 'TABLES' to it_tab.

append 'DATA_TAB = I_EXPORT_FILE' to it_tab.

append 'FIELDNAMES = I_HEADER' to it_tab.

append 'EXCEPTIONS' to it_tab.

append 'FILE_NOT_EXIST = 1' to it_tab.

append 'FILENAME_EXPECTED = 2' to it_tab.

append 'COMMUNICATION_ERROR = 3' to it_tab.

append 'OLE_OBJECT_METHOD_ERROR = 4' to it_tab.

append 'OLE_OBJECT_PROPERTY_ERROR = 5' to it_tab.

append 'INVALID_FILENAME = 6' to it_tab.

append 'INVALID_PIVOT_FIELDS = 7' to it_tab.

append 'DOWNLOAD_PROBLEM = 8' to it_tab.

append 'OTHERS = 9' to it_tab.

append '.' to it_tab.

append 'ENDFORM.' to it_tab.

syntax-check for it_tab message v_f line v_g word v_h.

if sy-subrc <> 0.

message s000 with v_f.

exit.

endif.

generate subroutine pool it_tab name v_name.

Regards,

GSR.

Former Member
0 Kudos

Hi,

In my program i have created the dynamic table by pointer concept.

NEW_TABLE is a reference variable ( declared as DATA: new_table TYPE REF TO data.)

which is pointing to the dynamic internal table.

I want to download the contents of this pointer variable into excel sheet.

i cannot directly pass the pointer variable as value to the function 'MS_EXCEL_OLE_STANDARD_DAT'.

How should i proceed with it?

Thanks & Regards,

Malathi

Former Member
0 Kudos

Hi,

This all depends on the DATA declaration and the type

of programming used(Object oriented).

Just assign the table type(Filed symbol/Pointer

variable) to a variable and U can pass this table to

the FM.

Iam not sure how this works.

Regards,

GSR.