on 07-12-2007 3:07 PM
Hi Experts ,
I have to download an internal table to an excel sheet. I have tried the code given below.
But this is not giving me desired output in excel.
method ATTACH_FILES .
*data:
conv_out type ref to cl_abap_conv_out_ce,
content type xstring.
*
*
*
*
conv_out = cl_abap_conv_out_ce=>create( encoding = 'UTF-8' ).
*
data : itab_sflight type table of sflight.
data: xml_out TYPE string.
data: conv_out type ref to cl_abap_conv_out_ce.
data: content1 type xstring.
import itab_sflight1 to itab_sflight from MEMORY ID 'ZCA'.
call transformation ('ID') source tab = itab_sflight result xml xml_out.
conv_out = cl_abap_conv_out_ce=>create( encoding = 'UTF-8' ).
CALL FUNCTION 'SCMS_STRING_TO_XSTRING'
EXPORTING
text = xml_out
MIMETYPE = ' '
ENCODING =
IMPORTING
BUFFER = content1
EXCEPTIONS
FAILED = 1
OTHERS = 2
.
attach the first file
conv_out->convert( exporting data = content1 ).
cl_wd_runtime_services=>attach_file_to_response(
i_filename = 'file1.XLS'
i_content = content1
i_mime_type = 'application/msexcel'
i_in_new_window = i_in_new_window
i_inplace = i_inplace ).
endmethod.
The output in excel is coming in Xml format.
like <carrid>lh<\carrid><seatno>value<\seatno> and so on
Thanks in advance.
Hello shaheen,
yups i have same problem here.See if you try to open up your XML output
in MS- Excel 2003 version (11.8117.8107 OR later ) SP2 you will face problem beacuse excel will not ask you for wherther you want to open file as "XML LIST".But my colleague in diffrent country they have version 2003 (11.5612.5606)
you can see its not the latest whenever they open downloaded file,excel ask them to open in "XML LIST" and output is perfect.So i guess its problem with EXCEL.
NIRAD
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Nirad,
I dont know in what version will the client work on.
So is it not possible to get the output irrespective of the version of the excel?
Also i have a 2002 version SP3 excel and it doesnt show me the output .
It says the file cant be opened because:
Invalid at the top level of the document.
Kindly update me if you get to know more about this.
Regards,
Shaheen
User | Count |
---|---|
90 | |
10 | |
10 | |
10 | |
7 | |
7 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.