Application Development 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: 

Not mutually convertible structure and itab

Former Member
0 Kudos

Hi All,

I have defined a structure struct with table ekpo and itab with include structure ekpo.

Itab :

DATA: BEGIN OF ITAB OCCURS 10.

INCLUDE STRUCTURE EKPO.

END OF ITAB.

and Struct

DATA: BEGIN OF STRUCT.

INCLUDE STRUCTURE EKPO.

END OF STRUCT.

Before "Move itab to struct" used to work fine. But now I have enabled the unicodes check, and it gives me error of mutually not convertible structures.

Can someone guide me of a work around ?

thanks,

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi,

Just define Field-Symbols .

FIELD-SYMBOLS: <ITAB> TYPE EKPO,

<STRUCT> TYPE ANY.

ASSIGN ITAB TO <ITAB> .

ASSIGN STRUCT TO <STRUCT> .

MOVE : <ITAB> TO <STRUCT>.

14 REPLIES 14

Former Member
0 Kudos

try to declare your itab with like.

data: itab like table of struct.

tables with headerlines are obsolete anyways.

0 Kudos

There are few elements of itab and structure that are different, cant define itab as table of structure..

Former Member
0 Kudos

Hi,

Move itab to struct.

This st will move the content of the automatically created work area - itab, to the work area struct.

One simple way is to Explicitly create an work area for your itab.

Former Member
0 Kudos

Hi.

define your structure using TYPES.


TYPES: BEGIN OF STRUCT,
             INCLUDE STRUCTURE EKPO.
TYPES: END OF STRUCT.

DATA: BEGIN OF ITAB OCCURS 10,
           INCLUDE STRUCTURE EKPO.
DATA:  END OF ITAB.

its better you use work area than using interanal tables with header lines.

Regards

Winnie

Former Member
0 Kudos

Hi

I'm using release ecc 6.00 with unicode system and this statament works fine:

DATA: BEGIN OF ITAB OCCURS 10.
        INCLUDE STRUCTURE EKPO.
data: END OF ITAB.

DATA: BEGIN OF STRUCT.
        INCLUDE STRUCTURE EKPO.
data: END OF STRUCT.

start-of-selection.

  move itab to struct.

If u can't do it u can try to change the definition of your structure:

DATA: ITAB TYPE TABLE OF EKPO WITH HEADER LINE
DATA: STRUCT TYPE EKPO.

and/or use the field-symbol to transfer the value:

field-symbols: <wa_in>  type any,
                 <wa_out> type any.

  do.
    assign component sy-index of structure itab to <wa_in>.
    if sy-subrc <> 0. exit. endif.
    assign component sy-index of structure struct to <wa_out>.
    <wa_out> = <wa_in>.
  enddo.

Max

Edited by: max bianchi on Oct 7, 2008 12:27 PM

Former Member
0 Kudos

Hi,

Just define Field-Symbols .

FIELD-SYMBOLS: <ITAB> TYPE EKPO,

<STRUCT> TYPE ANY.

ASSIGN ITAB TO <ITAB> .

ASSIGN STRUCT TO <STRUCT> .

MOVE : <ITAB> TO <STRUCT>.

0 Kudos

Thanks a lot for your help, But I did not mention one point and hence I think we are not on same page of same book.

My itab also contains one element apart from table EKPO, this element is called data1 which is different in structure..

0 Kudos

Hi

Can u post the definition of ITAB?

Max

0 Kudos

There's your problem!

Do a move-corresponding then.

0 Kudos

Definition of structure :

DATA: BEGIN OF SEKPO.

INCLUDE STRUCTURE EKPO.

DATA: FIRST_VARPOS,

END OF SEKPO.

Definition of ITAB:

DATA: BEGIN OF XEKPO OCCURS 10.

INCLUDE STRUCTURE EKPO.

DATA: BSMNG LIKE EKES-MENGE,

END OF XEKPO.

_________________________________________

Error at statement: move xekpo to sekpo.

0 Kudos

Hi

Just as somebody says MOVE-CORRESPONDING should wrok fine:

DATA: BEGIN OF SEKPO.
        INCLUDE STRUCTURE EKPO.
DATA:   FIRST_VARPOS,
      END OF SEKPO.

*Definition of ITAB:

DATA: BEGIN OF XEKPO OCCURS 10.
        INCLUDE STRUCTURE EKPO.
DATA:   BSMNG LIKE EKES-MENGE,
      END OF XEKPO.

start-of-selection.

  move-corresponding xekpo to sekpo.

Max

former_member182426
Active Contributor
0 Kudos

hi,

uncheck that UNICODE option in attributes.

Regards,

shankar.

0 Kudos

Thats the whole point, the program has to be made unicode compliant

0 Kudos

hi,

Are u doing like this

Loop at itab into struct.

.........

Endloop.

r some other way like using READ statemnt....

just post ur logic here.

Regards,

shankar.