‎2007 Dec 27 9:03 AM
Hi
How to do binary search while doing record retirieval?
What is the code need to be written for tht?
‎2007 Dec 27 9:06 AM
Hi ,
Please see the below code
READ TABLE ITAB INTO WA
WITH KEY K = 'X'
BINARY SEARCH.
The table should be of type sorted table or Oder the table and then use the Binary search.
Thanks,
Poonam.
‎2007 Dec 27 9:06 AM
Hi ,
Please see the below code
READ TABLE ITAB INTO WA
WITH KEY K = 'X'
BINARY SEARCH.
The table should be of type sorted table or Oder the table and then use the Binary search.
Thanks,
Poonam.
‎2007 Dec 27 9:11 AM
Hi Jeeva Anto,
Here is the code of using binary search:
data:
begin of i_table oocurs 0,
var1 type i,
var2(10) type c,
end of i_table.
Let i_table have some random data.
First sort the table.
Sort i_table by var1.
Read table i_table with key var1 = 10 binary search.
if sy-subrc eq 0." If search is found
" Do your oprations here using i_table header
endif.
Hope this helps you definitely.
Regards,
Rama chary.Pammi
‎2007 Dec 27 9:16 AM
‎2007 Dec 27 10:50 AM