2007 Jul 19 10:26 AM
hi dar
i want to write..
read itab1 into wa_itab1 with key field4 binary search.
for this shud i sort the itab1 by field4 ?
2007 Jul 19 10:27 AM
2007 Jul 19 10:28 AM
hi TUBORG,
yes it is prerequisite to sort the table by field which is used in binary search
SORT ITAB1 BT FIELD4.
read itab1 into wa_itab1 with key field4 eq v_field4 binary search.
2007 Jul 19 10:36 AM
Hi Tuborg ,
You need to sort the internal table with the field field4 , as this is mandatory when you use binary search .
The reson being binary search finds the record in the middle and checks if the value is less that the value we are searching for , if it is then it searches from the first record to this record and so on.
So if we do not sort the table then we may miss out the redcord we are searching for
Regards
Arun