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

hash table

Former Member
0 Likes
565

Hello!

How can I insert data into a hash table ?

Regards

Ilhan

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
537

Use INSERT <WA> INTO TABLE <HAS_ITAB>.

This is the most appropriate type for any table where the main operation is key access.

You cannot access a hashed table using its index. The response time for key access remains constant, regardless of the number of table entries. Like database tables, hashed tables always have a unique key.

Hashed tables are useful if you want to construct and use an internal table which resembles a database table or for processing large amounts of data.

4 REPLIES 4
Read only

Former Member
0 Likes
538

Use INSERT <WA> INTO TABLE <HAS_ITAB>.

This is the most appropriate type for any table where the main operation is key access.

You cannot access a hashed table using its index. The response time for key access remains constant, regardless of the number of table entries. Like database tables, hashed tables always have a unique key.

Hashed tables are useful if you want to construct and use an internal table which resembles a database table or for processing large amounts of data.

Read only

Former Member
0 Likes
537

Hello,

U can try like this.

HASHED TABLE:

The new entry is placed in the internal hash administration of the table according to the table key. The key values are taken from the specifiedwork area wa or the header line of the table. The runtime required remains constant, since it does not depend on the number of table entries. The key must be unique.

Vasanth

Read only

Former Member
0 Likes
537

Hi ,

check this:

types: begin of typ_pernr,

pernr like pa0001-pernr,

ename like pa0001-ename,

end of typ_pernr.

data: ls_pernr type typ_pernr,

lt_pernr type hashed table of typ_pernr with unique key pernr.

...

select pernr ename into table lt_pernr from pa0001.

...

loop at itab.

read table lt_pernr with table key pernr = itab-pernr

into ls_pernr.

write: ls_pernr-ename, itab-data.

endloop.

regards,

keerthi

Read only

p291102
Active Contributor
0 Likes
537

Hi,

Defines the table as one that is managed with an internal hash procedure. You can imagine a hashed table as a set, whose elements you can address using their unique key. Unlike standard and sorted tables, you cannot access hash tables using an index. All entries in the table must have a unique key. Access time using the key is constant, regardless of the number of table entries.

You can only access a hashed table using the generic key operations or other generic operations ( SORT, LOOP, and so on). Explicit or implicit index operations (such as LOOP ... FROM oe INSERT itab within a LOOP) are not allowed.

Thanks,

Shankar