cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Download an internal table into excel file with extension '.xls'.

priyankav
Discoverer
0 Kudos
758

Hello experts,

My requirement is to download an internal table into excel file with extension '.xls'.  I have tried the below 3 ways to do it.

  1. Using FM ' SAP_CONVERT_TO_XLS_FORMAT '
  2. Using Class  cl_salv_table=>to_xml (Convert to xstring and download using GUI_download)
  3. Concatenate the texts into a string with separators tab space and new line. (then convert it to xstring and download using GUI_download).

With these methods, i can download the file successfully. But whenever i open it, i getting a pop up message "The file format and extension of 'File.xls' don't match. The file could be corrupted or unsafe. ". 

We should not get this pop-up message as bot will use the file in further process.

NOTE: I can create the file with (.xlsx) or (.csv) extension and i don't face this issue. But our clients want only in .xls format. I can try to convice them to use any other extension, but before that i would like to if it is possible to create the excel file with '.xls' extension and open it without the popup message.

I have searched to my best in the community but i got no solution for this. I can't use abap2xlsx as well.

Any suggestions will be appreciated.

 

Accepted Solutions (0)

Answers (1)

Answers (1)

RaymondGiuseppi
Active Contributor

XLS is (was) a Microsoft proprietary format, nowadays most tools use XLSX that is actually some packed file with some XML in it, among other items.

  • If you really require an actual XLS file, use OLE to execute Excel and can force the save format (usually with SAP GUI and Excel installed on your station)
  • Removing the warning message must be performed on Excel installations
  • Your customers don't understand what they're saying, but it's not a sales argument... 😋
priyankav
Discoverer
0 Kudos

Hi @RaymondGiuseppi, Thanks for your response. Yes, i am able to create file with '.xlsx' but facing only for '.xls'.  I explained them the issue is not with SAP and related to excel. Anyhow, I will try with the OLE method once.