‎2009 Nov 06 5:15 PM
Hi,
Is it necessary to use all the sorted keys in READ using BINARY SEARCH .
For EX: Sort it_tab BY key1 key2
While Reading i will use only key1 with BINARY SEARCH,Please tell me whether READ statement works?
Thanks,
Rathish
‎2009 Nov 06 5:18 PM
It will work. Its not necessary that you will have to specify all the key fields in the READ statement
‎2009 Nov 06 5:58 PM
Thanks for the reply, do you have any documet regarding this.
Thanks
‎2009 Nov 06 6:02 PM
‎2009 Nov 06 6:12 PM
Thanks for your reply, but in F1 there is nothing about sorted keys, i mean whether we need to use all the keys or few keys
‎2009 Nov 06 6:19 PM
Hello Ratish,
There isnt any hard and fast rule that you will have to use all the fields on which you sort. The key fields which you may want to use in the READ statement depends on the logic with which you are reading the internal table. As Rob pointed out its better to use all the fields which could make a record unique in the READ statement else it would keep reading only the first occurence of the record.
Vikranth
‎2009 Nov 06 6:30 PM
Thanks a loot vikranth for clearing my doubt, I had a doubt whether READ fails or not.
‎2009 Nov 06 5:23 PM
But you will only retrieve the first record that has that key.
Rob
‎2009 Nov 06 6:55 PM
Next time, try assigning po1nts to answers that helped you out. This encourages people to answer.
Rob