GUI Download Chinese Character to Excel gibberish character

Hi Experts,
I'm facing a problem where I'm using FM gui_download to save Chinese Character into Excel file.
Upon double click to open the excel file, funny character shows up.
But if I were to open the same file using a blank Ms Excel application (Go to File->Open->choose file),
Excel will prompt me to select a proper encoding (GB2312 in this case), and the Chinese character can be seen thereafter.
But, my user doesn't want to go through this.
I've browsed through the forum and someone has posted about this before and it's unanswered.
How to download the chinese character using GUI_DOWNLOAD - unanswered
And, Re: GUI_DOWNLOAD give 2 bytes for each chinese character - I need fixed len which is not related to my problem.
Below is my code:
DATA: lv_codepage   TYPE cpcodepage,
        lv_char_cpage TYPE abap_encod,
        lv_encoding   TYPE abap_encod.
Get Code Page for Chinese Character Spras = '1' or 'ZH'
  CALL FUNCTION 'NLS_GET_FRONTEND_CP'
    EXPORTING
      langu                 = '1'   " Chinese Simplified Table T002
      fetype                = 'MS'  " Manufacturer is Microsoft Table TCP05
    IMPORTING
      frontend_codepage     = lv_codepage
    EXCEPTIONS
      illegal_syst_codepage = 1
      no_frontend_cp_found  = 2
      internal_or_db_error  = 3
      OTHERS                = 4.
Conversion c(4) = n(10)
  lv_char_cpage = lv_codepage.
  CALL FUNCTION 'GUI_DOWNLOAD'
    EXPORTING
      filename                = p_file
      filetype                = 'DAT'                       "tried ASC and not working as well
      codepage                = lv_char_cpage   "8404 in this case tried 8400 and same result
      replacement             = '#'
      write_field_separator   = 'X'
    TABLES
      data_tab                = i_data_cnvr        "table content
      fieldnames              = i_data_head      "table header
Please help. Does this has something to do with utf-8 encoding?
Thank you.
Thanks,
ZY See

Hi Nitesh,
Is there a way to check the Excel codepage? Do you mean by codepage = 936 for GB2312 encoding?
Anyway, this issue is fixed. Issue is related to unicode system.
Below codes for gui_download solved the problem.
CALL FUNCTION 'GUI_DOWNLOAD'
    EXPORTING
      filename                = p_file
      filetype                = 'DAT'
      codepage                = '4103'
      replacement             = '#'
      write_field_separator   = 'X'
      write_bom               = 'X'
    TABLES
      data_tab                = i_data_cnvr
      fieldnames              = i_data_head
Codepage = 4103 for utf-16 Unicode system.
Write-bom = 'X' to write Byte-Order-Mark.
Thanks,
ZY See

Similar Messages

  • Downloading chinese character

    I am downloading vendor names using dataset.
    Sap is non unicode. I am loggin on in english language (EN)
    In the program i am writing open dataset encoding UTF-8.
    But the vendor names in chinese doesnot download in correct format.
    What do i need to do?

    When you download in Excel, the character formats are taken from the Front end, besure that the chinese font is installed in your system, i.e. you OS should support the lanagugae format you are downloading to.
    <b>better that u contect ur basis peson to solve ur problem...</b>

  • Data upload Vendor Master Chinese character from Excel does not upload

    Hi Gurus,
    We are trying to upload Vendor Master from Excel sheet.
    The Chinese characters in excel sheet is not getting uploaded.
    After upload, we see in SAP as ????? for these Chinese character.
    Could any one inform what setting I may need to change?
    Thanks and Best Regards,
    Mohan

    Hi Bala,
    Goto he Initial screen of SAP and click the ALT+F12    costomizating of local setup.the choose the options-->choose the I18N Tab in that POP up and check the Activate the multi byte support.
    press Apply and OK.
    close the  SAP Log on and Re-loag on.if u r not closing the Logon screen the changes wiil not effect.
    or
    click on the log on SAP and choose the server  name -->right click ->Properties>chose the log on language as chanies .-->Apply and Logon.
    Now u can eassily Upload to the Excel in checnies language.
    Thanks & REgards,
    Nelson.

  • Header in Excel when downloading using GUI DOWNLOAD

    Hi,
    I have a requirement where i need to download data from table into an excel sheet on a location in PC. I used FM 'GUI DOWNLOAD' for this purpose. Now, i need a header to be displayed in the excel when i download. The header should contain a date which is entered during the execution as a screen input. How to display this date as a header in the excel sheet when using GUI DOWNLOAD.

    Hi,
    If you only want the header to be displayed in the first row, you can do as suggested by Ikshula.
    If you want a real excel header, you can use OLE and set the property ActiveSheet.PageSetup.LeftHeader (or CenterHeader, or RightHeader) to the value "&D". This will add the current system date as header (you can of course pass any other value between the " ").
    Kr,
    m.

  • Problem while downloading Chinese chatracters into an excel file

    Hi All ,
      While downloading Chinese characters into an excel file , using GUI_DOWNLOAD function module , im getting JUNK Characters instead of chinese characters.
      But if im downloading the same chinese data into an text file or unix file , there is no such problem.
    Thanks in advance and points will be rewarded for helpful answer.
    Regards,
    K.S.R

    Hi, I have the same problem. Anyone has solution now?
    Wu Hao
    2008/08/21

  • Download report with chinese word into Excel

    Hi all,
    I need to create a report with Chinese header title, how can I put in these chinese word in my report?
    And after all, I will need to download this report to Excel sheet.
    I 'm using function GUI_DOWNLOAD to download the report to excel, but the chinese words display as ############## in the excel sheet.
    How can I solve this 2 problems?
    Kindly help !
    Thanks in advance.
    Jane.

    hi
    good
    We need to include CODE PAGE in the FM. This will help SAP to under the language which you are uploading.
    Use GUI_UPLOAD FM to upload the excel sheet. This has a parameter CODE PAGE, which you can pass to the FM.
    thanks
    mrutyun^

  • Get Directory name in Chinese and Chinese chars to Excel

    Hi,
    <b>Question:1</b>
    I use "cl_gui_frontend_services=>directory_browse"
    to get the Directory name from the presentation server.
    It works good for the directory names in English.
    However I need to perform a similar operation when the
    user has logged in "<b>Chinese</b>" at OS level,
    say Chinese Version of Windows. In this case this FM
    doesn't get properly the directory names in chinese.
    This might be  because the directory name is of type
    string. is there any other way to achieve this?
    SAP Ver: 4.7
    <b>Question:2</b>
    I need to download chinese description to an excel file from an internal table. I could able to achieve this when I use Chinese version of windows and log into SAP in <b>'ZH'</b>.
    I agree that to see the chinese characters properly we may need to log in the chinese version of Windows. But I don't understand the reason that why do we need to log into chinese version of SAP? i.e 'ZH'. I have decla=red the description field as character in the internal table declaration and in the FM 'GUI_DOWNLOAD', I specify the file type as <b>'ASC'</b>. Any clues on this to get this executed being logged in <b>EN</b> version of SAP?
    Thanks,
    Siva

    Hey there KCR875015,
    It sounds like like you need to change the language your iPad is set to, but you cannot understand the language it currently is. The following article should help you do that:
    iOS: How to change the language when it's set to one you don't understand
    http://support.apple.com/kb/ht2371
    Thank you for using Apple Support Communities.
    All the best,
    Sterling

  • How to download the values to excel from spool sap abap

    Dear All,
    I am facing  a problem in downloading the Zreport to excel file ( where it consists of 95 fields) ,
    1.if am running the report in foreground and downlaod to excel file , the all 95 fields are upadting in excel file .
    2.if i am schecduling the programe in background and saving inspool, then form spool , i am download to excel file , at that time some of the fields are overllapning ,
    for this i want to download t o excel file without overlapping fields,
    can any one suggest , how to do same procedue.
    regards,
    manoranjan

    Hi,
    whenever you click on Excel download option select spreadsheet instead of unconverted
    There is a possibility of download the spool file as txt-file. .
    Use Tranx SP01 - select the spool entry -->"spool request --> forward as text . You will find the file in your SAP work directory as <sid><spool#>.
    or use fm RSPO_DOWNLOAD_SPOOLJOB.
      Download in Background in Excel Format
    How to download the data in excel format directly while executing in background mode? 
    If you will execute it in bacground with ws_download or download, it will be aoutomatically cancel. so what is the procedure to do this.  How is can directly read the spool from program?
    Download from background is possible, if you could setup the environment
    1. create a custom table first
        Table  : Y001
        Displayed fields:   4 of   4  Fixed columns:
           MANDT BNAME       Y_SITE    Y_PATH
           010      <userid>     <site>      cd <novell_path>
    2. rewrite ws_download to z_download (light modification required, see attachment)
    3. ask your basis team to make a copy of command FTP and CHMOD to ZFTP and ZCHMOD resp., make the setting according to your environment.
    Moderator message - Please respect the 5,000 character maximum when posting. Post only the relevant portions of code
    Hope this will will helps you,
    Thanks and Regards,
    Manjunath M
    Edited by: manjunath4sap on Dec 23, 2010 6:20 PM
    Edited by: Rob Burbank on Dec 23, 2010 9:02 PM

  • Download alv report in excel format in Linux

    Hi All,
    I am working on SAP GUI for Java in Linux PC. I have installed
    Open Office.
    After executing an alv report there is no spreadsheet option
    to download the report in excel format .
    Also, when doing Save as Local File -> Spreadsheet ,
    the report is not downloaded in proper format.
    So, how to download the alv reports in excel format ?

    Hi Vinod ,
    Save as Local File -> Spreadsheet
    It will ask for Directory and file name with .xls format . Give proper name e.g. test.xls and save, and after saving file right click on the file and click on Open with "OpenOffice.org calc".
    It will definetly work.
    Abhijeet

  • How to come bak on Selcton Scrn in case of err while using Gui Download

    Hi All,
               I am using GUI Download function in my report.Now i f the excel to which i am donloading is already open there comes an error message saying 'Access to file is denied' and program is terminated.Is there any way so that after the error message program comes to Selection Screen only.
    Thanks in Advance,
    Saket.

    Hi Saket.....
    In case of error i.e sy-subrc ne 0.
    pass below code:
      IF SY-SUBRC <> 0.
        MESSAGE S000(0K) WITH 'Error in downloading file. Returncode' SY-SUBRC.
      ENDIF.
    Regards,
    Piyush Mathur
    Rewards Points,if helpfull

  • GUI download, how to retain format of decimal places

    Hi everyone!
    I have a program that downloads data to excel file using GUI Download. The values of the amount in the ALV display are 11.90, 11.90- which is correct because it has two decimal places. But the problem now occurs in the excel file. The values are now 11.9, 11.9-.
    Do you know of any method that will retain the format of the values when it is already in the excel file.
    The format of my decimal notation is 1,234,567.89.
    Thanks in advance.

    Thank you!
    But I need to have the format of the numbers in the excel the same as the format in the ALV <b>without changing the format of the cells in the excel file</b>. It has to be changed in the program.
    Actually there are also amounts that are being displayed in excel file with 2 decimal places the same as the ALV display. But some of the amounts were changed when it comes to the excel file, and I don't know why this happens.
    Thanks.
    Message was edited by:
            Betsie Camoro

  • Download alv report to excel in linux

    Hi All,
    I am working on SAP GUI for Java in Linux PC. I have installed
    Open Office.
    After executing an alv report there is no spreadsheet option
    to download the report in excel format .
    Also, when doing Save as Local File -> Spreadsheet ,
    the report is not downloaded in proper format.
    So, how to download the alv reports in excel format ?
    Edited by: Vinod Iyer on Jan 8, 2008 11:51 AM

    The problem of course is that you can't actually call up EXCEL on a Linux machine so such XXL functions  as  call function 'ALV_XXL_CALL' will not work.
    I don't think SAP has OPEN OFFICE integration -- and even if you use EXCEL via the Linux Cross Over Office it is unlikely to work.
    You might need to fiddle around with the internal file format yourself before saving it as a local file.
    For EXCEL 2007 you actually have a better chance since if you save in TRUE EXCEL 2007 format the data is saved in a type of XML file.
    You can read about the EXCEL 2007 new file formats on the M$ site. Note however that you will need to download the EXCEL 2007 file viwer to read the file with earlier versions of EXCEL.
    (You can use EXCEL 2007 in "compatability" mode but using an XML file IMO seems a better option).
    If you use a lot of EXCEL functionality probably the best option is to install Windows as a VM on your linux machine (VMWARE/PARALLELS/VMBOX etc) and then run the standard SAPGUI from the Windows VM.
    Probably not the answer you want but it's the best I can do.
    Cheers
    jimbo

  • Downloading records in in excel sheet from ALV.

    Hi,
    I am downloading Records from ALV GRID DIsplay to Excel sheet but i am unable to get all records that are displayed in ALV report.
    I am getting only 73 records if i have only 180
    Any inputs please for correctine the error
    Regards
    Rasheed.

    hi
    you can follow these stapes and get ur work done
    go to List > select Export  > Spreadsheet or just click the excel icon from the tool bar.This would download the data to excel.
    hope this helps
    regards
    Aakash Banga

  • Download from ALV to excel sheet.

    When i am downloading the Alv to excel sheet. I want to get the field descritption also in the excel sheet.

    Refer:
    https://forums.sdn.sap.com/click.jspa?searchID=14433981&messageID=3603627

  • Report to display PO details and download details in an excel fil

    Hi,
    I have been asked to develop a report for "Develop report to display PO details and download details in an excel file".
    Could any one guide me technically what are the different tables i need to take to generate the report. Treat this is very urgent. Pls provide sample code too....
    Thanks in advance....

    Purchase Order PO
    Tcode for creation ME21,ME22,ME23. tables EKKO,EKPO.
    refer this program
    REPORT ZPOCHANGE.
    This is a subroutine perform in the Purchase order Layout sets.
    Description :  To retreive the details of changed remarks in PO output and to capture the retrival date
                         Additional features with the previous changed appearing.  e.g. from .... to
    Note        :  If the latest modification details required
    Please Uncomment the lines mentioned under  'Last Modified Remarks only'
    Information
    /: PERFORM CHDATE IN PROGRAM ZPOCHANGE
    /:               USING &EKKO-EBELN&
    /:               CHANGING &RVDATE2&
    /: ENDPERFORM.
    /: IF &RVDATE2& EQ ' '.
    /  Revision Date: NIL
    /: ELSE.
    /  Revision Date: &RVDATE2&
    /: ENDIF.
    Main Window
    /E CHANGE_REMARKS
    /: PERFORM CHDET IN PROGRAM ZPOCHANGE
    /:            USING &EKPO-EBELP&
    /:            USING &EKKO-EBELN&
    /:            USING &T166T-CHTXT&
    /:            USING &T166T-CTXNR&
    /:            CHANGING &ITAB1-F_NEW&
    /:            CHANGING &ITAB1-F_OLD&
    /:ENDPERFORM.
    /:IF &ITAB1-F_NEW& NE ' '
    =  &ITAB1-F_OLD(C)& CHANGED TO &ITAB1-F_NEW(C)&
    /:ENDIF
    You might need to apply Note 373524 - Message determination and printing
    TABLES : CDSHW , "Change documents, formatting table
             CDHDR , "Change document header
             EKPO  , "Purchasing Document Item
             EKKO  , "Purchasing Document Header
             T166C . "Print-Relevant Purchasing Document Changes
    DATA   : ITAB1 LIKE CDSHW OCCURS 100 WITH HEADER LINE.
    DATA   : ITAB2 LIKE EKPO  OCCURS 100 WITH HEADER LINE.
    DATA   : DOCUM LIKE EKKO OCCURS 100 WITH HEADER LINE.
    DATA   : TABKEY LIKE CDSHW-TABKEY.
    data    : begin of ctab occurs 10,
              tname like t166c-tname,
              fname like t166c-fname,
              TABKEY LIKE CDSHW-TABKEY,
              FLAG(3),
              end of ctab.
    DATA   : VAL1(15), VAL2(15).
    DATA : M1(20), M2(10), M3(10),M4(5).
    DATA : RVDATE(10),RVDATE2(10) , EBELN LIKE EKKO-EBELN, COUNT TYPE I.
    Text number for change text(CTXNR), CHANGE TEXT(CHTXT), Purchase order
    Number and item number are passed from Layoutset
          FORM CHDET                                                    *
    -->  ITAB                                                          *
    -->  OTAB                                                          *
    FORM CHDET TABLES ITAB STRUCTURE  ITCSY
                      OTAB STRUCTURE  ITCSY.
      LOOP AT ITAB.
        CASE ITAB-NAME.
          WHEN 'T166T-CHTXT'.
            MOVE ITAB-VALUE TO M1.
          WHEN 'T166T-CTXNR'.
            MOVE ITAB-VALUE TO M2.
          WHEN 'EKKO-EBELN'.
            MOVE ITAB-VALUE TO M3.
          WHEN 'EKPO-EBELP'.
            MOVE ITAB-VALUE TO M4.
        ENDCASE.
      ENDLOOP.
    Throught this function change details are retrived into itab1.
      CALL FUNCTION 'ME_CHANGES_READ'
           EXPORTING
                DOCUMENT_CATEGORY = 'F'
                DOCUMENT_NUMBER   = M3
           TABLES
                XCDSHW            = itab1.
      SELECT SINGLE * FROM T166C WHERE CTXNR = M2.
      IF SY-SUBRC = 0.
        CONCATENATE M3 M4  INTO TABKEY.
    ********Last Modified Remarks only**********************
       read table ctab with key  tname  = T166C-TNAME
                                         tabkey  = tabkey
                                         fname   = T166C-FNAME.
       if sy-subrc ne 0.
        LOOP AT ITAB1 WHERE TABNAME = T166C-TNAME
                                      AND   TABKEY+3(15) = TABKEY
                                      AND   FNAME = T166C-FNAME.
    *********Last Modified Remarks only**********************
           ctab-tname  = t166c-tname.
           ctab-fname  = t166c-fname.
           ctab-tabkey = tabkey.
           append ctab.
          delete itab1.
          exit.
        endloop.
    Captured details are exported to Layoutset
        LOOP AT OTAB.
          CASE OTAB-NAME.
            WHEN 'ITAB1-F_OLD'.
              OTAB-VALUE = ITAB1-F_OLD.
              MODIFY OTAB.
              CLEAR : ITAB1-F_OLD.
            WHEN 'ITAB1-F_NEW'.
              OTAB-VALUE = ITAB1-F_NEW.
              MODIFY OTAB.
              CLEAR : ITAB1-F_NEW.
          ENDCASE.
        endloop.
      endif.
    ******Last Modified Remarks only****************
    ENDIF.
      clear ctab.
    ENDFORM.
          FORM CHDATE                                                   *
    -->  ITAB                                                          *
    -->  OTAB                                                          *
    Form for revision date retrival. PO no. is passed from layoutset
    and in the change document header latest modified date is captured
    and passed to revision date field in Layoutset.
    FORM CHDATE TABLES ITAB STRUCTURE  ITCSY
                      OTAB STRUCTURE  ITCSY.
      CLEAR : RVDATE, EBELN.
      LOOP AT ITAB.
        CASE ITAB-NAME.
          WHEN 'EKKO-EBELN'.
            MOVE ITAB-VALUE TO EBELN.
        ENDCASE.
      ENDLOOP.
    SELECT UDATE INTO CDHDR-UDATE FROM CDHDR WHERE OBJECTCLAS = 'EINKBELEG'
                                                       AND OBJECTID = EBELN.
        IF RVDATE < CDHDR-UDATE.
          RVDATE = CDHDR-UDATE.
        ENDIF.
        COUNT = COUNT + 1.
      ENDSELECT.
      LOOP AT OTAB.
        CASE OTAB-NAME.
          WHEN 'RVDATE2'.
         CONCATENATE RVDATE6(2) '.' RVDATE4(2) '.' RVDATE(4) INTO RVDATE2.
            IF COUNT = 1.
              RVDATE2 = ''.
            ENDIF.
            MOVE RVDATE2 TO OTAB-VALUE.
            MODIFY OTAB.
        ENDCASE.
      ENDLOOP.
    CLEAR : COUNT.
    ENDFORM.
    Message was edited by:
            Karthikeyan Pandurangan

Maybe you are looking for