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: 

ITAB

Former Member
0 Kudos
130

hi,

i have retrieved data into diff itab's called ita,itb, itc.

i have created a final table called itd.

how to move the data from ita,itb,itc into itd.

urgent.

pls help.

regards,

kb

7 REPLIES 7

Former Member
0 Kudos
96

hi,

u want to add data according to matching value or just want to append?

Former Member
0 Kudos
96

Hi,

Do like this

Sort: itb,itc.

Loop at ita into waa.

read table itb into wab with key f1 = waa-f1 binary search.

if sy-subrc = 0.

read table itc into wac with key f1 = waa-f1 binary search.

if sy-subrc = 0.

move: waa-f1 to wad-f1,

waa-f2 to wad-f2,

wab-f3 to wad-f3,

wac-f4 to wad-f4.

append wad to itd.

clear wad.

endif.

endif.

endloop.

Regards,

Satish

Former Member
0 Kudos
96

Hello,

Do like this.

LOOP AT ITA.

READ TABLE ITB with key field = ITA-FIELD.

if sy-subrc = 0.

  • Move the field to final table.

endif.

READ TABLE ITC with key field = ITA-FIELD.

if sy-subrc = 0.

  • Move the field to final table.

endif.

APPEND FINAL TABL.

ENLOOP.

Cheers,

Vasanth

Former Member
0 Kudos
96

If the structure of all the tables is same, then you can do like this.

Append lines of ita to itd.

append lines of itb to itd.

append lines of itc to itd.

ELSE use...

Loop at ita

move-corresponding ita to wa_itd.

read table itb with key ita-key.

move-corresponding itb to wa_itd.

append wa_itd to itd.

Endloop.

Lokesh

Edited by: Lokesh Aggarwal on Jan 22, 2008 11:30 AM

Former Member
0 Kudos
96

if itabs are related by common field(s) then,

loop at itab1.

itab4-f1 = itab1-f1.

read table itab2 with key f1 = itab1-f1 binary search.

if sy-subrc = 0.

itab4-f2 = itab2-f2.

endif.

read table itab3 with key f1 = itab1-f1 binary search.

if sy-subrc = 0.

itab4-f3 = itab3-f3.

endif.

append itab4.

clear itab4.

endloop.

*---if itab1,itab2 and itab3 have same structure then....

append lines of itab1 to itab4.

append lines of itab2 to itab4.

append lines of itab3 to itab4.

Regards

Vasu

Former Member
0 Kudos
96

Hi,

Try like:

append lines of itab1 to itab2.

Regards,

Renjith Michael.

Former Member
0 Kudos
96

thanks