‎2010 Feb 15 10:39 AM
Hi All ,
Wat could be the Best way of resolving a Loop inside a loop????
wat are the possible ways of resolving it..???
Thanks in advnce.
Regards
Aslam.
‎2010 Feb 15 10:49 AM
You can use Parallel Cursors.
link:[http://help-abap.blogspot.com/2009/12/parallel-cursor-to-speed-up-performance.html]
‎2010 Feb 15 11:51 AM
I discuss this point extensively ... in a German test book
http://www.dpunkt.de/buch/3096.html
There are three possiblities for nested processing of internal tables:
loop at itab1
read table itab2
...
1:1 relation between records of the 2 tables. You must take care that the inner processing is faster than a sequential read,
i.e. use binary search (automatically with sorted tables) or direct access (index or hashed tables).
loop at itab1
loop at itab2 where
1:C relation like header and position etc. This also automatically solved with sorted and hashed tables. With standard tables there is a bit more complicated work-around possible (see Measurements on internal tables: Reads and Loops:
/people/siegfried.boes/blog/2007/09/12/runtimes-of-reads-and-loops-on-internal-tables).
loop at itab1
loop at itab2
No relation between the records of the two tables.
+ Either one of the two tables is small, then there is no problem.
+ Or there is relation where each record of the inner table is related to each record of the other, this is only the case with
complicated optimization problems, and usually never with business tasks.
Nested loops can alsop be constructed with READs and some logic on the indexes, can be nested over several modularization layer etc etc. They can look very different, but they are all the same!
Of course the same hold for MODIFY, INSERT and DELETE. The whole discussion needs 20 pages.
I personally do not recommend the parallel cursor, because it is much to complicated in the general case (both tables have extra records!
Siegfried
‎2010 Feb 16 2:22 PM
Moderator message - Please search before asking - post locked
Rob