03-12-2007 5:26 AM
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
03-12-2007 5:30 AM
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.
03-12-2007 5:28 AM
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.
03-12-2007 5:30 AM
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.
03-12-2007 5:31 AM
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...
03-12-2007 5:35 AM
Then frnds,
why there is clasification for different types of internal tables.
thanking u all.
regards,
satya
03-12-2007 5:38 AM
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.
03-12-2007 5:45 AM
Hi,
is that we hav to sort hashed table before read statement.
plzz clarify.
regards,
satya
03-12-2007 5:55 AM
03-12-2007 5:57 AM
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.
03-12-2007 5:59 AM
so we say that before binary search we shuld sort so is that not required joshep.
thanking u .
regards,
satya
03-12-2007 6:28 AM
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...
03-12-2007 5:34 AM
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
03-12-2007 5:35 AM
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
03-12-2007 5:43 AM
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
03-12-2007 7:04 AM
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).
03-12-2007 7:05 AM
hi
first call the table and den read....and usind STANDAR TABLE OF sttement will b usefulll