sapdev logo background
sapdev logo sapdev logo
Comments

SAP ITAB DEFAULT KEY documentation, setup help and example usage



Return to SAP documentation index


ARTICLE

Standard Keys in Internal Tables

The standard key in internal tables basically consists of all the table fields with the character-type type (
C , STRING , D , T , N , X , XSTRING ). In particular, components with a numeric type and table components in general do not belong to the standard key.

In internal tables with a nested line structure, the standard key results from linearization of the line structure, that is, all substructures are resolved recursively until only unstructured table fields are left to be considered. Of these fields, only those fields that are neither numeric fields nor tables are included in the key.

The linearization is explained in the following example:

TYPES: BEGIN OF PERSONNEL_DATES,
NAME TYPE STRING,
BIRTHDAY TYPE D,
WEIGHT TYPE F,
END OF PERSONNEL_DATES,

BEGIN OF ADDRESS,
STREET TYPE STRING,
CITY(30) TYPE C,
END OF ADDRESS,

BEGIN OF PERSON_RECORD,
NUMBER(10) TYPE P,
DATES TYPE PERSONNEL_DATES,
ADR TYPE ADDRESS,
END OF PERSON_RECORD.

DATA: ITAB TYPE PERSON_RECORD OCCURS 100.

The standard key for the internal table ITAB is composed of the fields ITAB-DATES-NAME , ITAB-DATES-BIRTHDAY , ITAB-ADR-STREET , and ITAB-ADR-CITY . The fields ITAB-NUMBER and ITAB-DATES-WEIGHT do not belong to the standard key.

For tables of non-structured types (that is,tables with an elementary line type, for example C , I , P , REF TO etc.), the whole line is used as a standard key.

In contrast, for tables over tables, the standard key is empty.
Documentation extract taken from SAP system, � Copyright SAP AG. All rights reserved




ITAB_DECLARE_OBSOLETE
ITAB_EMPTY_KEY




comments powered by Disqus