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: 

Character translation in non unicode system

jack_graus2
Active Contributor
0 Kudos

Good day.

We have a non Unicode SAP system. We receive data from webservices that is in Unicode format. The data is received in an XSTRING. So far so good. The XSTRING data is valid and readable but not all characters can be stored in the non Unicode SAP system.

I can do a Unicode to non Unicode conversion. The data is converted into STRING format. All characters that are valid in the system code page are OK. Characters that can no be converted could be replaced by a '#' character. Example: When the input data holds the Unicode 'ů' character it will be converted to '#'.

Is it possible to have 'ů' converted to 'u' ? This is an example character but the are more characters to be converted. The same happens in SAP frontend. When you type the character 'ů' in a SAPgui transaction on a non Unicode system it will be converted to 'u'.

Best regards Jack

1 ACCEPTED SOLUTION

nils_buerckel
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi Jack,

you could use ABAP class CL_ABAP_CONV_X2X_CE with code pages 4110 (Unicode utf-8) and code page 1180 (Transliteration from Latin-2 to Latin-1).

However this will work with data from Eastern Europe only (e.g. your example: Latin small letter u with ring above). If you receive other data, I guess you need to create your own transliteration code page ...

Best regards,

Nils Buerckel

5 REPLIES 5

Former Member
0 Kudos

Did you try REPLACE ALL OCCURENCES...IN BYTE MODE.

You can find what is the hexadecimal value for these special characters and replace them with the hexadecimal value of i.e. 'u'. You will need to do this in the XSTRING before doing the Unicode conversion.

0 Kudos

Thank you

That will work but needs me to find out all possible Unicode characters and their non Unicode replacements. Performance is not a big problem but I also would like to prevent replacing all possible Unicode characters character by character.

Regards

pranay570708
Active Contributor
0 Kudos

First convert the xstring to binary using FM 'SCMS_XSTRING_TO_BINARY'.  Then binary to string

SCMS_BINARY_TO_STRING.

nils_buerckel
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi Jack,

you could use ABAP class CL_ABAP_CONV_X2X_CE with code pages 4110 (Unicode utf-8) and code page 1180 (Transliteration from Latin-2 to Latin-1).

However this will work with data from Eastern Europe only (e.g. your example: Latin small letter u with ring above). If you receive other data, I guess you need to create your own transliteration code page ...

Best regards,

Nils Buerckel

Sandra_Rossi
Active Contributor
0 Kudos

Did you try the function module SCP_REPLACE_STRANGE_CHARS ? You may use the program RSCP0007 to display all possible results of this function module.