03-17-2011 5:06 AM
Dear All,
I am reading a .TNF file from unix directory but while reading this file into a workarea using open dataset
it is appending '#' after each letter .
Below is the open dataset statement used in my program wherein the code page is fetched
as per the system language using FM NLS_GET_FRONTEND_CP .
OPEN DATASET filename for input in legacy TEXT MODE
code page l_codepage
ignoring conversion errors.
Please help me out if someone has faced a similar issue .
Thanks in Advance.
03-17-2011 5:56 AM
Hi.
Could this be a UNICODE / NONUNICODE problem? If the file was created with UNICODE mode 2-3 bytes/char) and you read it in NONUNICODE mode you will get the additional unicode bytes as non printable signr "#" ...
Please check this!
Regards,
Klaus
Edited by: Klaus Babl on Mar 17, 2011 6:56 AM
03-17-2011 9:11 AM
Hi ,
Could you please let me know how to check if the file is created in Unicode 2-3 byte/char.
Regards,
Aparna.
03-17-2011 9:52 AM
Hi,
you can try to change your OPEN commend to
OPEN DATASET file FOR INPUT IN TEXT MODE ENCODING UTF-8.
Regards,
Klaus
03-17-2011 10:33 AM
Hi,
I have already tried using this OPEN statement.
OPEN DATASET filename for INPUT IN TEXT MODE ENCODING UTF-8
But couldn't get through , somehow i feel there is a problem with the .tnf file type.
Regards,
Aparna.
03-17-2011 10:51 AM
Another question:
Why do you get your frontend codepage for the file?
We have frontend running under windows, SAP running under UNIX.
Is your frontend running under UNIX?
Maybe you got the wrong codepage by your fm!!
What happens, if you remove the code page option from open command?
Regards,
Klaus
Edited by: Klaus Babl on Mar 17, 2011 11:53 AM
03-17-2011 11:10 AM
I am using Legacy text mode wherein i cannot specify encoding .
Hence i was trying to use code page as per the language but nothing seems to be working.
I also tried using code page '1100' for language English.
You are right the code page from the FM is not correct.
But the other options are also not working like Encoding UTF, Encoding Default.
Regards,
Aparna
Edited by: Appyfizz on Mar 17, 2011 12:10 PM
03-17-2011 11:25 AM
Hi,
You can try code pages 0120, 437, 850. And you can try ENCODING NON-UNICODE. No further ideas!
Regards,
Klaus
03-17-2011 11:40 AM
Nothing seems to be working :(..
But i appreciate your efforts.
Thank You.
Regards,
Aparna
03-17-2011 1:00 PM
If the file is created by an ABAP it could be helpful to find the code lines, where the file is created.
Maybe this is the idea to solve your problems ...
03-18-2011 12:54 PM
Hi Aparna,
I would recommend to have a look at the file with a Hex editor
(Example: http://www.chmaas.handshake.de/delphi/freeware/xvi32/xvi32.htm ).
Then you should be able to identify the hex bytes used in the file.
In the next step, you need to find out the code page used ...
Best regards,
Nils Buerckel
SAP AG
03-21-2011 5:09 AM
Hi Nils ,
I am able to open the .TNF file with XVI32 but how am i suppose to
check which code page i have to use.
Regards,
Aparna
03-21-2011 10:24 AM
Hi Aparna,
look at the "normal" English characters (like A,B,C,D ...) - Which Hex codes are they assigned to ?
I guess something like x0041, x0042, .... ?
Best regards,
Nils
03-22-2011 5:05 AM
Hi Nils,
I checked in the file , the English characters are assigned to the following HEX codes :
A= x0041
B= x0042
C=x0043
and so on.
How this will gonna help us?
Regards,
Aparna
03-22-2011 6:28 AM
Hi Aparna,
this means that the file is encoded in UTF-16BE (Unicode 16 bit Big Endian). SAP number: 4102.
It is not foreseen to use this encoding in textual upload in ABAP.
You can convert the file content with the tools mentioned in
I would recommend to convert from 4102 to 4110 (UTF-8). The resulting file can be uploaded with open dataset in Unicode mode.
Best regards,
Nils
04-06-2011 8:18 PM
We used this to solve the issue with mixed language characters in an inbound file.
Current Codepage of Appl. Server 4102
Codepage of Front End 4110 UTF-8 GUI
In our ABAP to read files from non-unicode systems that send special characters, we use the following....
open dataset p_file for input IN LEGACY TEXT MODE BIG ENDIAN CODE PAGE '1100' message lv_mess.
Hope this helps
Mike Manke