on 02-23-2007 7:55 AM
I would like to download an internal table from WD4A to Excel.
I am aware of the method cl_wd_runtime_services=>attach_file_to_response but I am only able to download one line of my internal table.
I have no idea how to attach the whole internal table to the method.
Is there anybody out there who could provide me the source of give me assistance in any other way?
Greetings,
Henry
Found the solution to my problem. Would like to thank everyone who offered help.
CONSTANTS:
crlf TYPE string VALUE cl_abap_char_utilities=>cr_lf,
tab TYPE string VALUE cl_abap_char_utilities=>horizontal_tab.
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 : lv_xstring TYPE xstring.
DATA : lv_text TYPE string.
CONCATENATE 'Artikel' tab
'Aantal' tab
'Omschrijving' tab
crlf
INTO lv_text.
LOOP AT lt_parts INTO ls_parts.
CONCATENATE lv_text
ls_parts-matnr tab
ls_parts-kwmeng tab
ls_parts-maktx tab
crlf
INTO lv_text.
ENDLOOP.
CALL FUNCTION 'SCMS_STRING_TO_XSTRING'
EXPORTING
text = lv_text
IMPORTING
buffer = lv_xstring
EXCEPTIONS
failed = 1
OTHERS = 2.
DATA: lv_filename TYPE string.
CONCATENATE 'Beheren_'
'partslocator_'
sy-datum
'_'
sy-uzeit
'.xls'
INTO lv_filename.
cl_wd_runtime_services=>attach_file_to_response(
i_filename = lv_filename
i_content = lv_xstring
i_mime_type = 'application/msexcel'
i_in_new_window = abap_true
i_inplace = abap_false ).
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Sachi,
As far as I can tell ALL data is filled in one column/cell.
I would like to download an ALV to Excel so every cell contains its appropriate value.
No luck so far....
Henry
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Henry,
Please find below the code snippet that might help you.
CALL FUNCTION 'WS_DOWNLOAD'
EXPORTING
FILENAME = 'C:\From_WD.CSV'
FILETYPE = 'ASC'
MODE = 'A'
TABLES
data_tab = lt_personal
.
The only issue is that this FM accepts data ina particular format. So if your internal table Lt_Data is something like:
Name Age Sex
Anoop 24 Male
Avi 24 Male
then you will need to create an internal table Lt_personal which will have data in this format:
Name,Age,Sex
Anoop,24,Male
Avi,24,Male
You will get the data in the format of Lt_Data.
Hope this helps.
Regards,
Anoop
Hi Henry,
U can probably use the way specified in the FileDownload view of the WDR_TEST_EVENTS example component. There u need to create a string attribute under under a node and provide a supply function to that node, in which u convert ur internal table to string format, then string into xstring format by using the convert() method and bind the resulting xstring to the context attribute, which in turn is bounded to the DATA property of the filedownload UI element.
By this way u can download the entire internal table values..
Regards,
Sachi
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
87 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.