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 w/o header line TO itab w/o header line

Former Member
0 Kudos

Hi all,

I hv records in internal table w/o headerline and i want to move those in another internal table w/o header line.

Can it be done. if so, pls tell me the way to do it.

Help will be rewarded.

thanks in advance,

Sachin

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi

if u want to move all the values from one internal table to another

use this

itab[] = itab2[]

it will move all the values in itab to itab2

reward if usefull

13 REPLIES 13

Former Member
0 Kudos

Hi,

Just write itab1[ ] = itab2[ ].

Thanks,

Sandeep.

Former Member
0 Kudos

Hi,

Use ITAB1[] = ITAB2[]

else

Loop at iTAB1.

move-corresponding itab1 to itab2 or

move fields from Iatb1 to itab2.

append itab2.

clear itab2.

endloop.

Reward if it helps..

Regards,

Omkar.

Former Member
0 Kudos

HI,

You can use,

MOVE-CORRESPONDING itab1[] to itab2[].

Regards,

Padmam.

Former Member
0 Kudos

Hi Sachin

you can use any of the above mentioned steps

But if you want to move only some specified records into second table, use a work area

DATA: wa_itab1 TYPE itab1.

LOOP AT itab1 INTO wa_itab1.

"do all your condition checks and calculations on wa_itab1 and in the end do"

APPEND wa_itab1 to itab2.

ENDLOOP.

Former Member
0 Kudos

Hi Sachin

move body to body directly

itab2[] = itab1[].

ot append lines of itab1 to itab2.

reward points to all helpful answers

kiran.M

Former Member
0 Kudos

Hi Sachin,

Without using Header Line concept is appreciatable... Because:

Header line concept is not supported by OOPS, Where Future ABAP reports would be converted to OOPS.

Coming to ur Question:

If u have records in ITAB1 and u need to move those to ITAB2:

<b>ITAB2[] = ITAB1.</b>

This statement is enough and good performance compared to other methods.

Reward if Helpful

Regards

--

Sasidhar Reddy Matli.

0 Kudos

hi sasidhar ,

I appreciate ur response but my prob. is to move few records to another internal table after satisfying some condtions.

So please put some light on it.

Sachin.

0 Kudos

Hi Sachin,

That would not be possible without using the header/WorkArea.

Kiran

0 Kudos

Hi Sachin

Pls look at my post above n see if that satisfies you

Cheers

~Arun

0 Kudos

Hello Sachin,

Then Do the following:

data: wa_itab1 like line of itab1.

data: wa_itab2 like line of itab2.

Loop at itab1 into wa_itab1.

if ( ur condition ).

wa_itab2 = wa_itab1.

append wa_itab2 to itab2.

endif.

Rewared If Helpful

Regards

--

Sasidhar Reddy Matli.

Former Member
0 Kudos

Hi

if u want to move all the values from one internal table to another

use this

itab[] = itab2[]

it will move all the values in itab to itab2

reward if usefull

Former Member
0 Kudos

Hi,

You can do it this way.

Declare a work area wa_1 for internal table 1 and wa_2 for int table 2.

Now loop at the first int tab into wa_1.

check your condition.

if it is yes,then move field wise the data to wa_2.

Now append the work area to the int tab2.

e.g.

loop at itab1 into wa_1.

check for condition(like wa_1-fld1 = 'X').

if yes,then move its content.

wa_2-f1 = wa_1-f1.

wa_2-f2 = wa_2-f2.

and so on...

append wa_2 to itab2.

clear wa_1,wa_2.

endloop.

Hope it is useful.

Thanks,

Sandeep.

Former Member
0 Kudos

hi,

try like this

for single record from header 2 header

move itab1 to itab2 or

move-corresponding itab1 to itab2.

for no of records

loop at itab1.

itab2 = itab1. // for adding no of records into body add append itab.

endloop.

but this will have only last record of iatb1 to itab2 bcoz header can store only current record. so append that record st will help to get all records fr4om iatb1 to itab2 and last record will be ther in itab2 header also.

if helpful reward some points.

with regards,

Suresh Aluri.