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

Default key in internal tables

Former Member
8,254

what is 'Default key'? for what type of internal tables it is used? Can you please explain with examples?

Thanks a lot.

1 ACCEPTED SOLUTION
Read only

RichHeilman
Developer Advocate
Developer Advocate
3,453

<i>Key

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 UNIQUE or NON-UNIQUE. Internal tables with a unique key cannot contain duplicate entries. The uniqueness depends on the table access method.

<b>At tables with structured row type, the standard key is formed from all character-type columns of the internal table.</b> 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.</i>

Regards,

Rich Heilman

4 REPLIES 4
Read only

RichHeilman
Developer Advocate
Developer Advocate
Read only

Former Member
0 Likes
3,453

Default key will be the full line of internal table.

Read only

Former Member
0 Likes
3,453

Hi Nuren,

<b>Default key:</b> A DEFAULT specification is formed by specifying the keyword DEFAULT and a DEFAULT value The maximum length of a default value is 254 characters.

Check the following links.

http://help.sap.com/saphelp_47x200/helpdata/en/ac/be98cea56511d2a97100a0c9449261/frameset.htm

http://help.sap.com/saphelp_47x200/helpdata/en/ac/be98cea56511d2a97100a0c9449261/frameset.htm

Thanks,

Vinay

Read only

RichHeilman
Developer Advocate
Developer Advocate
3,454

<i>Key

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 UNIQUE or NON-UNIQUE. Internal tables with a unique key cannot contain duplicate entries. The uniqueness depends on the table access method.

<b>At tables with structured row type, the standard key is formed from all character-type columns of the internal table.</b> 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.</i>

Regards,

Rich Heilman