04-18-2008 11:53 AM
what happens when duplicate entries are present in sorted and hashed tables?
04-18-2008 11:57 AM
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
04-18-2008 11:58 AM
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
04-18-2008 11:58 AM
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
04-18-2008 12:03 PM
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.
04-18-2008 12:24 PM
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