Quantcast
Channel: SCN : All Content - Web Dynpro ABAP
Viewing all articles
Browse latest Browse all 3667

Warning while downloading an Excel file from WD ABAP

$
0
0

Hi folks,

 

In one of requirements, Client wants to download all the data that is appearing on the screen ( WD ABAP Application ) to an Excel with a layout in different manner.

 

We achieved this with Simple Transformations.

 

Now the question is while downloading the excel file, the framework/other  is throwing an Warning like

 

" The file you are trying to open, 'info.xls', is in a different format than specified by the extension. Verify that the file is not corrupted and is from a trusted source before opening the file. Do you want to open the file now? "

 

Note: All the users of my client are using MS Office 2002 / 2003.

 

I am using the following code........!

 

*------ Call Transformation for Excel OUTPUT

  CALL TRANSFORMATION ZEXCEL_OUTPUT

      SOURCE

             t_dates     = t_dates

             t_info        = t_info

      RESULT XML l_xml_string.

 

REPLACE ALL OCCURRENCES OF '<?xml version="1.0" encoding="utf-16"?>'  l_xml_string WITH '<?xml version="1.0"?><?mso-application progid="Excel.Sheet"?>'.

 

**-- Call Function Module for converting string data to XSTRING

  CALL FUNCTION 'SCMS_STRING_TO_XSTRING'

    EXPORTING

      text           = l_xml_string

      mimetype = 'application/xml'

    IMPORTING

      buffer      = l_xml_xstring

    EXCEPTIONS

      failed   = 1

      OTHERS   = 2.

 

 

  CALL METHOD cl_wd_runtime_services=>attach_file_to_response

    EXPORTING

      i_filename       = 'info.xml'

      i_content        = l_xml_xstring

      i_mime_type   = 'application/vnd.ms-excel'.

 

 

 

With this code I am generating a file of type XML SPREADSHEET 2003. While opening this file I am getting the above message which the user unwanted......

 

Can any one help me on this -


> How to avoid this warning?

 

Thanks and Regards,

Aneel Danda

 

Edited by: danda aneel on Jul 13, 2010 1:43 PM


Viewing all articles
Browse latest Browse all 3667

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>