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: 

Special character '#' while reading .TNF file from Application server

Former Member
0 Kudos

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.

15 REPLIES 15

former_member195402
Active Contributor
0 Kudos

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

0 Kudos

Hi ,

Could you please let me know how to check if the file is created in Unicode 2-3 byte/char.

Regards,

Aparna.

0 Kudos

Hi,

you can try to change your OPEN commend to

OPEN DATASET file FOR INPUT IN TEXT MODE ENCODING UTF-8.

Regards,

Klaus

0 Kudos

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.

0 Kudos

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

0 Kudos

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

0 Kudos

Hi,

You can try code pages 0120, 437, 850. And you can try ENCODING NON-UNICODE. No further ideas!

Regards,

Klaus

0 Kudos

Nothing seems to be working :(..

But i appreciate your efforts.

Thank You.

Regards,

Aparna

0 Kudos

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 ...

0 Kudos

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

0 Kudos

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

0 Kudos

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

0 Kudos

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

0 Kudos

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

Former Member
0 Kudos

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