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 in method READ_CONTAINER_C when passing string to structure in Unicod

Former Member
0 Likes
1,806

Hi All,

We are upgrading system from non-unicode to unicode.

While passing a string to a structure ( MOVE RECEIVERS-RECEIVER TO RECEIVER_OBJECT, where

RECEIVERS_RECEIVER = string

RECEIVER_OBJECT = structure )

following error is thrown :

"RECEIVER_OBJECT" and "RECEIVERS-RECEIVER" are not mutually convertible in a unicode program.

To resolve this error, I've used :

CALL METHOD CL_ABAP_CONTAINER_UTILITIES=>READ_CONTAINER_C

EXPORTING

IM_VALUE = RECEIVERS-RECEIVER

IMPORTING

EX_CONTAINER = RECEIVER_OBJECT

EXCEPTIONS

ILLEGAL_PARAMETER_TYPE = 1

others = 2

But I observed the problem of inccorect values for numeric fields. For example suppose the string contains the value 'abc1234' and we use CL_ABAP_CONTAINER_UTILITIES=>READ_CONTAINER_C to transfer this string to a structure suppose, S1 with 2 fields namely field1(3) type c and field2 type i. then field1 gets the correct value i.e. 'abc' but field2 gets incorrect value and not '1234'. Can anyone provide the resolution? Prompt reply will be highly appreciated.

Thanks.

2 REPLIES 2
Read only

Former Member
0 Likes
1,021

hi

Instead of directly passing a string in container use character type object of same length as structure and then fill your structure with the container you have used , it will solve yoour issue.

thanks

sunny

Read only

Sm1tje
Active Contributor
0 Likes
1,021

There is no error in this method. The 'problem' is caused by the fact that you are combining character type and Type I in your parameter which has generic type CSEQEUNCE.

It is advised that you 'copy' your data component by component in Unicode.