INCLUDE STRUCTURE

Basic form 2

INCLUDE STRUCTURE s.

Extras:

1. ... AS name1

2. ... AS name1 RENAMING WITH SUFFIX name2

Effect

This statement can only be used within a structure definition with the additions BEGIN OF and END OF to the statements TYPES, DATA, CLASS-DATA, CONSTANTS, and STATICS. It transfers all components of the structure s at the specified point into the current structure definition. s must be a structure of the same program or a flat structure in the ABAP Dictionary. The latter is only possible outside classes.

Note

Note, especially when using statement chains (colon and comma), that INCLUDE is a seperate statement and not an addition to the statements DATA, TYPES and so on.

Note

You should no longer use the INCLUDE STRUCTURE statement simply to define structures whose type is created with reference to existing structures. Use the constructions below instead. You should only use INCLUDE STRUCTURE with the AS additions that allow you to perform offset/length addressing on structures.

A data definition:

DATA BEGIN OF rec.
       INCLUDE STRUCTURE s.
DATA END OF rec.

should be replaced with:

DATA rec LIKE s.


Even if the structure rec to be defined contains additional components, instead of:

DATA: BEGIN OF rec,
        ... .
        INCLUDE STRUCTURE s.
DATA:   ...
      END OF rec.

you should use

DATA: BEGIN OF rec,
        ...
        rec LIKE s,
        ...
      END OF rec.

so that s can be referenced as a sub-structure of rec.

Note

Although "INCLUDE STRUCTURE subRec." breaks up the sub-structure s into its components, the alignment of s is retained. This means that padding fields may be inserted before the first and/or before the last component of s in rec.

Addition 1

... AS name1

Effect

You can address the components included in INCLUDE STRUCTURE as a single entity, under the group name name1.

Group components are only visible if they are dddressed explicitly by name. The applies for example to the following situations and statements:

The following statements do not take group components into account:

Notes

  1. Group names for includes in the Data Dictionary are treated similarly to group names that are introducted in programs using the INCLUDE  TYPE ... AS and INCLUDE STRUCTURE ... AS statements.


  2. You should only use group names in conjunction with database tables, to access several components symbolically as a substructure. In all other cases, we advise you to use nested structures instead of includes and group names.


  1. This variant can be used as a replacement for access operations using offset or length specifications. See Includes with Group Names.


Addition 2

... AS name1 RENAMING WITH SUFFIX name2

Effect

You can address the components included in INCLUDE STRUCTURE as a single entity using the group name name1. The behavior is the same as in addition 1. When the components of the structure s are included, the component names are renamed by appending the name name2. This allows you to include structure s more than once.

Related

INCLUDE TYPE