‎2006 Sep 28 6:07 AM
Hi Friends,
I have one problem in programming.
data: itab like table of kna1,
itab1 like table of kna1.
select * from kna1 into table itab where kunnr = s_kunnr.
now my data is in itab.
*now i wanted to do the loop for every record & transfer it to itab1.
i had already fetch the data in internal table itab_doc.
**just like
loop at itab into itab1 where kunnr = itab_doc-kunnr.
append itab to itab1.
endloop.
but here i m getting the error itab cannot be converted to the line type of itab1.
will u tell me how to resolve this???
‎2006 Sep 28 6:12 AM
‎2006 Sep 28 6:13 AM
Hello,
Please try like this
<b>data: itab like table of kna1 with header line,
itab1 like table of kna1 with header line.</b>
loop at itab into itab1 where kunnr = itab_doc-kunnr.
append itab to itab1.
endloop.
Reward if helps
Regards,
Krishna
‎2006 Sep 28 6:13 AM
your problem is
loop at itab into itab1 where <b>kunnr = itab_doc-kunnr</b>.
append itab to itab1.
endloop.
u can replace
<b>kunnr = s_kunnr</b>
‎2006 Sep 28 6:14 AM
hi,
Do like this.
data: itab like table of kna1,
itab1 like table of kna1.
<b>DAtA : wa_itab like kna1.</b>
select * from kna1 into table itab where kunnr = s_kunnr.
loop at itab into <b>wa_itab</b> where kunnr = itab_doc-kunnr.
append <b>wa_itab</b> to itab1.
endloop.
regards'
Ahasan
‎2006 Sep 28 6:23 AM
Hi Salil,
data: itab type standard table of kna1,
itab1 type standard table of kna1,
wtab type kna1.
select * from kna1 into table itab where kunnr = s_kunnr.
loop at itab into wtab where kunnr = itab_doc-kunnr.
append wtab to itab1.
endloop.
Best regards,
Prashant
‎2006 Sep 28 7:41 AM
better way is to use MOVE CORRESPONDING in this case
loop at itab into itab1 where kunnr = itab_doc-kunnr.
<b>MOVE CORRESPONDING ITAB TO ITAB1.
append itab1.</b>
endloopMove CORRESPONDING will move all the fields which are same in both the tables.
Regards
srikanth
‎2006 Sep 28 7:51 AM
hi salil.
this will work for u.
Tables : kna1.
data : itab like kna1 occurs 0 with header line,
itab1 like itab.
-ur select query-
if itab[] is not initial.
loop at itab where kunnr = itab_doc-kunnr.
append itab to itab1.
clear itab.
endloop.
endif.
rgds
anver
pls mark hlpful answers
‎2006 Sep 28 8:02 AM
Hi,
use have to use header line
<b> data: itab like table of kna1 with header line,
itab1 like table of kna1 with header line.</b>Regards
amole