SAP NetWeaver AS ABAP Release 740, ©Copyright 2014 SAP AG. All rights reserved.
ABAP Keyword Documentation → ABAP − Reference → Declarations → Declaration Statements → Data Types and Data Objects → Declaring Data Types → TYPES → TYPES - BEGIN OF →Syntax
INCLUDE { {TYPE struc_type} | {STRUCTURE struc} }
[AS name [RENAMING WITH SUFFIX suffix]].
Extras:
1. ... AS name
2. ... RENAMING WITH SUFFIX suffix
Effect
This statement can only be declared within a structure definition with the additions BEGIN OF and END OF of the statements TYPES, DATA, CLASS-DATA, and STATICS. It copies all the components of the structured type struc_type or the structure struc at the specified location to the current structure definition. The INCLUDE statement does not generate a substructure, which means the components are inserted as if they are included individually in place of the INCLUDE statement.
struc_type can be a local structured type, a visible structured type of a
global class or global interface, or a structure from the ABAP Dictionary. struc must be a structure of the same program or a visible attribute of a global class or global interface.
Notes
... AS name
Effect
By specifying the name name after the addition AS, you can either address all components of the embedded structure struc_type or struc together using the name name, or address individual components using the structure component selector (-).
Note
A name name specified with AS name is used only
as an addressing option and is ignored in statements such as
MOVE-CORRESPONDING or SELECT
INTO CORRESPONDING. A component renamed using RENAMING WITH SUFFIX actually has this name and is therefore not ignored.
... RENAMING WITH SUFFIX suffix
Effect
With the addition RENAMING WITH SUFFIX, each individual component is renamed
by adding the extension suffix, which prevents naming conflicts between components of the same name. suffix must be specified directly.
Note
Using the RENAMING WITH SUFFIX addition makes it possible to embed an individual structure multiple times.
Example
In this example, the structure week is defined by repeatedly using the components of the structured type t_day. The components of week are all at the same level and can be addressed as follows: week-work_mon, week-free_mon, week-work_tue, and so on. Alternatively, they can also be addressed as follows: week-monday-work, week-monday-free, week-tuesday-work, and so on.
TYPES: BEGIN OF t_day,
work TYPE c LENGTH 8,
free TYPE c LENGTH 16,
END OF t_day.
DATA BEGIN OF week.
INCLUDE TYPE t_day AS monday RENAMING WITH SUFFIX _mon.
INCLUDE TYPE t_day AS tuesday RENAMING WITH SUFFIX _tue.
INCLUDE TYPE t_day AS wednesday RENAMING WITH SUFFIX _wed.
...
DATA END OF week.