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: 

open dataset in UTF8. Problems between Unicode and non Unicode

Former Member
0 Kudos

Hello,

I am currently testing the file transfer between unicode an non unicode systems.

I transfered some japanese KNA1 data from non unicode system (Mandt,Name1, Name2,City) to a file with this option:

set local language pi_langu.

open dataset pe_file in text mode encoding utf-8 for output with byte-order mark.

Now I want to read the file from a unicode system. The code looks like this:

open dataset file in text mode encoding utf-8 for input skipping byte-order mark.

The characters look fine but they are shifted. name1 is correct but now parts of the city characters are in name2....

If I open the file in a non unicode system with the same coding the data is ok again!

Is there a problem with spaces between unicode an non-unicode?!

1 ACCEPTED SOLUTION

nils_buerckel
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hello,

please have a look at

https://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/702b05f0-7ece-2b10-659f-b71d7404...

and check whether this solves your problem.

Best regards,

Nils Buerckel

SAP AG

3 REPLIES 3

nils_buerckel
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hello,

please have a look at

https://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/702b05f0-7ece-2b10-659f-b71d7404...

and check whether this solves your problem.

Best regards,

Nils Buerckel

SAP AG

0 Kudos

Hi,

many thanks. Tried the coding in the first example. Works fine for me!

0 Kudos

Hello again,

after implementing and testing this method, we saw that the conversion is always taken place in the unicode system.

For examble: we have a char(35) field in mdmp with several japanese signs..as soon as we transfer the data into the file and have a look at it the binary data the field is only 28 chars long. several spaces are missing...now if we open the file in our unicode system using the mentioned class the size is gaining to 35 characters

on the other hand if we export data from unicode system using this method the size is shrinking from 35 chars to 28 so the mdmp system can interprete the data.

as soon as all systems are on unicode this method is obselete/wrong because we don't want to cut off/add the spaces..it's not needed anymore..

the better way would be to create a "real" UTF-8 file in our MDMP system. The question is, is there a method to add somehow the missing spaces in the mdmp system?

so it works something like thtat:

OPEN DATASET p_file FOR OUTPUT IN TEXT MODE ENCODING UTF-8 WITH BYTE-ORDER MARK.

"MDMP (with ECC 6.0 by the way)

if charsize = 1.

*add missing spaces to the structure

*transfer strucutre to file

*UNICODE

else.

*just transfer struc to file -> no conversion needed anymore

endif.

I thought mybe somehow this could work with the class CL_ABAP_CONV_OUT_CE. But until now I had no luck...

Normally I would think that if I'am creating a UTF-8 file this work is done automatically on the transfer command