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

performance in Internal table

Former Member
0 Likes
612

Hi Guys,

I am looking for help regarding performance of the program.

In my Program I am using one internal table with Where condition ,because of the given where condition The process is very slow

"loop at itab where*****"

is there any other solution to improve the performance.

Can I use hash table or sorted internal table, if so specify me how to do this.

Thanks in advance

5 REPLIES 5
Read only

Former Member
0 Likes
581

if you need more than 1 entry to read you have to loop.

if you know how much you have to read you can leave the loop using "exit".

but in the case you are sure you need to get only 1 entry or the first one (after sort) use "read table itab with key field1 = value1 field2 = value2..."

i hope it answer your question.

Read only

Former Member
0 Likes
581

Read the Rob Burbank blog from early February (7th? 2006).

Sorted table, read first record with key, loop from TABIX until key changes.

Read only

0 Likes
581

And here's the URL:

/people/rob.burbank/blog/2006/02/07/performance-of-nested-loops

Rob

Read only

Former Member
0 Likes
581

hi Sai,

Try Including all the key fields in the where condition and make sure that you declare your internal table fields in the order as they are in the data base table ...

Reward if it helps,

Regards,

Santosh

Read only

Former Member
0 Likes
581

Hi,

use below logic to improve performance of loop

use read table with binary search addition./

sort itab1 by matnr.

loop at itab.

read table itab1 with key matnr = itab-matnr

binary search.

if sy-subrc eq 0.

data lv_index type sy-tabix.

clear lv_index.

lv_index = sy-tabix.

loop at itab1 from lv_index.

if itab-matnr <> itab1-matnr.

clear itab.

exit.

endif.

endloop.

endif.

endif.

endloop.

Regards

amole