10-07-2008 11:14 AM
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,
10-07-2008 11:31 AM
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>.
10-07-2008 11:16 AM
try to declare your itab with like.
data: itab like table of struct.
tables with headerlines are obsolete anyways.
10-07-2008 11:18 AM
There are few elements of itab and structure that are different, cant define itab as table of structure..
10-07-2008 11:18 AM
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.
10-07-2008 11:22 AM
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
10-07-2008 11:26 AM
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
10-07-2008 11:31 AM
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>.
10-07-2008 12:06 PM
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..
10-07-2008 12:08 PM
10-07-2008 12:08 PM
10-07-2008 12:13 PM
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.
10-07-2008 12:17 PM
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
10-07-2008 12:16 PM
10-07-2008 12:17 PM
Thats the whole point, the program has to be made unicode compliant
10-07-2008 12:26 PM
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.