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

hashed alg

Former Member
0 Likes
412

what is hashed algorithm,

pls answer this question,

amruth.

1 REPLY 1
Read only

Former Member
0 Likes
324

Hi,

check these out (general information):

Hash function

Hash table

Hash list

Hash tree

if you want a internal table which allows faster reading then you should go for hashed table , but the disadvantage is that you cannot use index to read the hashed itab.

you have to use keys.

sample declratin of hashed table.

data:cc_text TYPE HASHED TABLE OF /bi0/tcostcenter WITH UNIQUE KEY co_area costcenter langu .

to read entries from the hashed table.

READ TABLE cc_text INTO wa_cc_text WITH KEY

co_area = coarea

costcenter = cctr

langu = sy-langu .

Hash table access time dosent increase based on the number of records, its constant.

check out the ABAP key work documentation for different types of internal table and their usages.

> How Hash Algorithm and Logarithmic Algorithm works

> to fetch the data ?

Fetching part is the same as standard internal table, only when you work with the internal table, than it's different.

> What the basic things we have to keep in mined when

> we select the Internal table ?

Eg Performance.

> Any rule for selecting the internal table which

> should be followed ?

Standard table is quite easy to use, but you might loose performance with it. Most of the time hash table is the fastest.

Using standard table and sort it is a good choice, when you access in READ TABLE via BINARY SEARCH.

Check 'ABAP for Power Users' SAP tutorial in SDN, it very good explains this topic in detail.

http://www.sap.info/public/en/category.php4/Category-28943c61b1e60d84b/page/0/article/Article-119884...

Reward points if found helpful…

Cheers,

Chandra Sekhar.

If you use only partial key to search in a hash table, this would take as long as standard table (based on my experience). You must specify all key fields in your READ statement get the benefit of hash table. In case you only had first few fields of a key that you want to search by, you should use SORTED table instead of a HASH table.

Example:

data:cc_text TYPE HASHED TABLE OF /bi0/tcostcenter WITH UNIQUE KEY co_area costcenter langu.

If you performed your READ the following way, the performance would be constant.

READ TABLE cc_text INTO wa_cc_text WITH KEY

co_area = coarea

costcenter = cctr

langu = sy-langu .

If you performed your READ the following way, the performance would be much slower.

READ TABLE cc_text INTO wa_cc_text <b>WITH KEY

co_area = coarea.</b>