cancel
Showing results for 
Search instead for 
Did you mean: 

Re: Table declaration

Former Member
0 Kudos

hi,

i saw some table declaration like

GT_AGENTS TYPE STANDARD TABLE OF TT_AGENTS WITH DEFAULT KEY ,

Here what is meaning of Default key.

Please give me explanation

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi Santosh,

Please check this link

http://help.sap.com/saphelp_nw04/helpdata/en/fc/eb366d358411d1829f0000e829fbfe/content.htm

Key

You can specify the key <key> of an internal table as follows:

[UNIQUE|NON-UNIQUE] KEY <col1> ... <col n>

In tables with a structured line type, all of the components <coli> belong to the key as long as they are not internal tables or references, and do not contain internal tables or references. Key fields can be nested structures. The substructures are expanded component by component when you access the table using the key. The system follows the sequence of the key fields.

[UNIQUE|NON-UNIQUE] KEY TABLE LINE

If a table has an elementary line type (C, D, F, I, N, P, T, X), you can define the entire line as the key. If you try this for a table whose line type is itself a table, a syntax error occurs. If a table has a structured line type, it is possible to specify the entire line as the key. However, you should remember that this is often not suitable.

[UNIQUE|NON-UNIQUE] DEFAULT KEY

This declares the fields of the default key as the key fields. If the table has a structured line type, the default key contains all non-numeric columns of the internal table that are not and do not contain references or internal tables. If the 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.

Specifying a key is optional. If you do not specify a key, the system defines a table type with an arbitrary key. You can only use this to define the types of field symbols and the interface parameters of procedures . For exceptions, refer to Special Features of Standard Tables.

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.

Besty regards,

raam

former_member195383
Active Contributor
0 Kudos

The standard key is specified as DEFAULT KEY. The standard key fields of a structured row type are all fields that are neither numeric (i, p, f) nor table types. The standard key for non-structured row types is the entire table row if the row type itself is not a table type. If there is no relevant component that applies and the row type itself is a table type, the standard key remains empty. This is only possible for standard tables.

Reward points if the above ans is useful...