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

error during unicode conversion

Former Member
0 Likes
971

Dear all,

we are facing one issue during unicode conversion. the code is as follows:

FIELD-SYMBOLS : <n> TYPE X,
                             <c> TYPE C.

DATA : a TYPE i.
DATA : x TYPE x.

MOVE <n> TO a.

a = a + 22.

MOVE a TO x.

ASSIGN x TO <c> CASTING TYPE c

and we are getting the following error:

ERROR : the length of "X" in bytes must be a multiple of the size of a Unicode character (regardless of the size of the unicode character

please guide on how this can be resolved in ECC.

Regards,

N.Jain

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
552

Hi,

Can u explain what u want to achieve by following statement.

MOVE <n> TO a.

I think it will give error.

Try providing some length to X.

May be something like:

FIELD-SYMBOLS : <n> TYPE X,
                             <c> TYPE C.

DATA : a TYPE i.
DATA : x(12) TYPE x.


a = a + 22.

MOVE a TO x.

ASSIGN x TO <c> CASTING TYPE c.

write <c>.

G@urav

3 REPLIES 3
Read only

Former Member
0 Likes
553

Hi,

Can u explain what u want to achieve by following statement.

MOVE <n> TO a.

I think it will give error.

Try providing some length to X.

May be something like:

FIELD-SYMBOLS : <n> TYPE X,
                             <c> TYPE C.

DATA : a TYPE i.
DATA : x(12) TYPE x.


a = a + 22.

MOVE a TO x.

ASSIGN x TO <c> CASTING TYPE c.

write <c>.

G@urav

Read only

former_member435013
Active Participant
0 Likes
552

Hi,

here is some code to do it:

FIELD-SYMBOLS : <n> TYPE x,

<c> TYPE c.

DATA : a TYPE i.

DATA : x TYPE x.

MOVE <n> TO a.

a = a + 22.

MOVE a TO x.

DATA:

buffer TYPE xstring,

conv TYPE REF TO cl_abap_conv_in_ce,

x_char.

buffer = x.

conv = cl_abap_conv_in_ce=>create(

encoding = 'NON-UNICODE'

input = buffer

).

CALL METHOD conv->read(

EXPORTING

n = 1

IMPORTING

data = x_char

).

ASSIGN x_char TO <c>.

Regards

Walter Habich

Edited by: Walter Habich on Jun 10, 2008 4:09 PM

Read only

Former Member
0 Likes
552

Hi

In Unicode the Formal and Actual parameters should have same type of structure or data types

regards