INCLUDE STRUCTURE

INCLUDE STRUCTURE

Effect

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

Since, as of Release 3.0, you can define nested data structures (i.e. structures with sub-structures), INCLUDE STRUCTURE should no longer be used.

A data definition

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

is equivalent to

DATA rec LIKE s.

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 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.

Related

INCLUDE TYPE