‎2007 Nov 02 8:21 AM
WHAT IS THE DIFF. BETWEEN UNIQUE KEY AND NON-UNIQUE KEY IN INTERNAL TABLES?
‎2007 Nov 18 8:00 AM
Hi Sudhakar,
<b>Key</b>
The key identifies table rows. There are two kinds of key for internal tables - the standard key and a user-defined key. You can specify whether the key should be <b>UNIQUE</b> or <b>NON-UNIQUE</b>. Internal tables with a unique key cannot contain duplicate entries. The uniqueness depends on the table access method.
At tables with structured row type, the standard key is formed from all character-type columns of the internal table. If a table has an elementary line type, the default key is the entire line. The default key of an internal table whose line type is an internal table, the default key is empty. At tables with non-structured row type, the standard key consists of the entire row. If the row type is also a table, an empty key is defined.
The user-defined key can contain any columns of the internal table that are no internal table themselves, and do not contain internal tables. References are allowed as table keys. Internal tables with a user-defined key are called key tables. When you define the key, the sequence of the key fields is significant. You should remember this, for example, if you intend to sort the table according to the key.
Unique key: it means that field having only the unique value only. eg. if u have a name field with unique key than u cant insert two rows having same name.
Non Unique Key: means you can insert a duplicate data in that field.
See below link as well..
hope ur problem is solved..
<b>Reward points if useful..</b>
Thanks & Regards.
ilesh 24x7
‎2007 Nov 02 8:22 AM
A unique key would be helpful in determining a single record from the internal table while performing a search using that key.
Whereas, a non-unique key would not be able to distinctly find out a specific single record for the search that is made using that key. In a table which uses a non-unique key Read statement would pick the first record which shall validate the search criteria.
The optional additions UNIQUE or NON-UNIQUE determine whether the key is to be unique or non-unique, that is, whether the table can accept duplicate entries. If you do not specify UNIQUE or NON-UNIQUE for the key, the table type is generic in this respect. As such, it can only be used for specifying types. When you specify the table type simultaneously, you must note the following restrictions:
You cannot use the UNIQUE addition for standard tables. The system always generates the NON-UNIQUE addition automatically.
You must always specify the UNIQUE option when you create a hashed table.
http://help.sap.com/saphelp_nw2004s/helpdata/en/fc/eb35de358411d1829f0000e829fbfe/frameset.htm
‎2007 Nov 08 4:52 PM
unique key is a way of searching records from the data base with specified key.
Non-unique is the way of searching without any specialisation.
‎2007 Nov 18 8:00 AM
Hi Sudhakar,
<b>Key</b>
The key identifies table rows. There are two kinds of key for internal tables - the standard key and a user-defined key. You can specify whether the key should be <b>UNIQUE</b> or <b>NON-UNIQUE</b>. Internal tables with a unique key cannot contain duplicate entries. The uniqueness depends on the table access method.
At tables with structured row type, the standard key is formed from all character-type columns of the internal table. If a table has an elementary line type, the default key is the entire line. The default key of an internal table whose line type is an internal table, the default key is empty. At tables with non-structured row type, the standard key consists of the entire row. If the row type is also a table, an empty key is defined.
The user-defined key can contain any columns of the internal table that are no internal table themselves, and do not contain internal tables. References are allowed as table keys. Internal tables with a user-defined key are called key tables. When you define the key, the sequence of the key fields is significant. You should remember this, for example, if you intend to sort the table according to the key.
Unique key: it means that field having only the unique value only. eg. if u have a name field with unique key than u cant insert two rows having same name.
Non Unique Key: means you can insert a duplicate data in that field.
See below link as well..
hope ur problem is solved..
<b>Reward points if useful..</b>
Thanks & Regards.
ilesh 24x7
‎2008 Jan 20 10:12 PM
a unique doesnt allow duplicates into table, whereas the other one does
‎2008 Jan 20 10:12 PM
a unique doesnt allow duplicates into table, whereas the other one does