Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

READ using Binary Search

Former Member
0 Likes
870

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

8 REPLIES 8
Read only

Former Member
0 Likes
844

It will work. Its not necessary that you will have to specify all the key fields in the READ statement

Read only

0 Likes
844

Thanks for the reply, do you have any documet regarding this.

Thanks

Read only

0 Likes
844

You can just hit F1 on READ and check the documentation.

Read only

0 Likes
844

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

Read only

0 Likes
844

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

Read only

0 Likes
844

Thanks a loot vikranth for clearing my doubt, I had a doubt whether READ fails or not.

Read only

Former Member
0 Likes
844

But you will only retrieve the first record that has that key.

Rob

Read only

Former Member
0 Likes
844

Next time, try assigning po1nts to answers that helped you out. This encourages people to answer.

Rob