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

Internal Table to Structure

Former Member
0 Likes
1,849

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

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,564

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

6 REPLIES 6
Read only

Former Member
0 Likes
1,565

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

Read only

Former Member
0 Likes
1,564

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

Read only

Former Member
0 Likes
1,564

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

Read only

RichHeilman
Developer Advocate
Developer Advocate
0 Likes
1,564

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

Read only

Former Member
0 Likes
1,564

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

Read only

Former Member
0 Likes
1,564

hi bharat for this you can do one way

i.e

loop at itab into wa

call function ' '

Pass work area each time.

Endlloop.