‎2006 Nov 27 2:36 PM
Hi ,
I was doing a FM .I brought some data into an Internal Table.
I need to put all the data from the ITAB to a structure .Please tell me the syntax to move all the data from ITAB to a Structure.
Thanks
‎2006 Nov 27 2:39 PM
loop at itab into workarea.
endloop.
where workarea is the struc.
or
read table itab into workarea index idx.
or
read table itab into workarea with key f1 = 'X'.
santhosh
‎2006 Nov 27 2:39 PM
loop at itab into workarea.
endloop.
where workarea is the struc.
or
read table itab into workarea index idx.
or
read table itab into workarea with key f1 = 'X'.
santhosh
‎2006 Nov 27 2:40 PM
Hi Bharat,
Just Define a table in your FM and pass the internal table to the same.
But for that You need to define a structure on the same type as ur internal table
in SE11 and use in SE37 -> Tables which assigning the type.
This way you transfer Internal table into FM.
Hope this helps,
Manish
Message was edited by:
Manish Kumar
‎2006 Nov 27 2:40 PM
Hi if all the data is in ITAB and ur ITAB and output structure are both of same data type then u can do like
outputitab[] = itab[]
where u declare in the tables parameter as outputitab type <structure name>
and itab also of same type.
Regs
Manas Ranjan Panda
‎2006 Nov 27 2:40 PM
You can only move one line of your ITAB to the structure at one time. Lets say that WA is a structure with the same structure as ITAB.
Loop at ITAB.
move itab to wa.
endloop.Or you can.....
Loop at itab into wa.
endloop.Or you can.....
read table itab into wa index 1.You can not move the entire contents of your ITAB into a structure, unless you are working with deep structures.
Regards,
Rich Heilman
‎2006 Nov 27 2:40 PM
HI,
If the Internal table structure and the Structure is same then move directly form itab to Structure,
if these both are not same, then loop that Internal table and move field by field to that structure.
before end loop use insert command.
Regards
Sudheer
‎2006 Nov 27 2:41 PM
hi bharat for this you can do one way
i.e
loop at itab into wa
call function ' '
Pass work area each time.
Endlloop.