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: 

Download XLSX file using Open Dataset

Former Member
0 Kudos

Hi Guys,

I am downloading a XLSX file to a network drive using Open Dataset but the Excel is unable to open downloaded XLSX file. If XLS extension is used then Excel is able to open the file but not XLSX. Is there some way i can achieve this without using ABAP2XLS project?

Any help with the code would be greatly appreciated.

Thanks

7 REPLIES 7

Former Member
0 Kudos

XLSX is a zipped group of xml files. You can't simply send ASCII data to the .xlsx file. So no = there is no other way as using an external (3rd party) tool, as SAP does not support .xlsx natively.

ŁukaszPęgiel
Contributor
0 Kudos

As Jozef has pointed changing the extension will not change the file content. But you can try the solution from ABAP Blog - Create XLSX/MHTML file from internal table in background where if you have proper SAP version you can create XLSX, XML or MHTML excel files.

Regards

Łukasz

0 Kudos

Thanks for your reply, Lukasz.

I have seen this blog earlier but the problem is the code will eventually help to create file at Presentation Server but it will not work to create file at Application Server using Open Dataset.

0 Kudos

the method which creates xlsx is creating xstring, so you can write it to AS using open dataset in binary mode...

0 Kudos

If you check the below code, We have to assign a constant value of c_type_xlsx to file type but the problem is this constant is not available in my system which is SAP BASIS 701 release but it is available in SAP BASIS 730 release.

"if we flag i_XLSX then we'll create XLSX if not then MHTML excel file

    if i_xlsx is not initial.

      m_file_type = if_salv_bs_xml=>c_type_xlsx.

    else.

      m_file_type = if_salv_bs_xml=>c_type_mhtml.

    endif.

0 Kudos

In that case beside ABAP2XLSX I don't see any solution for you for real XLSX file in the background, if you run it in foreground then you can still use OLE or SOI (Sap Office Integration).

Regards

Lukasz

0 Kudos

Thanks for all your help.