2009 Oct 09 2:43 AM
Hi everybody.
i have a basic abap question.
i have 3 itabs
itab1 has po and item(and other fields)
po1 item1
po2 item2
itab2 has so and item(and other fields)
so1 item1
so2 item2
now i want to add them to itab 3 which should like follows.
Itab3
PO po_ITEM SO SO_Item
_________________________
po1 item1 -- -- ( so and its item are blank)
po2 item2 -- --
-- -- so1 item1 ( po and its items are blank)
-- -- so2 item2
whats the efficient way of doing this.
curently i am looping on itab1 and itab2 separately and moving each field into itab3?
loop at itab1 into wa_itab1
itab3-po = wa_itab1-po,
itab3-po_item = wa_itab1-po_item,
endloop.
loop at itab2 into wa_itab2
itab3-so = wa_itab2-so,
itabs-so_item = wa_itab2-so_item,
endlop.
is there any better way?
2009 Oct 09 8:28 AM
there is no more efficient way, you must loop over the 2 itabs, because you change also the format.
I have some doubts about the usefulness of this approach, I don't see why you mix two unrelated tables into one.
2009 Oct 09 7:41 AM
Hi Ruel,
Instead of using loop statements,you can carry the same process by DO Statement.i guess Do statement works faster than loop when you know the number of records in the two table.
ex.count the number of records for both the tables and using DO pass the values to final internal table.
thanks,
Amit
2009 Oct 09 8:28 AM
there is no more efficient way, you must loop over the 2 itabs, because you change also the format.
I have some doubts about the usefulness of this approach, I don't see why you mix two unrelated tables into one.
2009 Oct 09 11:42 AM
Probably you could replace the first loop alone with append lines of just for this scenario, if two loops makes your program look bad.
append lines of itab1 to itab3.
loop at itab2 into wa_itab2
itab3-so = wa_itab2-so,
itabs-so_item = wa_itab2-so_item,
endlop.
As seigfried said there is no other efficient way.
Vikranth
2009 Oct 09 11:56 AM
please be aware that the structure of itab3 seems to different from itab1 and itab2 !
=> 2 loops necessary!
but no performance problem because they are not nested !
please close the thread
2009 Oct 09 4:00 PM
Thanks to all. i gave points.
yeah I am not happy about the usefulness either, but thats the requirement.. just needed a second opinion on my approach.
thanks guys. closing thread
cheers!!
Edited by: Ruel Ralfson on Oct 9, 2009 5:00 PM
| User | Count |
|---|---|
| 4 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |