Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

GUI_DOWNLOAD is giving # for other than english content

vinod_vemuru2
Active Contributor
0 Kudos

Hi Guys,

I am using GUI_DOWNLOAD FM for downloading internal table content. When my table has content other than english language, my downloaded file has only # symbols.

I getting code page number for the language using FM NLS_GET_FRONTEND_CP and passing to GUI_DOWNLOAD. Even standard ALV download also doing the same. Please sugest some solution for this.

I have to download to text file and excel file.

Thanks,

Vinod.

1 ACCEPTED SOLUTION

Former Member
0 Kudos

hi ,

it seems the code page u r using is not sustaining the characters of other languages..

see here the problem is when u have some characters like scandinivian characters / other languages like hungary,chinese or japanese etc.. it is clear that these special characters are not recognised by the code page you are currently using .. solution is to feed these languages or special

the # is getting displayed there as its converting the non recognised character into #..

just like how u do ignoring conversion errors in open dataset statements..

Tcode SCP..

once the language is feed into the codepage check if all the characters set is present if not try to feed the characters based on the hexa decimal values of the character.

explore tcode SCP with ur code page ..

Vijay.

20 REPLIES 20

Sandra_Rossi
Active Contributor
0 Kudos

You mean all characters!? Which languages do you use? Do you use double-byte characters, or things like that? What are the source (server) and target (frontend side) code page numbers? Maybe there is no conversion possible between these 2 code pages, did you check? Are you on a unicode or non-unicode system?

I also saw in one thread that "NLS_GET_FRONTEND_CP returns the related non-Unicode frontend codepage for a language", so maybe you don't get the right codepage?

Former Member
0 Kudos

hi ,

it seems the code page u r using is not sustaining the characters of other languages..

see here the problem is when u have some characters like scandinivian characters / other languages like hungary,chinese or japanese etc.. it is clear that these special characters are not recognised by the code page you are currently using .. solution is to feed these languages or special

the # is getting displayed there as its converting the non recognised character into #..

just like how u do ignoring conversion errors in open dataset statements..

Tcode SCP..

once the language is feed into the codepage check if all the characters set is present if not try to feed the characters based on the hexa decimal values of the character.

explore tcode SCP with ur code page ..

Vijay.

0 Kudos

Hi Both,

Thanks for the responce. I got one more FM SCP_CODEPAGE_BY_EXTERNAL_NAME. Here we have to pass external character set name. How to get this for the given language.

Vijay,

solution is to feed these languages: What do mean by this statement? Are you taling about installing these languages? If so it is already installed. Funny thing is i have copied Korian and russian text and pasted in unicode text file. When i see in text file it is showing rectangular boxes for korian and showing original text for Russian. When i upload the same using GUI_UPLOAD original Korian and Russian characters are coming to internal table. So this means that my frontend and my SAP system is supporting these languages right?

Sandra,

Clarifications for your queries.

You mean all characters!?

All characters are coming like that only.

Which languages do you use?

I tried with Korian and Russian languages. But we need this for 44 languages including china, Japan etc

Do you use double-byte characters, or things like that?

Don't really understand this. How to findout this?

What are the source (server) and target (frontend side) code page numbers? Maybe there is no

*conversion possible between these 2 code pages, did you check? *

Are you on a unicode or non-unicode system?

Could you please tell me how to findout these?

Please let me know if you guys need any more information.

Thanks,

Vinod.

0 Kudos

Hi there... use ASC format when you write the file and when you read the file..

0 Kudos

Hi,

I have tried with all possible types of file types like ASC, BIN IBM, DAT, DBF, WK1.

Any more thoughts...

Thanks,

Vinod.

>

> Funny thing is i have copied Korian and russian text and pasted in unicode text file. When i see in text file it is showing rectangular boxes for korian and showing original text for Russian. When i upload the same using GUI_UPLOAD original Korian and Russian characters are coming to internal table. So this means that my frontend and my SAP system is supporting these languages right?

Are you sure that your copy and display operations gives you the right results. Maybe your text editor does not work, and SAP works !? Moreover, if you want to write to unicode file, I don't see why you use a given language code page

>

> Do you use double-byte characters, or things like that?

> Don't really understand this. How to findout this?

double-byte characters are what sap used in non-unicode sap systems to handle chinese, etc., before the time unicode became a standard. If your system is unicode, my question is not important.

>

> What are the source (server) and target (frontend side) code page numbers? Maybe there is no conversion possible between these 2 code pages, did you check?

> Are you on a unicode or non-unicode system?

> Could you please tell me how to findout these?

start SNLS transaction, you'll see your server code page number.

to know if you are in a unicode or non-unicode sap system, go to menu system, then status option. It is displayed under installation number. I bet you are in a unicode sap system.

0 Kudos

Feeding the languages is not in upload text file but in the code page which u r referring ...i want you to check in the tcode SCP with the code page number u r using or in usage for these languages ..

Did you check the character's in ur code page with hexa decimal places ?

The code page is not complete in that case ..

in the GUI_DOWNLOAD open the option of CODE page and feed the page of ur system and check the outcome ..

//You mean all characters!?

//All characters are coming like that only. so the language character set is not compatible with the conversion.

Do you use double-byte characters, or things like that?

Don't really understand this. How to findout this?

its UTF 8 and UTF16 storage format ..

what is the version u r using in sap ecc6 or 5?

Vijay.

0 Kudos

Hi Sandra/Vijay,

Your inputs are really helpfull. Thank you so much for your response.

Problem is solved now by giving the code page as 4103 and marking the field write_BOM as X in GUI_DOWNLOAD FM.

You guys are are correct. I am in Unicode system and using SAP 4.7 version. Now it is working fine. But one more problem with GUI_UPLOAD.

I am using Office 2007. I have saved excel file in 2003 format. When i try to upload this file having Korian text/Russian text using the FM ALSM_EXCEL_TO_INTERNAL_TABLE last two rows are not coming properly. Tried with FM TEXT_CONVERT_XLS_TO_SAP also. Below is the code snippet.


    REFRESH: li_xlstab[].
    CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
      EXPORTING
        filename                = po_file
        i_begin_col             = lc_1
        i_begin_row             = lc_1
        i_end_col               = lc_4
        i_end_row               = 5                         "lc_65536
      TABLES
        intern                  = li_xlstab
      EXCEPTIONS
        inconsistent_parameters = 1
        upload_ole              = 2
        OTHERS                  = 3.

My excel has always 4 columns and unknown number of rows. For testing i gave 5 rows.

Here first 4 rows are uploaded correctly. When it comes to fifth row it is still recognising as 4th row.

Results of li_xlstab is like below.


ROW  COL  VALUE
0001|0001|KO                                                              |
0001|0002|I                                                               |
0001|0003|001                                                             |
0001|0004|uACB0uACFC, uD3C9uAC00                                                          |
0002|0001|KO                                                              |
0002|0002|I                                                               |
0002|0003|M01                                                             |
0002|0004|uACB0uACFC, uD3C9uAC00                                                          |
0003|0001|KO                                                              |
0003|0002|I                                                               |
0003|0003|M02                                                             |
0003|0004|uACB0uACFC, uD3C9uAC00                                                          |
0004|0001|KO                                                              |
0004|0002|I                                                               |
0004|0003|M03                                                             |
0004|0004|uACB0uACFC, uD3C9uAC00##KO                                                      | "Here its going wrong
0004|0005|I                                                               |
0004|0006|M04                                                             |
0004|0007|uACB0uACFC, uD3C9uAC00##                                                        |

After 4th row 4th column it should take 5th row 1st column. But it is taking as 4th row 5th column. Also in 4th row 4th column u can see some # symbols and KO after korian text. This value KO should be the 5rh row 1st column value.

When i run the same program in office 2003 machine with the same file it is working perfectly fine.

Hope u guys got the problem.

Thanks,

Vinod.

0 Kudos

so the problem is with the excel sheet of ms2007 and in 2003 its working fine ..

can u check the properties of cell value in 2007 and compare with the same with 2003 format .. from sap side its clean, i think now we need to check the properties of cell value 4th column holding the korean char's of 2007 type excel .. can u just adjust this cell properties ..

the problem i see is that the cell doesnt know if the 4column/row is enough to hold that alien character and its spreading its content end to next row val as well .. so the cell should limit the value to that particular place holder only...just set that particular excel(07) cell value checking in the properties.

vijay.

0 Kudos

Hi Vijay.

I am not sure whether you have used office 2007 or not. But in 2007 when you create any document its type will be like docx, xlsx etc. U can open these documents only in office 2007 machines. So here we have an option to save the document in 2003 format i.e doc/xls type.

I did the same and tried uploading it. I have sent the same excel(xls format) to other guy who is having office 2003 and he is able to upload using same program.

Note: If u see the Korian text in my earlier post it is same in all rows. So identifying the text is not

the problem. I tried increasing the number of rows in excel. Then also result is same. Last 2 rows r causing problem.

I already tried changing the cell format to text type/general type. Still result is same

Any more thoughts???

Thanks,

Vinod.

0 Kudos

I saw sap notes relating to this function module, because of sapgui errors, especially note 852709.

It seems that you'd better have at least GUI 620 patch level 64, or GUI 640 patch level 19.

What GUI do you have?

Moreover, could you tell us what hex value are behind ##?

0 Kudos

Hi,

I am using GUI 640 patch level 13. Is the problem is because of this?

Thanks,

Vinod.

0 Kudos

Maybe. It's what suggests this note. Could you upgrade and tell us?

0 Kudos

Thanks vonodh. Your answer resolves my issue .

Richard A

Former Member
0 Kudos

Which character you want to print?

Find codepage for that language and give it in FM GUI_DOWNLOAD.

eg default codepage is...

Codepage = '8043'.

Hope it is usefull.

Rehards,

Dhan

vinod_vemuru2
Active Contributor
0 Kudos

Hi all,

Thanks you very much for ur helpful answers. I can't implement any notes since it is only for my testing purpose.

Thanks,

Vinod.

0 Kudos

Vinod:

As you have told I did the changes, but still I am getting ### instead of korean text.


  CALL FUNCTION 'GUI_DOWNLOAD'
    EXPORTING
      filename                = p_fname
      filetype                = 'DAT'
      codepage                = '8500'
      WRITE_BOM               = 'X'
    TABLES
      data_tab                = it_excel2
      fieldnames              = it_fname
    EXCEPTIONS

Do you find any mistake in this.

Regards

Vijai

Hi,

Use code page 4103 and pass WRITE_BOM as X

Check below sample code.


  CONSTANTS: lc_codepage TYPE abap_encod VALUE '4103',
             lc_hash     TYPE c          VALUE '#'.

  CALL FUNCTION 'GUI_DOWNLOAD'
    EXPORTING
*   BIN_FILESIZE                    =
      FILENAME                        = w_file
*     FILETYPE                        = 'ASC'
*     APPEND                          = ' '
   WRITE_FIELD_SEPARATOR           = lc_hash
*   HEADER                          = '00'
*   TRUNC_TRAILING_BLANKS           = ' '
*   WRITE_LF                        = 'X'
*   COL_SELECT                      = ' '
*   COL_SELECT_MASK                 = ' '
*   DAT_MODE                        = ' '
*   CONFIRM_OVERWRITE               = ' '
*   NO_AUTH_CHECK                   = ' '
   CODEPAGE                        = lc_codepage
*   IGNORE_CERR                     = ABAP_TRUE
*   REPLACEMENT                     = '#'
   WRITE_BOM                       = c_x
*   TRUNC_TRAILING_BLANKS_EOL       = 'X'
*   WK1_N_FORMAT                    = ' '
*   WK1_N_SIZE                      = ' '
*   WK1_T_FORMAT                    = ' '
*   WK1_T_SIZE                      = ' '
* IMPORTING
*   FILELENGTH                      =
    TABLES
      DATA_TAB                        = i_download
*   FIELDNAMES                      =
   EXCEPTIONS
     FILE_WRITE_ERROR                = 1
     NO_BATCH                        = 2
     GUI_REFUSE_FILETRANSFER         = 3
     INVALID_TYPE                    = 4
     NO_AUTHORITY                    = 5
     UNKNOWN_ERROR                   = 6
     HEADER_NOT_ALLOWED              = 7
     SEPARATOR_NOT_ALLOWED           = 8
     FILESIZE_NOT_ALLOWED            = 9
     HEADER_TOO_LONG                 = 10
     DP_ERROR_CREATE                 = 11
     DP_ERROR_SEND                   = 12
     DP_ERROR_WRITE                  = 13
     UNKNOWN_DP_ERROR                = 14
     ACCESS_DENIED                   = 15
     DP_OUT_OF_MEMORY                = 16
     DISK_FULL                       = 17
     DP_TIMEOUT                      = 18
     FILE_NOT_FOUND                  = 19
     DATAPROVIDER_EXCEPTION          = 20
     CONTROL_FLUSH_ERROR             = 21
     OTHERS                          = 22
            .
  IF NOT sy-subrc IS INITIAL.
    MESSAGE i001 WITH text-m13.
    LEAVE LIST-PROCESSING.
  ENDIF.

Thanks,

Vinod.

Former Member
0 Kudos

HI,

thanks for the help, this was very helpful but

I am still having trouble with the excel file. I successfully downloaded

the Thai characters in CSV file, if you view the CSV file it was perfect,

but if you open the CSV file as an excel format, even thought it was set as a

comma tab-delimeted file, it was still displayed in one column.

Please help me. thanks.

0 Kudos

I use following to solve my problem..

call function 'GUI_DOWNLOAD'
     exporting
          filename = '...'
          filetype = 'ASC'
          codepage = '4110'
          write_bom = 'X'
     tables
          data_tab = iout.