cancel
Showing results for 
Search instead for 
Did you mean: 

Export To Excel Sheet

Former Member
0 Kudos

Hello Experts,

I have a requirements like , i am displaying the output in a Table and now i want to export the output to the excel sheet.

I ve all the data in an internal table which are displaying as a output.And i ve created a button and put a action on that .

So now i ve to write the code for the download.

Please help me on this .

Reward point is sure .

Regards,

Satya

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

I implemented the ALV table i which the Export to ecel sheet is coming autometically..

Thansks Gurus for you support.

Satya

Former Member
0 Kudos

Hi,

Instead of table Ui element, you could use the ALV table. ALV has inbuilt functionality to transfer the ALV table contents to Excel.

Shruthi

thomas_jung
Developer Advocate
Developer Advocate
0 Kudos

I am assuming that the actual download of the content probably isn't your problem. You can do that simple enough using the CL_WD_RUNTIME_SERVICES API and method ATTACH_FILE_TO_RESPONSE:

[http://help.sap.com/saphelp_nw70/helpdata/EN/47/a8d95673b12fe2e10000000a42189d/frameset.htm|http://help.sap.com/saphelp_nw70/helpdata/EN/47/a8d95673b12fe2e10000000a42189d/frameset.htm]

Now the actual conversion of the data to a format that excel can handle is generally the more difficult part. Inside the ALV Component, the coding uses an XSLT to transform the data into the Excel XML format. You could study that solution, maybe even replicate parts of it. However it is designed to use the internal WD ALV format as its source and not an ABAP internal table, so you might run into complications.

In the past I have simply built a text tab delimited stream in memory via concatenations. I have a couple blogs on the subject of how to do this. I was doing it in BSP, but the process is really quite similar up to the point where you process the download itself (which is simpler in WDA because you have the nice API that I mentioned above). You might find these helpful:

[/people/thomas.jung3/blog/2004/08/09/bsp-download-to-excel-in-unicode-format|/people/thomas.jung3/blog/2004/08/09/bsp-download-to-excel-in-unicode-format]

[/people/thomas.jung3/blog/2004/09/02/creating-a-bsp-extension-for-downloading-a-table|/people/thomas.jung3/blog/2004/09/02/creating-a-bsp-extension-for-downloading-a-table]