05-10-2007 5:12 AM
Hi,
My requirement is to download a text file which must be in local language-Traditional Chinese (MS950), anyone have any idea?
Thanks in advance.
Best Regards,
Hikaruno
05-10-2007 11:32 AM
Hi There
When You Write The Sysntax For OPEN Data Set
... IN LEGACY BINARY MODE [CODE PAGE cp]
. ... IN LEGACY TEXT MODE [CODE PAGE cp]
In the place of cp you have to write the following code...as given in the list below
The list contains some example values for character sets used for conversion:
Value Character Set
037 or 1026 EBCDIC
874 Thai
932 Japanese
936 Chinese (PRC, Singapore)
949 Korean
950 Chinese (Taiwan, Hong Kong)
1200 Unicode (BMP of ISO 10646)
1250 Windows 3.1 Eastern European
1251 Windows 3.1 Cyrillic
1252 Windows 3.1 Latin 1 (US, Western Europe)
1253 Windows 3.1 Greek
1254 Windows 3.1 Turkish
1255 Hebrew
1256 Arabic
1257 Baltic
1361 Korean (Johab)
Even i had a similar requirement where i had to download the file in Greek language and it was printing garbage value.
There are two ways you can resolve this, either you use the concept of Code page .
A code page is Complex structure for integrating the characters of a character set into a special system and for communicating with other systems.
Every computer system contains different code pages. This means the SAP System contains code pages to map the ISO standard (SAP(ISO) code pages) used in the SAP System and other code pages used for communication with operating systems and peripherals (SAP(frontend) code pages).
However the other problem could be in the system, and not the program, if you doing the open dataset in the binary mode then it usually doesnt give a probem for conversion pls check if you system actually supports that langugae.
05-10-2007 5:25 AM
Hi Hikaruno,
Populate the data in local language-Traditional Chinese (MS950),
in internal table ITAB and download the table data
1. on application server using statement :
OPEN DATASET FILE FOR OUTPUT IN TEXT MODE ENCODING DEFAULT.
LOOP AT I_DATA INTO WA_DATA.
TRANSFER WA_DATA TO FILE.
ENDLOOP.
CLOSE DATASET FILE.
2. on presentation server using statement :
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
FILENAME = V_PATH
FILETYPE = 'ASC'
APPEND = ' '
TABLES
DATA_TAB = I_DATA
.
IF SY-SUBRC = 0.
MESSAGE I002.
ENDIF.
Reward points if helpful.
Regards,
Hemant
05-10-2007 5:34 AM
Hi Hemant,
Thanks for the prompt response.
i had try this but when i open the file, the chinese characters are display as funny character.
any idea?
05-10-2007 5:39 AM
hi
good
You can ask for the data in the chinese language from your functional consultant.
To open a file on the application server, use the OPEN statement as follows:
Syntax
OPEN DATASET <dsn> [Additions].
This statement opens the file <dsn>. If you do not specify any additions for the mode, the file is opened in binary mode for reading. SY-SUBRC returns 0 if the system opens the file. Otherwise, SY-SUBRC is set to 8.
You enter the filename <dsn> either as a literal or as a field containing the actual name of the file. If you do not specify a path, the system opens the file in the directory in which the R/3 System is running on the application server. To open a file, the user under which the R/3 System is running must have the requisite authorizations at operating system level.
05-10-2007 6:38 AM
Hi,
Good day!
I already have the data in chinese character, then i populate the data into internal table and download it. But my problem is i can't view the word in chinese character in the text file after i open the file.
Then i use OPEN DATASET path FOR OUTPUT IN TEXT MODE ENCODING UTF-8.
This time i can view the chinese character in the downloaded text file. But i need to ensure that the code page is MS950 (Traditional Chinese Big 5), How can i convert to this code page after download the file?
The syntax OPEN DATASET has the addition
... IN LEGACY TEXT MODE [(BIG|LITTLE) ENDIAN] [CODE PAGE cp]
Does anyone know the proper way to using this syntax CODE PAGE?
Please advise. Thx.
Regards,
Hikaruno
05-10-2007 11:32 AM
Hi There
When You Write The Sysntax For OPEN Data Set
... IN LEGACY BINARY MODE [CODE PAGE cp]
. ... IN LEGACY TEXT MODE [CODE PAGE cp]
In the place of cp you have to write the following code...as given in the list below
The list contains some example values for character sets used for conversion:
Value Character Set
037 or 1026 EBCDIC
874 Thai
932 Japanese
936 Chinese (PRC, Singapore)
949 Korean
950 Chinese (Taiwan, Hong Kong)
1200 Unicode (BMP of ISO 10646)
1250 Windows 3.1 Eastern European
1251 Windows 3.1 Cyrillic
1252 Windows 3.1 Latin 1 (US, Western Europe)
1253 Windows 3.1 Greek
1254 Windows 3.1 Turkish
1255 Hebrew
1256 Arabic
1257 Baltic
1361 Korean (Johab)
Even i had a similar requirement where i had to download the file in Greek language and it was printing garbage value.
There are two ways you can resolve this, either you use the concept of Code page .
A code page is Complex structure for integrating the characters of a character set into a special system and for communicating with other systems.
Every computer system contains different code pages. This means the SAP System contains code pages to map the ISO standard (SAP(ISO) code pages) used in the SAP System and other code pages used for communication with operating systems and peripherals (SAP(frontend) code pages).
However the other problem could be in the system, and not the program, if you doing the open dataset in the binary mode then it usually doesnt give a probem for conversion pls check if you system actually supports that langugae.
05-11-2007 4:51 AM
Hi,
I had try the following code:
open dataset path for output in legacy text mode code page '950'.
and get the following runtime error:
CONVT_CODEPAGE_INIT
CX_SY_CODEPAGE_CONVERTER_INIT
The conversion of some code pages is not supported.
The conversion of texts in code page '950' to code page '8300' is not
supported.
After that i found that the SAP Code Page is 8300 that based on MS CP 950.
Therefore i try the code:
open dataset path for output in legacy text mode code page '8300'.
this time no runtime error but the content in the file is garbage value.
Can anyone provide suggestion to me to solve this problem?
Hi Pablo, thx for the explanation on the code page. Can u further explain how can i use the concept of code page to solve this problem? Does it means that my system support the chinese character coz i can view chinese character, correct me if i am wrong.
Best regards,
Hikaruno
05-11-2007 10:12 AM
Hi Hikaruno,
Well you might be transfering the contents of an Internal Table having the text in chinese characters. Now put debugger on the transfer command and check the contents of the internal table, if its actually taking the chinese characters in the proper way, if it does and after transfer it shows garbage value in the text file then its the system (PC) that is not supporting the language.
You can check the contents of the file in AL11 and see whether they are coming appropriate.
Hope this helps you
06-14-2007 10:46 PM
You need to convert the code page to CCDC. So download the file normally, donot do any converion in SAP. SAP does not support CCDC. Use unix script to convert to CCDC
Sundar