INCLUDE STRUCTURE


Basic form

INCLUDE STRUCTURE rec.

Effect

When you define a structure rec (with DATA or TYPES ), this statement copies the components of the structured data type subRec to the structure rec .

Since you can define nested data structures (i.e. structures with sub-structures) starting from Release 3.0, you should use INCLUDE STRUCTURE only if you want to introduce types in a program first and nested structures in a later step.

A data definition
DATA: BEGIN OF rec. INCLUDE STRUCTURE subRec. DATA: END OF rec.

is equivalent to
DATA rec LIKE subRec.

You are recommended to use the second formulation.

Even if the structure rec to be defined contains additional components, instead of
DATA: BEGIN OF rec, ... INCLUDE STRUCTURE subRec. DATA: ... END OF rec.

you should use
DATA: BEGIN OF rec, ... rec LIKE subRec, ... END OF rec.

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

Note

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

Index
© SAP AG 1996