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 error

Former Member
0 Likes
2,057

Hi All,

I am getting unicode error while we are upgrading from 4.6 to ECC 6. 0 in below statement.

data: a(100).

b is a deep structure that has all data type field like C,N,D.

Move a to b..

Thanks

Mohit

22 REPLIES 22
Read only

Former Member
0 Likes
2,021

Hi All,

Any help on this issue.

Thanks

Mohit

Read only

0 Likes
2,021

Use field symbols.

Field-Symobol <fs> type c.

assign a to <fs> casting.

Move <fs> to b.

Edited by: vijetasap on Oct 1, 2009 8:09 AM

Read only

0 Likes
2,021

Hi,

have to move field wise then there won't be any error.

in unicode programs inorder to move data directly we should have both the source and target system to be of same structure then only it will work.

Regards,

Nagaraj

Read only

Sm1tje
Active Contributor
0 Likes
2,021

You will now have to move the data field by field like this:

b-field1 = a+0(10).

b-field2 = a+10(5).

etc.

Read only

venkat_o
Active Contributor
0 Likes
2,021

Hi Mohit, Try this way.


MOVE-CORRESPONDING a to b.
Thanks Venkat.O

Read only

Former Member
0 Likes
2,021

>

> Hi Mohit, > Try this way. >


> MOVE-CORRESPONDING a to b.
> 
> Venkat.O

venkat, this wont work as a is not a structure.

Read only

venkat_o
Active Contributor
0 Likes
2,021

Hi, Sorry for that . He can try this way.


REPORT ztest_program.
DATA a(100).
DATA:BEGIN OF b,
      a(100),
      str1 TYPE string,
      num1 TYPE num,
      mara TYPE TABLE OF mara,
     END OF b.
a = 'Venkat'.
MOVE a to b-a.

WRITE: b-a.
Thanks Venkat.O

Edited by: Venkat.O on Oct 1, 2009 2:36 AM

Read only

0 Likes
2,021

>

> >

> > Hi Mohit, > > Try this way. > >


> > MOVE-CORRESPONDING a to b.
> > 
> > Venkat.O

> venkat, this wont work as a is not a structure.

Then give a a structure....

Or move substrings.

Read only

Former Member
0 Likes
2,021

hi rainer,

what else are we suggesting in the thread

Read only

0 Likes
2,021

At the time when opening this issued there was only 1 reply. So what are you complaining for?

Read only

Former Member
0 Likes
2,021

Hi ,

Move-corresponding doesn't work.

Thanks

Mohit

Read only

Former Member
0 Likes
2,021

so us the declaration of that structure B

Read only

Former Member
0 Likes
2,021

why dont u use field symbols.

Read only

Former Member
0 Likes
2,021

maybe the following helps:


CALL METHOD cl_abap_container_utilities=>read_container_c
  EXPORTING
      im_container = a
  IMPORTING
      ex_value = b.

Read only

Former Member
0 Likes
2,021

Hi

I believe u need to transfer the data from A to a structure splitting the string of A and moving field by field, something like this:

DATA: A(100).

DATA: MY_STRUCT TYPE REF TO CL_ABAP_STRUCTDESCR.

data: v_len    type i,
      v_offset type i.

DATA: BEGIN OF B,
        B1(10),
        B2 TYPE I,
        B3(5),
      END OF B.

DATA: W TYPE ABAP_COMPDESCR.

FIELD-SYMBOLS <fs> type any.


a(10)   = 'Bye Bye'.
a+10(4) = '10'.
a+14(5) = 'OK'.


MY_STRUCT ?= CL_ABAP_STRUCTDESCR=>DESCRIBE_BY_DATA( B ).

LOOP AT MY_STRUCT->COMPONENTS INTO W.

  v_len = w-length.

  if w-type_kind = 'C'.
    v_len = v_len / CL_ABAP_CHAR_UTILITIES=>CHARSIZE.
  endif.

  ASSIGN COMPONENT w-name of STRUCTURE b to <fs>.

  move a+v_offset(v_len) to <fs>.

  v_offset = v_offset + v_len.

ENDLOOP.

write: b-b1, / b-b2, / b-b3.

Read only

Former Member
0 Likes
2,021

assign a to the field of b. dont assign directly.

b-f1 = a. or

b-f1 =a+0(10).

b-f2 = a+11(15). etc

by the way, have you enabled unicode check in the program attributes?

Read only

0 Likes
2,021

Hi,

I don't know in which field's of target structure i have to move source field.so i am not able to move one by one from source to target.

Thanks

Mohit

Edited by: Mohit khandelwal on Oct 1, 2009 9:25 AM

Read only

0 Likes
2,021

I don't know in which field's of target structure i have to move source field.so i am not able to move one by one from source to target

You did move the data field A to B previous to upgrade, right? So you should know where to move the source data into target field.

For example:

b has 3 fields.

b1 = 10 char.

b2 = 3 char.

b3 = 1 char.

So the first 13 characters of A were moved to the first 3 fields of B. And that's exactly what you have to do know, field by field.

If it has to be a bit more dynamic, you should determine all the fields of structure B at run time, and per field determine the offset and length that has to be move from A to B.

Read only

0 Likes
2,021

Hi ,

Development in 4.6 was done by some other vendor and also this is not documented anywhere that which field's of target structure get populated from source.

Thanks

Mohit

Read only

0 Likes
2,021

>

> Hi ,

> Development in 4.6 was done by some other vendor and also this is not documented anywhere that which field's of target structure get populated from source.

> Mohit

Mohit,

jsut double click on B, it will take you to the declaration. check the fields defined under it

Read only

Former Member
0 Likes
2,021

Hi.

Use

CL_ABAP_CONTAINER_UTILITIES=>READ_CONTAINER_C( exporting im_container = a

importing ex_value = b ).

Read only

Former Member
0 Likes
2,021

you can use the function module..

CALL FUNCTION 'PI_BP_MOVE_UNICODE'

EXPORTING

iv_move_from = <sourse structure>

CHANGING

cv_move_to = <tab>.

else you can also use this code.

filed-symbols : <tab1> type c.

assign <tab2> to <tab1> casting.

This should work for you.. if this too does not work then take offset and pass the data.