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 table in abap without declaring internal table as sorted.

Former Member
0 Likes
1,875

Hi All,

Can i read table without deaclaring internal table as a sorted table.

means if we will not declar internal table as a sorted table than  can we use read table concept.

Moderator message: please search for available information and documentation before posting.

Message was edited by: Thomas Zloch

6 REPLIES 6
Read only

former_member206439
Contributor
0 Likes
1,513

Yes you can use it with out sorting an Internal table but the read statement should not be a Binary search addition.

For Binary search the internal table should be sorted for normal read no need to sort.

Read only

0 Likes
1,513

data : itab type table of crmd_orderadm_h,

          stru like line of itab.

       

read itab with  table key guid = '22334' into stru.

This code will execute or not. or we have to declare itab as sorted table.

DATA itab type sorted TABLE OF crmd_orderadm_h WITH UNIQUE KEY col1.

stru like line of itab.

read itab with  table key guid = '22334' into stru.

Read only

Former Member
0 Likes
1,513

Your question is not much clear.

So, you can create internal table with hashed also. For this method you have to provide unique key whereas for sorted you can also use non-unique key. And you can use read with hashed internal table also.

And if you don't want to use internal tables then you can use SELECT-ENDSELECT command. But this method is not recommended.

Read only

0 Likes
1,513

data : itab type table of crmd_orderadm_h,

         stru like line of itab.

       

read itab with  table key guid = '22334' into stru.

This code will execute or not. or we have to declare itab as sorted table.

DATA itab type sorted TABLE OF crmd_orderadm_h WITH UNIQUE KEY col1.

stru like line of itab.

read itab with  table key guid = '22334' into stru.

Read only

0 Likes
1,513

Yes, this will execute but take more time in searching as this will use linear search whereas if you use sorted or hashed table, search time will be less.

Read only

0 Likes
1,513

It will work fine.