Application Development 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: 

internal tables read

Former Member
0 Kudos

Hi gurs's,

when we are using

Read table itab with key...... which type of internal table is more faster

and can we use with key statement in standard tables.

regards,

satya

1 ACCEPTED SOLUTION

amit_khare
Active Contributor
0 Kudos

When you are using Read Table command it is advisable to sort internal table before and then call Read statement with Binary Search option to increase the performance.

Therefore many a times it is an advantage to use SORTED internal table rather using normal internal tables.

Regards,

Amit

Reward all helpful replies.

15 REPLIES 15

Former Member
0 Kudos

HI,

A sorted standard internal table gives faster results with this option.

"With key" can be used with standard internal tables.

Please also check using the option "binary search"

read table<itab> with key <key> binary search.

Thanks,

Rashmi.

amit_khare
Active Contributor
0 Kudos

When you are using Read Table command it is advisable to sort internal table before and then call Read statement with Binary Search option to increase the performance.

Therefore many a times it is an advantage to use SORTED internal table rather using normal internal tables.

Regards,

Amit

Reward all helpful replies.

Former Member
0 Kudos

With key option is more faster with sorted internal tables...

For standard internal tables for performance we have to use binary search option.

read table ... with key col = .... binarysearch .

The prerequisite for this binary search is the table should be sorted...

0 Kudos

Then frnds,

why there is clasification for different types of internal tables.

thanking u all.

regards,

satya

0 Kudos

Hi satya,

check this..

Table type

The table type determines how ABAP will access individual table entries. Internal tables can be divided into three types:

Standard tables have an internal linear index. From a particular size upwards, the indexes of internal tables are administered as trees. In this case, the index administration overhead increases in logarithmic and not linear relation to the number of lines. The system can access records either by using the table index or the key. The response time for key access is proportional to the number of entries in the table. The key of a standard table is always non-unique. You cannot specify a unique key. This means that standard tables can always be filled very quickly, since the system does not have to check whether there are already existing entries.

Sorted tables are always saved sorted by the key. They also have an internal index. The system can access records either by using the table index or the key. The response time for key access is logarithmically proportional to the number of table entries, since the system uses a binary search. The key of a sorted table can be either unique or non-unique. When you define the table, you must specify whether the key is to be UNIQUE or NON-UNIQUE. Standard tables and sorted tables are known generically as index tables.

Hashed tables have no linear index. You can only access a hashed table using its key. The response time is independent of the number of table entries, and is constant, since the system access the table entries using a hash algorithm. The key of a hashed table must be unique. When you define the table, you must specify the key as UNIQUE.

0 Kudos

Hi,

is that we hav to sort hashed table before read statement.

plzz clarify.

regards,

satya

0 Kudos

Any help frnds,

regards,

satya

0 Kudos

Hi satya,

You cannot access a hashed table using its index.

i.e. the response time is independent of the no of entries in the table.

I dont think we need to sort a hashed table.

0 Kudos

so we say that before binary search we shuld sort so is that not required joshep.

thanking u .

regards,

satya

0 Kudos

The key access in a hashed table is constant independent of the table entries.

For hash tables i think we dont want to sort..

(Guys,Please correct me if i am wrong)

but sorting

for other table which works based on index (standard) has to be sorted if u r using binary search in read.

Sorted tables are sorted if u add entries to it...

Former Member
0 Kudos

Hi,

Check this link..

The Processing speed depends

1. Internal table type

2. Data in the internal table.

http://help.sap.com/saphelp_erp2005vp/helpdata/en/c9/5472f6787f11d194c90000e8353423/frameset.htm

Message was edited by:

albert joseph

Former Member
0 Kudos

Satya,

In key concept Hashed table type is the more faster .By default standard table will be there.

1. Sort the internal table first

2. Use Binary search for your internal table.

3.When you sorted the table no need to use SORT table type.

Pls. mark if useful

Former Member
0 Kudos

Hi Satya,

Before you read the itab, please make sure that you SORT the table on the fields which u are using in WITH KEY < fields > otherwise they may result wrong values read from this statement.

and you can use SORT <itab> STABLE. addition as well to make sure that it does not change its sort sequence even though you sort it as many times as you want.

Reward points if the answer was helpful.

Regards,

Tejas

Former Member
0 Kudos

hi

When you are using Read Table command it is advisable to sort internal table before and then call Read statement with Binary Search option to increase the performance (the table is sorted in acending order otherwise read statement set the sy-subrc value as 0 if the search key middle one in first iteration).

Former Member
0 Kudos

hi

first call the table and den read....and usind STANDAR TABLE OF sttement will b usefulll