Skip to Content
avatar image
Former Member

ABAP Webdynpro: Showing Junk while Downloading Japanese character to Excel

Hi All,

Can anyone tell me the exact procedure to download the Japanese characters into excel in ABAP WEBDYNPRO. Highly appreciate your feedback.

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • Best Answer
    avatar image
    Former Member
    Feb 07, 2014 at 03:31 AM

    I have got the answer, we need to pass MIME TYPE  'APPLICATION/MSEXCEL; charset=utf-16le' and add 'FFFE' in starting of hexadecimal output that we get after processing  function module SCMS_STRING_TO_XSTRING

    code is as below:

    CALL FUNCTION 'SCMS_STRING_TO_XSTRING'

           EXPORTING

             text     = text

             mimetype = lv_mimetype

    *     encoding = lv_encoding

           IMPORTING

             buffer   = lv_report_xstr

           EXCEPTIONS

             failed   = 1

             OTHERS   = 2.

         IF sy-subrc = 0.

           CONCATENATE cl_abap_char_utilities=>byte_order_mark_little

           lv_report_xstr

           INTO lv_report_xstr IN BYTE MODE.

         ENDIF.

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Aug 13, 2013 at 05:16 AM

    Hello Avinash,

    Refer this : http://scn.sap.com/thread/843382

    Thanks

    Katrice

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      Hi katrice,

      Thanks for your response, though i had already read the link that you have provided before posting my question on SCN.

      In the link, they have discussed a temporary solution where user has to go to three manual steps to see the japanese characters.

      Also, in SAP ABAP(not webdynpro) Its easily possible by passing encoding 4103 and file type ASC to FM GUI_DOWNLOAD.

      I need this solution in webdynpro ABAP. I have tried passing different encoding but with no success. Any help or suggestion will be highly appreciated.

      Anyways thanks once again Katrice.

      PS: My code is pasted below

         CALL FUNCTION 'SCMS_STRING_TO_XSTRING'

           EXPORTING

             text   = lv_report_str

            encoding = lv_encode

           IMPORTING

             buffer = lv_report_xstr.

      cl_wd_runtime_services=>attach_file_to_response(    i_filename  = lv_filename

                                                                                    i_content   = lv_report_xstr

                                                                                    i_mime_type = 'EXCEL' ).