2008 Jan 14 5:18 PM
I have the following code with unicode error: -
CONSTANTS: C_LEFT_HEX(1) TYPE X VALUE 'AB'.
CONSTANTS: C_RIGHT_HEX(1) TYPE X VALUE 'BB'.
DATA: W_LONGCHAR(9).
CONSTANTS: C_UNKNOWN(7) VALUE 'Unknown'.
CONCATENATE C_LEFT_HEX C_UNKNOWN C_RIGHT_HEX INTO W_LONGCHAR.
How do I fix the error?
Thanks,
Edited by: Prakash Bhatia on Jan 14, 2008 12:19 PM
2008 Jan 14 5:53 PM
Hi,
Check this code
report zars no standard page heading
line-size 170
line-count 65(4).
data: content type string ,
xcontent type xstring.
data: w_longchar(20).
constants: c_unknown(7) value 'Unknown'.
xcontent = 'AB'.
data: conv type ref to cl_abap_conv_in_ce.
conv = cl_abap_conv_in_ce=>create( input = xcontent ).
conv->read( importing data = content ).
concatenate w_longchar content into w_longchar separated by space.
concatenate w_longchar c_unknown into w_longchar separated by space.
xcontent = 'BB'.
conv = cl_abap_conv_in_ce=>create( input = xcontent ).
conv->read( importing data = content ).
concatenate w_longchar content into w_longchar separated by space.
write : w_longchar.
break-point.
a®
2008 Jan 14 5:33 PM
Hi Prakash,
CONCATENATE statement requires all components to be of type C. I think you need to change your 2 constants from type X to type C.
I assumed that you are getting syntax error on CONCATENATE statment as you didn't mention any details of the error message.
Hope this helps.
Thanks
Sanjeev
2008 Jan 14 5:53 PM
Hi,
Check this code
report zars no standard page heading
line-size 170
line-count 65(4).
data: content type string ,
xcontent type xstring.
data: w_longchar(20).
constants: c_unknown(7) value 'Unknown'.
xcontent = 'AB'.
data: conv type ref to cl_abap_conv_in_ce.
conv = cl_abap_conv_in_ce=>create( input = xcontent ).
conv->read( importing data = content ).
concatenate w_longchar content into w_longchar separated by space.
concatenate w_longchar c_unknown into w_longchar separated by space.
xcontent = 'BB'.
conv = cl_abap_conv_in_ce=>create( input = xcontent ).
conv->read( importing data = content ).
concatenate w_longchar content into w_longchar separated by space.
write : w_longchar.
break-point.
a®