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

Binary Search

Former Member
0 Likes
527

1.I have 3 columns in ITAB say col1,col2,col3

SORT itab BY col1 col2 col3.

Reab TABLE itab WITH KEY col1 = ... col3 = ... col2=.... WITH BINARY SEARCH.

Will it work? If not why....

2.What are the things we need to check before a READ statement with binary search?

4 REPLIES 4
Read only

andreas_mann3
Active Contributor
Read only

former_member404244
Active Contributor
0 Likes
502

Hi Siva,

The prerquisites is that the standard table must be sorted in ascending order by the specified search key.The binary search works faster than the linear search.

regards,

nagaraj

Read only

Former Member
0 Likes
502

Hi Siva,

Some Corrections are there in the Code Which u have Written After with Keys no need of writing "with " Directly u give binary seach it will work. And It is compulsary to check that the internal table is Sorted. Ok

Bye

Murthy

Read only

rahulkavuri
Active Contributor
0 Likes
502

You need to check whether the <b>internal table is sorted</b> according to requirements before doing binary search

READ TABLE ITAB WITH KEY FIELD1 = ITAB2-FIELD2 BINARY SEARCH.

check this thread for detailed explanation and award points if found helpful