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

Unicode conversion issue

alejiandro_sensejl
Active Participant
0 Likes
697

Hello gurus,

I've isolated my problem in the following simple coding:

REPORT  zzz_as27361_conversiontest.

TYPES: BEGIN OF t1,
        material   TYPE matnr,
        plant	   TYPE werks_d,
        valid_from TYPE ck_abdat,
        valid_to   TYPE ck_bidat,
        total_amt  TYPE total_amt_head,
        curr       TYPE currency,
       END OF t1.

DATA: z TYPE t1,
      s TYPE string.

s = z.

On syntax check I get the following error:

"S" and "Z" are not mutually convertible in Unicode systems, since you are trying to convert a structure to a field or vice versa.

Can someone tell me how I can move the value of a (flat) structure into a string in an unicode-enabled system?

Thanks in advance,

Alej

PS: Points will be rewarded for helpful answers!

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
670

Hi,

Try doing this way ...

TYPES: BEGIN OF t1,

material TYPE matnr,

plant TYPE werks_d,

valid_from TYPE ck_abdat,

valid_to TYPE ck_bidat,

total_amt TYPE total_amt_head,

curr TYPE currency,

END OF t1.

DATA: z TYPE t1,

s TYPE string,

x(30) type c.

write: z-total_amt to x.

concatenate z-material z-plant z-valid_from z-valid_to x z-curr into s .

Thanks.

Edited by: Cnu on Jul 11, 2008 12:16 PM

5 REPLIES 5
Read only

Former Member
0 Likes
670

hi,

goto attributes and uncheck the "unicode checks active"

may be your problem will solve.

regards,

jagadeesh.

Read only

JozsefSzikszai
Active Contributor
0 Likes
670

hi,

that does not work by Unicode. You can do something like this:

CONCATENATE z-material z-plant ... INTO s.

hope this helps

ec

Read only

Former Member
0 Likes
671

Hi,

Try doing this way ...

TYPES: BEGIN OF t1,

material TYPE matnr,

plant TYPE werks_d,

valid_from TYPE ck_abdat,

valid_to TYPE ck_bidat,

total_amt TYPE total_amt_head,

curr TYPE currency,

END OF t1.

DATA: z TYPE t1,

s TYPE string,

x(30) type c.

write: z-total_amt to x.

concatenate z-material z-plant z-valid_from z-valid_to x z-curr into s .

Thanks.

Edited by: Cnu on Jul 11, 2008 12:16 PM

Read only

0 Likes
670

Hello Jagadeesh,

I asked for an answer in a unicode-enabled system. It's not a very smart solution to simply disable the unicode-checks...

Hello Eric and Cnu,

your approach helped me a lot and in the end this is how I solved it.

Best regards,

Alej

Read only

0 Likes
670

Hello Alej

The correct approach would be to use the static method CL_ABAP_CONTAINER_UTILITIES=>FILL_CONTAINER_C for moving contents of a structured variable into a string.

Regards

Uwe