on 04-25-2013 8:16 AM
Hi Experts!
I have followed this blog Upload and Download files in Webdynpro ABAP
Every thing works fine except when I download a file with Chinese name, the Chinese character will be replaced by '_', like ' _______.RAR'.
Are there any way to set the encode of file name?
Regards & Thanks
Wayne
Hi all,
Problem solved. I used a linktoaction control, and call
cl_wd_runtime_services=>attach_file_to_response(). This works fine.
See the full code here:
METHOD onactiondownload .
DATA lo_nd_n_file_download TYPE REF TO if_wd_context_node.
DATA lo_el_n_file_download TYPE REF TO if_wd_context_element.
DATA ls_n_file_download TYPE wd_this->element_n_file_download.
DATA lv_file_contents TYPE wd_this->element_n_file_download-file_contents.
DATA: lv_filename TYPE string.
DATA: lv_ctype TYPE string.
* navigate from <CONTEXT> to <N_FILE_DOWNLOAD> via lead selection
lo_nd_n_file_download = wd_context->get_child_node( name = wd_this->wdctx_n_file_download ).
* lo_el_n_file_download = lo_nd_n_file_download->get_lead_selection( ).
lo_el_n_file_download = wdevent->get_context_element( name = 'CONTEXT_ELEMENT' ).
* get single attribute
lo_el_n_file_download->get_attribute(
EXPORTING
name = `FILE_CONTENTS`
IMPORTING
value = lv_file_contents ).
lo_el_n_file_download->get_static_attributes(
IMPORTING
static_attributes = ls_n_file_download ).
lv_filename = ls_n_file_download-file_name.
lv_ctype = ls_n_file_download-file_type.
cl_wd_runtime_services=>attach_file_to_response(
EXPORTING
i_filename = lv_filename
i_content = lv_file_contents
i_mime_type = lv_ctype
i_in_new_window = abap_true ).
ENDMETHOD.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Wayne,
Please check this..
https://scn.sap.com/thread/1733334
https://scn.sap.com/thread/402709
But you can't use GUI specific functions in WDA, make a note.
Cheers,
Kris.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
93 | |
10 | |
10 | |
9 | |
9 | |
7 | |
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.