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 tuning in loop at itab statements

Former Member
0 Likes
673

Hi ,

I have one internal table lets ITAB1[] ,

Its having 15,0000 Records.

now I want to search only 5 records from ITAB1[] compairing ITAB2[] , ITAB2 having 15,0000 records.

what is best method to search this records in minimum time.

loop it ITAB1.

Read table ITAB2 with = ... binary search.

Endloop.

Prblem is that , above statemnt will take 15,0000 intration at each statment while reading.

Hi ,

I have one internal table lets ITAB1[] ,

Its having 15,0000 Records.

now I want to search only 5 records from ITAB1[] compairing ITAB2[] , ITAB2 having 15,0000 records.

what is best method to search this records in minimum time.

loop it ITAB1.

Read table ITAB2 with = ... binary search.

Endloop.

Prblem is that , above statemnt will take 15,0000 intration at each statment while reading.

4 REPLIES 4
Read only

Former Member
0 Likes
637

Hi,

{SORT THE TABLE WITH PROPER CONDITON.

LOOP AT ITAB2INTO IS_ITAB2.

READ TABLE ITAB1 INTO IS_ITAB1 WITH KEY ..........

IF SY-SUBRC = 0.

W_TABIX = SY-TABIX.

LOOP AT IT_ITAB1 INTO IS_ITAB1 FROM W_TABIX.

IF ( PLEASE CHECK THE CONDITON MENTIONED FOR THE BINARY SEARCH HERE )

ELSE.

EXIT.

ENDIF.

ENDLOOP.

}

Please try this this parallel curosor method.. Performance is good..

Regards,

Srinivas.

Read only

jayesh_gupta
Active Participant
0 Likes
637

Hi,

Could you please elaborate further how are you trying to compare the records between the two internal tables.

Regards,

Jayesh

Read only

Former Member
0 Likes
637

Hi,

loop it ITAB1.
Read table ITAB2 with = ... binary search.
Endloop.

I think whatever code you are using now is appropriate only.

As you want to read record from ITAB1 based on data in ITAB2, you will have to loop at ITAB2 and then do binary search on ITAB1. Just make sure that your table ITAB1 is sorted correctly as per the binary search criteria.

Thanks,

Archana

Read only

SuhaSaha
Product and Topic Expert
Product and Topic Expert
0 Likes
637

now I want to search only 5 records from ITAB1

Based on what conditions you have short listed the 5 records of ITAB1 ? Are the fields involved defined (or can be defined) as key fields of the internal table?

BR,

Suhas