**Linear search:** It is a sequential search or it searches line by line. So it is slow and it takes too much time to find out the data.

**Binary search:** In Binary search it divide the table into two parts, a lower value part and a upper value part, after dividing It will check with the middle value if its lesser than the searched element than it goes to right half else it goes to left half. Therefore it is necessary that the search filed of the table should be in Ascending order. If you sort the list in descending order then binary search fails.

You can't use BINARY SEARCH with SORTED or HASHED tables - you'll get a syntax error. BINARY SEARCH is used for internal table ,you must Sort your Internal Table in ASCENDING order for BINARY SEARCH.

**Find more results on SAP ABP Forums**

E.g suppose we have 5 sales order like this and you have to find 100033:

100010

100011

100022

100033

100044

so linear search will start search from 100010 to 100011 to 100022 and then 100033.

we proceed 1 by 1 : it takes 4 iterations

Binary search:

In binary search it breaks the list into two parts and take middle value(100022) compare with 100033 now we are left with

100033,100044

we compare (100033) and (100044) with 100033

Thus process completed in 2 iteraions. so it is very fast.

Binary search must be preffered over linear sarch.