SAP INCLUDE INCLUDE ABAP Statements

Get Example source ABAP code based on a different SAP table
  


ABAP Code Snippet
ABAP Code Snippet

ABAP Code Snippet
[AS name [RENAMING WITH SUFFIX suffix]].
ABAP Code Snippet

ABAP Addition
1 ... AS name
2 ... RENAMING WITH SUFFIX suffix

What does it do? 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 ABAP Code Snippet generate a substructure, which means the components are inserted as if they are included individually in place of ABAP Code Snippet

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. ABAP Code Snippet longer be used for the following reasons:
If further structure components are to be added to existing components ABAP Code Snippet statements are used in a structure, this can result in syntax errors due to naming conflicts. This is particularly problematic if structures that are not defined in the same program are included and these are to be changed at a later date.
The embedded structures cannot be addressed as such without restrictions.
The necessary metadata is stored again for each component of an embedded structure, whereas the metadata for the components of a substructure is only stored once when the substructure is defined.
ABAP Code Snippet cannot be declared as static boxes when embedded. Where possible, real substructures ABAP Code Snippet should at least use the addition RENAMING WITH SUFFIX to prevent naming conflicts. This recommendation also applies to embedding structures in ABAP Dictionary, where the structures of database tables in particular cannot contain any real substructures.
Outside of ABAP objects, flat structures, database tables, or views in ABAP Dictionary can also be specified for struc with the addition STRUCTURE.
In constant structures defined with CONSTANTS ABAP Code Snippet cannot be assigned a start value.
With regard to their alignment, ABAP Code Snippet means alignment gaps can occur before the first or after the last component. These do not occur when the components are declared directly.
ABAP Code Snippet method GET_COMPONENTS of class CL_ABAP_STRUCTDESCR of RTTI in the same way as a substructure. The returned component table only contains one row for an embedded structure. The component type is represented by ABAP Code Snippet ABAP Code Snippet method can be used to resolve the components of embedded structures.
When a static box is copied from one structure to another, its boxed component attribute is also copied.

ABAP Addition

What does it do? 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 (- ).



Latest notes: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.

ABAP Addition

What does it do? 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.



Latest notes:Using the RENAMING WITH SUFFIX addition makes it
possible to embed an individual structure multiple times.



Example ABAP Coding
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.
ABAP Code Snippet
ABAP Code Snippet
ABAP Code Snippet
...
DATA END OF week.

Return to menu