on 10-17-2011 1:26 PM
Hi All,
A requirement is to download the contents of internal table to excel.
CALL FUNCTION 'SOTR_SERV_TABLE_TO_STRING'
IMPORTING
text = l_text
TABLES
text_tab = lt_tab.
CALL FUNCTION 'SCMS_STRING_TO_XSTRING'
EXPORTING
text = l_text
IMPORTING
buffer = lv_xstring_data
EXCEPTIONS
failed = 1
OTHERS = 2.
CALL METHOD cl_wd_runtime_services=>attach_file_to_response
EXPORTING
i_filename = 'Excel.xls'
i_content = lv_xstring_data
i_mime_type = 'EXCEL'.
The problem is the internal table contains a field with numeric value. Say my internal table has a value of 1.00, when this is downloaded, the values is becoming 1. The decimal fields are removed.
Any idea on how this should be handled?
Thanks,
Louisse
Hi All,
>
> A requirement is to download the contents of internal table to excel.
>
> CALL FUNCTION 'SOTR_SERV_TABLE_TO_STRING'
> IMPORTING
> text = l_text
> TABLES
> text_tab = lt_tab.
>
> CALL FUNCTION 'SCMS_STRING_TO_XSTRING'
> EXPORTING
> text = l_text
> IMPORTING
> buffer = lv_xstring_data
> EXCEPTIONS
> failed = 1
> OTHERS = 2.
>
> CALL METHOD cl_wd_runtime_services=>attach_file_to_response
> EXPORTING
> i_filename = 'Excel.xls'
> i_content = lv_xstring_data
> i_mime_type = 'EXCEL'.
>
Hi,
have you concatenate l_text with the contents. ,like .,
loop at LT_SFLIGHT into LS_SFLIGHT.
concatenate l_text LS_SFLIGHT-CARRID
LS_SFLIGHT-CONNID
LS_SFLIGHT-FLDATE
LS_SFLIGHT-CURRENCY
LS_SFLIGHT-PLANETYPE
CL_ABAP_CHAR_UTILITIES=>NEWLINE into l_text separated by
CL_ABAP_CHAR_UTILITIES=>HORIZONTAL_TAB.
endloop.
After this now pass l_text to FM SCMS_STRING_TO_XSTRING .
hope this helps you.
Thanks & Regards,
Kiran
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Louisse,
Check there are some good points was posted by micahel in the wiki.
[Download Into Excel|http://wiki.sdn.sap.com/wiki/display/ABAP/ExportingdatatoExcel-XMLtotherescue]
Regards,
Madhu.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
94 | |
11 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.