cancel
Showing results for 
Search instead for 
Did you mean: 

FileDownload control, filename problem

Former Member
0 Kudos

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

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

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.

Former Member
0 Kudos

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.

Former Member
0 Kudos

Hi Kris,

Thanks for your reply. The FileDownload control is just simpler, it don't have a property to set the code page. If there is no other property to use, I guess I can try to create a file from the content data and use a link to point to it. I'll try this.