Declare a shared group of components once

Several project-owned records may share audit fields such as the user and date of a change. INCLUDE TYPE lets a structured type incorporate components from another structured type rather than repeat the same declarations.

Include the common fields

TYPES: BEGIN OF ty_audit,
         changed_by TYPE string,
         changed_on TYPE d,
       END OF ty_audit.

TYPES: BEGIN OF ty_dispatch,
         dispatch_id TYPE string,
         INCLUDE TYPE ty_audit,
       END OF ty_dispatch.

The included components become components of the enclosing type, so the record can be populated with changed_by = ... and accessed as dispatch-changed_by. This does not create an object inheritance relationship; it is a type composition feature.

Use includes for a stable, coherent group. If the included field names collide with local components or other includes, resolve that deliberately with supported renaming options or choose a clearer type design. Avoid a giant shared include that couples unrelated records.

Sources

Developer practice · ABAP

Practice: include standard audit fields

Define a small audit type and include its components in a dispatch type; create a record and read changed_by.

Choose your ABAP environment

This choice changes the output pattern checked here: WRITE belongs in a classic executable report, while out->write( ) uses the supplied output reference in an ABAP Cloud class-run method. It does not switch the language version of the other code; check release and API availability in your target system.

Complete the task and include the output statement shown for your selected environment. Variable names can differ if you use them consistently. This browser checker checks structure only; it does not compile or run ABAP.

0 required structures detected · 0 checks