10-08-2006 6:10 AM
I'm currently has a text file which is saved as UTF-8 format. And inside this file has Thai characters.
However, my SAP system is a non-unicode system.
When I use the code
open dataset DSN for output in TEXT MODE encoding UTF-8
the thai characters become some funny characters.
How can I solve this in the ABAP program without changing the system from non-unicode to unicode system?
10-08-2006 6:24 AM
hi,
u can transalte the charatcter to english.
then use open data set.
rgds
anver
10-08-2006 6:24 AM
hi,
u can transalte the charatcter to english.
then use open data set.
rgds
anver
10-08-2006 7:49 AM
do you have the coding for translate to english.
When I open dataset, which mode should I use? Text mode encoding default?
10-08-2006 8:15 AM
hi
hk this.
Just see the usage of LXE_PP1_TRANSLATION_EVAL_SE63 in include pgm LSKTYF01
this may hlp u.
rgds
anver
if hlped mark points
10-08-2006 10:30 AM
Dear Irene
As the orginal file is in UTF-8 format, we can use the same to open the file.
But to be able to read the Thai characters, code page for THAI has to be installed in SAP to recognize the same. Please ask your Basis consultant to install the same and see.
Hope the above info helps you.
Kind Regards
Eswar
10-08-2006 10:51 AM
Hi Eswar,
How can I check whether the code page for THAI already installed or not in SAP system?
Here is the code I use to test to read a file that saved as UTF-8.
DATA: l_filepath TYPE string.
DATA : BEGIN OF l_filepath_str OCCURS 0,
comm(1000) TYPE c,
END OF l_filepath_str.
DATA: l_datasetsucc LIKE rlgrap-filename.
l_filepath = '/BAAC/Files/APP_.txt'.
OPEN DATASET l_filepath FOR INPUT IN TEXT MODE ENCODING UTF-8.
IF sy-subrc EQ 0.
DO.
CLEAR l_filepath_str.
READ DATASET l_filepath INTO l_filepath_str.
IF sy-subrc EQ 0.
APPEND l_filepath_str.
ELSE.
EXIT.
ENDIF.
ENDDO.
ELSE.
WRITE:/ 'Error reading from file:', sy-subrc.
ENDIF.
CLOSE DATASET l_filepath.
LOOP AT l_filepath_str.
WRITE: / l_filepath_str-comm.
ENDLOOP.
It returns me a runtime error. Any idea?
10-08-2006 11:00 AM
hi,
chk this sample.
parameters: p_file like rlgrap-filename obligatory
default '/usr/sap/upload.xls'.
types: begin of t_data,
vbeln like vbap-vbeln,
posnr like vbap-posnr,
matnr like vbap-matnr,
werks like vbap-werks,
megne like vbap-zmeng,
end of t_data.
data: it_data type standard table of t_data,
wa_data type t_data.
open dataset p_file for output in text mode encoding default.
if sy-subrc ne 0.
write:/ 'Unable to open file:', p_file.
else.
do.
read dataset p_file into wa_data.
if sy-subrc ne 0.
exit.
else.
append wa_data to it_data.
endif.
enddo.
close dataset p_file.
endif.
rgds
anver
10-08-2006 11:07 AM
Hi Anversha,
I think the code you give will show me the unknown characters also.
is the class CL_ABAP_CONV_IN_CE will be helpful to solve my issue?
10-09-2006 5:56 AM
Dear Irene
Please check table TCP00 for codepages catalog.
Kind Regards
Eswar
07-27-2007 2:44 PM
Hi Irene.....
Hope you are fine. I am also facing the same problem as posted in this post. Could you please let me know how you resolved your problem.
Your help is much appreciated.
Yogesh