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: 

sorted and hashed tables

Former Member
0 Kudos

what happens when duplicate entries are present in sorted and hashed tables?

5 REPLIES 5

Former Member
0 Kudos

Hi,

Sorted internal tables can be of two types:

unique or non unique.

If u enter duplicate records in Sorted tables with unique it will show error.

If u enter duplicate records in Sorted tables with non-unique key it will not show error.

Hashed tables are with only unique key

so no way to enter the duplicate records.

for more information see the following link

http://help.sap.com/saphelp_nw70/helpdata/en/fc/eb35de358411d1829f0000e829fbfe/content.htm

Reward if helpful.

Jagadish

prasanth_kasturi
Active Contributor
0 Kudos

hi,

sorteed tables can have a duplicate record when it has a non unique key.

if it has unique key it cannot contain duplicates.

same is the case with hashed table it cannot have duplicates as it can have only unique key.

if you try to insert duplicate records in sorted or hashed tables with unique key the lead to dump

regards

prasanth

Former Member
0 Kudos

Hi Rittik,

In sorted or hashed tables the dupicates are easier to find. So depending on your requirment u can either eliminate them or work with it.

As a simple reference from Wiki check this :

http://en.wikipedia.org/wiki/Hash_function

Reward if helpful,

Regards,

Esha Raj

Former Member
0 Kudos

hi,

SORTED TABLE: in sorted we can specify both UNIQUE and

NON-UNIQUE keys . if u specify sorted table with unique key then it will not allow duplicate records.

if u specify sorted table with non-unique key then it will allow duplicate records.

HASHED TABLE: hashed table allows only unique keys. so it won't display duplicate records.

thanks

raji

reward if helpful.

Former Member
0 Kudos

Hi Rittik,

For hashed table, it will Return SY-SUBRC as 4.

For sorted table, if you define WITH UNIQUE KEY, SY-SUBRC will be 4 when trying to insert duplicate, but if you define WITH NON-UNIQUE key record will get inserted.

Regards,

Mohaiyuddin