Application Development and Automation 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: 
Read only

Avoiding performance issue due to loop within loop on internal tables

Former Member
0 Likes
1,070

Hi Experts,

I have a requirement where in i want to check whether each of the programs stored in one internal table are called from any of the programs stored in another internal table. In this case i am looping on two internal tables (Loop within a loop) which is causing a major performance issue. Program is running very very slow.

Can any one advise how to resolve this performance issue so that program runs faster.

Thanks in advance.

Regards,

Chetan.

3 REPLIES 3
Read only

Former Member
0 Likes
693

Hi,

How are your internal tables defined? Is either table defined as SORTED or HASHED?

If not, that would help a lot with performance.

Regards, Andy

Read only

Former Member
0 Likes
693

hi,

Use Paraller Cursor Cursor concept it will reduce the time very much

[http://www.saptechnical.com/Tutorials/ABAP/ParallelCursor.htm]

This link would help u to understand better

Regards,

priya

Read only

Former Member
0 Likes
693

Forget the parallel cursur stuff, it is much to complicated for general usage and helps nearly nothing. I will publish a blog in the next days where this is shown in detail.

Loop on loop is no problem if the inner table is a hashed or sorted table.

If it must be a standard table, then you must make a bit more effort and faciliate a binary search (read binary search / loop from index exit)

see here the exact coding Measurements on internal tables: Reads and Loops:

/people/siegfried.boes/blog/2007/09/12/runtimes-of-reads-and-loops-on-internal-tables

And don't forget, the other table must not be sorted, the loop reaches anyway every line. The parallel cursor requires both tables to be sorted. The additional sort

consumes nearly the whole advantage of the parallel cursor compared to the simple but good loop in loop solutions.

Siegfried