2007 Oct 03 8:27 PM
Hello there, ( I am new to abap and learning day by day 🐵
we are going through the process of changing to unicode standard. I am getting following error message
"charstring" and "T510Q" are not mutually convertible in a Unicode ....
while trying to do the following: Move t510q to charstring.
"charstring" is a field of 40 and is more than sufficient to get all the data (including c, i, p types etc) from t510q.
Any help will be greatly appreciated!
Thanks in advanced.
Note: I tried to follow the following example...but abap can not find the class...
class CL_ABAP_CONTAINER_UTILITIES definition load.
call method CL_ABAP_CONTAINER_UTILITIES =>FILL_CONTAINER_C
exporting IM_VALUE = STRUC
importing EX_CONTAINER = CONTAINER
exceptions ILLEGAL_PARAMETER_TYPE = 1
others = 2.
2007 Oct 03 8:48 PM
2007 Oct 03 8:55 PM
Hi,
thanks for your input. I will look into it now and let you know if it worked or not for me.
Thanks again!
2007 Oct 03 9:08 PM
Hi J Are,
maybe not yet in your release - and I don't know what you are doing. You can not move t510q to charstring because T510 is a structure containing not only pure character fields, but also a packed decimal curency field amount BETRG.
Because characters are represented as double-bytes under unicode and numeric values remain as they are, a simple move is not possible.
Regards,
Clemens
P.S:
Here is the method's source code, take it into your program:
method fill_container_c .
class cl_abap_char_utilities definition load.
data: l_type_value type c,
l_type_container type c,
l_len_value type i,
l_len_container type i,
l_ref type ref to data.
field-symbols: <xvalue> type x,
<xcontainer> type x,
<ccontainer> type c.
describe field im_value type l_type_value.
case l_type_value.
when 'u'.
describe field ex_container type l_type_container.
case l_type_container.
when 'C'.
assign im_value to <xvalue> casting.
assign ex_container to <xcontainer> casting.
<xcontainer> = <xvalue>.
when 'g'.
describe field im_value length l_len_value in byte mode.
l_len_container =
l_len_value div cl_abap_char_utilities=>charsize +
sign( l_len_value mod cl_abap_char_utilities=>charsize ).
create data l_ref type c length l_len_container.
assign l_ref->* to <xcontainer> casting.
assign im_value to <xvalue> casting.
<xcontainer> = <xvalue>.
assign l_ref->* to <ccontainer>.
concatenate space space into ex_container separated by <ccontainer>.
when others.
message x002(sy).
endcase.
when 'h' or 'v' or 'r' or 'l'. " table, deep struc, object
" referenc, data reference
raise illegal_parameter_type.
when others. " single field
ex_container = im_value.
endcase.
endmethod. "FILL_CONTAINER_C
2007 Oct 04 2:26 PM
Hi,
Thanks to all. The code seems to be working now. I used the field symbols to solve the issue.
thanks very much for the guidance.