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

Need solution for unicode error

Former Member
0 Likes
906

Hi ,

I am facing unicode error "ESCAPE_TRICK cannot be converted to a character-type field" for

the following syntax -

ESCAPE_TRICK-X1 = '1C'.

Where ESCAPE_TRICK is defined as -

DATA: BEGIN OF ESCAPE_TRICK,

X1(1) TYPE X,

END OF ESCAPE_TRICK.

Please suggest me the solution.

Thanks,

Narayan

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
834

Hi..

Check the class CL_ABAP_CHAR_UTILITIES if any values match 1C

or else use

cl_abap_container_utilities=>read_container_c oR

cl_abap_container_utilities=>fill_container_c

whicever is more appropriate

Regards,

Arun

5 REPLIES 5
Read only

Former Member
0 Likes
834

HI,

DATA: BEGIN OF ESCAPE_TRICK,
X1(1) TYPE X,
END OF ESCAPE_TRICK.

Data: var(2) type c.

Var = '1C'.

move: var to ESCAPE_TRICK-X1.

Thank

Sudheer

Read only

0 Likes
834

Hi,

As type X is obsolete.

you need to convert it to type c. But you should convert the hexadecimal value '1C' to its equivalent Char value. Replace your code with:

DATA: BEGIN OF ESCAPE_TRICK,

X1 TYPE STRING,

END OF ESCAPE_TRICK.

  • To convert Hex '1C' to type string

CALL FUNCTION 'CACS_CONVERT_HEX_TO_STRING'

EXPORTING

XSTRING = '1C'

IMPORTING

CSTRING = ESCAPE_TRICK-X1.

.

It should solve your purpose.

Alternatively, '1C' is "FILE SEPERATOR'. you can find its value in char and can use it.

howver, the first ,method should work..

revert back in case of further issue.

Thanks and Regards

Rishika

Edited by: Rishika Bawa on May 14, 2009 2:06 PM

Read only

Former Member
0 Likes
835

Hi..

Check the class CL_ABAP_CHAR_UTILITIES if any values match 1C

or else use

cl_abap_container_utilities=>read_container_c oR

cl_abap_container_utilities=>fill_container_c

whicever is more appropriate

Regards,

Arun

Read only

Former Member
0 Likes
834

What is your code all about.

You may want to define X1 as TYPE c.

Regards

Shital

Read only

Former Member
0 Likes
834

Change the data type of X1 from X to string or Char,hope it works