2007 Aug 13 9:53 AM
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
2007 Aug 13 10:26 AM
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
2007 Aug 13 9:56 AM
2007 Aug 13 9:56 AM
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.
2007 Aug 13 9:59 AM
HI,
You can use,
MOVE-CORRESPONDING itab1[] to itab2[].
Regards,
Padmam.
2007 Aug 13 10:02 AM
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.
2007 Aug 13 10:07 AM
Hi Sachin
move body to body directly
itab2[] = itab1[].
ot append lines of itab1 to itab2.
reward points to all helpful answers
kiran.M
2007 Aug 13 10:11 AM
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.
2007 Aug 13 10:23 AM
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.
2007 Aug 13 10:25 AM
Hi Sachin,
That would not be possible without using the header/WorkArea.
Kiran
2007 Aug 13 10:28 AM
Hi Sachin
Pls look at my post above n see if that satisfies you
Cheers
~Arun
2007 Aug 13 10:30 AM
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.
2007 Aug 13 10:26 AM
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
2007 Aug 13 10:28 AM
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.
2007 Aug 13 10:33 AM
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.