‎2008 May 21 7:21 AM
Hi Experts,
My question is, Is it possible to use binary search for a fileld which is blank.
sort it_mhis by warpl abnum knasr.
read table it_mhis into wa_mhis
with key warpl = wa_afih-warpl
abnum = wa_afih-abnum
knasr = ' '. " (Balank)
binary search.
if the above statment is wrong ,i would like to know why??
Regards,
Amit
‎2008 May 21 7:25 AM
its just the sort sequence that matters.. nothing to do with the data in the internal table..
sort it_mhis by warpl abnum knasr.
read table it_mhis into wa_mhis with key warpl = wa_afih-warpl
abnum = wa_afih-abnum
knasr = ' '. " (Balank)
binary search.
if sy-subrc eq 0.
endif.
‎2008 May 21 7:25 AM
its just the sort sequence that matters.. nothing to do with the data in the internal table..
sort it_mhis by warpl abnum knasr.
read table it_mhis into wa_mhis with key warpl = wa_afih-warpl
abnum = wa_afih-abnum
knasr = ' '. " (Balank)
binary search.
if sy-subrc eq 0.
endif.
‎2008 May 21 7:29 AM
Hi,
It is possible, no issues. Binary search addition in read statement works properly only when the internal table sorted with key fields used in the condition of the read.
Regards,
Muthu.
‎2008 May 21 7:29 AM
It will depend upon the content of the internal table if whole column for a field is empty and it is the only key to read the table it will not work.
Looking at this case it will work as this is one of three keys avilable.
As a whole if a key can identify a unique record from an internal table binary serch will work otherwise not.
Regards
Bikas