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: 

key

Former Member
0 Kudos

what is meant by the key of an internal table,and what are called internal data types

1 REPLY 1

Former Member
0 Kudos

Hi,

Below will give you a good idea about the key of an internal table:

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.

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.

DATA TYPES:

There are two types of Data types.

1.Predefined

2.Custom Defined.

Predefined data types was already defined in SAP itself.

Custom Defined data types can be defined in program and also DDIC.

We can use predefined type if the Data type matches otherwise we go for custom defined type.

Refer to this for more details:

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

Name of Dictionary type

User-defined types in the ABAP Dictionary

You can define any user-defined types in the ABAP Dictionary. These can

be used in the ABAP program to define data objects and types analogously

to types that are predefined in the ABAP program (such as C or I) or

types that are defined locally in ABAP programs.

The following type categories can be defined in the ABAP Dictionary:

o Data elements (elementary types)

Elementary types have no structure. They describe the data type

attributes (such as given Dictionary data type, number of places)

and information that is relevant for the screen (such as title) of

unstructured data objects (variables/fields).

o Structures (structured types)

Structured types describe the structure and functions of any

structured data objects, that is of data structures with components

of any type.

A component can be a field with an elementary type or can itself be

a structure. A table can also be used as a component in a structure.

A database table always has a structure and is therefore implicitly

a structured type. However, the fields of a database table can only

have an elementary type.

o Table types

Table types describe the structure and functions of internal tables

in the ABAP program. Their rows can have any row type. Table types

with elementary row type therefore can be defined just the same as

multi-dimensional table types (table types with a table type as row

type) or table types using structures with table-like components.

The options for creating types with structured types and table types can

be combined as required. In this way you can define any complex types

globally in the ABAP Dictionary and use them in ABAP programs. The

runtime object of the Dictionary type (nametab) is the interface for

their use in ABAP programs. The runtime object permits very efficient

access to the relevant information for the type in compressed form.

The central definition of types that are used more than once in the ABAP

Dictionary allows them to be changed centrally. These changes are made

at all the relevant locations by the active ABAP Dictionary. For

example, ABAP programs adjust to the changed type definitions when they

are recreated. When a type is changed, all the objects (e.g. types or

tables) that use this type are automatically adjusted to the change at

activation.

All Dictionary types lie in a common namespace. A data element, for

example, therefore may not have the same name as a structure. However, a

type defined in an ABAP program and a Dictionary type may have the same

name.

The following shadowing rule is valid when using types in ABAP programs:

If the names are identical, the local types shadow the types of the type

groups and the types defined globally in the Dictionary.

Thanks,

Samantak.

Rewards points for useful answers.