Application Development and Automation 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: 
Read only

Unicode error for type x

lucy_gray2
Active Participant
0 Likes
1,749

  Hi SAP Experts,


  I am working on a SAP system upgrade in which an include is have some data definitions which are no longer valid in Unicode systems.

  I learned from the below link that type 'X' is no longer valid in Unicode systems.

   http://help.sap.com/saphelp_nw70ehp1/helpdata/ja/79/c554d9b3dc11d5993800508b6b8b11/content.htm

   Now in order to make it unicode compatible we have to replace all the declarations & command lines involving 'type x'

   into  respective character  equivalents. This is usually done using the class 'cl_abap_char_utilities'.

   But this class can be used only for a few attributes like horizontal_tab, vertical_tab,linefeed,form feed.


  Hence, I need to modify some data definitions like the below but I can't find any CLASS METHOD for '81', '9F', 'E0', 'FC'.


  DATA:$$sjis_1f TYPE x VALUE '81'.

  DATA:$$sjis_1t TYPE x VALUE '9F'.

  DATA:$$sjis_2f TYPE x VALUE 'E0'.

  DATA:$$sjis_2t TYPE x VALUE 'FC'.

I tried the below two ways but they are not working:

$$sjis_1f_new = CL_ABAP_CONV_IN_CE=>UCCP( '0081' ).

CALL METHOD CL_ABAP_CONV_IN_CE=>UCCP

EXPORTING

UCCP = $$sjis_1f

RECEIVING

CHAR = $$sjis_1f_new.

Do you know which class to use for these values of hex.

<Removed by moderator>

Best Reagrds,

Lucy

Message was edited by: Matthew Billingham

5 REPLIES 5
Read only

Former Member
0 Likes
1,130

Hi,

please check the methods of class CL_ABAP_CONV_OUT_CE.

Regards,

Klaus

Read only

retired_member
Product and Topic Expert
Product and Topic Expert
0 Likes
1,130

Hi,

the following class is quite convenient: CL_ABAP_CODEPAGE

Horst

Read only

Sandra_Rossi
Active Contributor
0 Likes
1,130

[...] type 'X' is no longer valid in Unicode systems

Hopefully X is still fully valid. What is not valid is to mix C and X in the same ABAP statement, because a character is 2 bytes long in a Unicode system while a byte (type X) is 1 byte long (in non-Unicode systems, a character was one byte, from the compiler point of view of course).


$$sjis_1f_new = CL_ABAP_CONV_IN_CE=>UCCP( '0081' ).

This is because UCCP accepts only a type X length 2 parameter. You need to write:


DATA sjis_1f_new(1) TYPE c.

DATA uccp_dummy(2) TYPE x VALUE '0081'.

sjis_1f_new = CL_ABAP_CONV_IN_CE=>UCCP( uccp_dummy ).

or using UCCPI (decimal value instead of hexadecimal) :


sjis_1f_new = CL_ABAP_CONV_IN_CE=>UCCPI( 129 ).

Read only

lucy_gray2
Active Participant
0 Likes
1,130

Dear All,

Thanks for your replies, but unfortunately the methods suggested by you guys didn't work.

Lastly, I decided to replace all the UNICODE unsupported coding with some FMs to

achieve the include program's desired functionality.

Regards,

Lucy

Read only

0 Likes
1,130

So, I guess your question was misleading, because we understood that you wanted to define one character based on a "Unicode code point" (i.e. what to do to get char = U+0081).