on 06-25-2008 7:09 PM
hi i i've the following problem, i need download i fiel into web dynpro application i'm using file download action but thios action request me a node with suply file and a component of type xstring but when i invoke the follow code i can't insert the context from a internal an d i need download the context of the table from webdynpro
data conv_out type ref to cl_abap_conv_out_ce.
data struct type if_main=>element_file_suply.
fill the file content
conv_out = cl_abap_conv_out_ce=>create( encoding = 'UTF-8' ).
conv_out->convert(
exporting
data = here data
importing
buffer = struct-file ).
node->bind_structure( struct ).
so i need download a table with all the column inside anyone know how i can do it
Well what kind of file are you wanting to create? You have the correct logic to convert a string to a Unicode UTF-8 binary string, but that isn't going to accpet an internal table. Usually if you are starting with an internal table, you need to format it into a string in some way. Most people loop through the data and convert it to a text tab delimited or something like that which Excel can open. It really depends upon how you want to work with the data once it is downloaded.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
thank your answers were very helpful thanks
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
i need download the file in txt format
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi John
You can use following funcntions. First one to create internal table to string and second FM SCMS_STRING_TO_XSTRING to convert String to XSTRING. Then this XSTRING value you can pass to CL_WD_RUNTIME_SERVICES=>ATTACH_FILE_TO_RESPONSE. here i created small test code. may be helpful for you.
data: tab_str type string.
data: begin of it_tab1,
name(20),
age(10) ,
end of it_tab1.
data : lv_name type xstring.
data it_tab like STANDARD TABLE OF it_tab1.
data: wa like line of it_tab.
wa-name = 'naresh'.
wa-age = '30'.
append wa to it_tab.
wa-name = 'naresh1'.
wa-age = '31'.
append wa to it_tab.
CALL FUNCTION 'SOTR_SERV_TABLE_TO_STRING'
IMPORTING
TEXT = tab_str
TABLES
TEXT_TAB = it_tab
.
CALL FUNCTION 'SCMS_STRING_TO_XSTRING'
EXPORTING
TEXT = tab_str
IMPORTING
BUFFER = lv_name
.
CALL METHOD CL_WD_RUNTIME_SERVICES=>ATTACH_FILE_TO_RESPONSE
EXPORTING
I_FILENAME = 'c:\test.txt'
I_CONTENT = lv_name
I_MIME_TYPE = 'TXT'
Regards
Naresh
User | Count |
---|---|
93 | |
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.