‎2008 Jun 10 2:49 PM
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 cand 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
‎2008 Jun 10 3:00 PM
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
‎2008 Jun 10 3:00 PM
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
‎2008 Jun 10 3:08 PM
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
‎2008 Jun 10 3:16 PM
Hi
In Unicode the Formal and Actual parameters should have same type of structure or data types
regards