WhatsApp
SAP Technical

Types of Structures in SAP ABAP: Complete Guide with Examples

Best Online Career

SAP Consultant

May 19, 2026
Types of Structures in SAP ABAP: Complete Guide with Examples

Types of Structures in SAP ABAP: A Complete Guide for Beginners and Professionals

Stepping into the realms of SAP development requires you to know about a fundamental aspect of SAP ABAP, the structure. In ABAP programs, structures are everywhere and define how data is organized. These foundational elements can be found in a database table definition, a function module interface, and an ALV report.

This detailed guide explains what is structure in SAP ABAP, how to create structures in SAP ABAP, and deals with the append structure, include structure, deep structure, dynamic structure, and what is the difference between tables and structures. This guide will prepare you for an SAP ABAP certification and offer you assistance when you are working on a live project.

What is a Structure in SAP ABAP?

A structure in SAP ABAP is a data object that groups multiple fields of different data types under a single name. A structure is similar to a record, or a row in a database table. Unlike an internal table (which holds multiple rows), a structure holds only one row of data at a time.

Structures are defined with TYPES or DATA statements and serve the following purposes:

  • Transferring data among programs and functions.
  • Specifying the row type for an internal table.
  • Manipulating rows of database tables.
  • Constructing field catalogs and layout configurations for ALV (ABAP List Viewer).

Basic Structure Syntax

TYPES: BEGIN OF ty_employee,
         emp_id   TYPE numc10,
         emp_name TYPE char50,
         salary   TYPE p DECIMALS 2,
       END OF ty_employee.

DATA: ls_employee TYPE ty_employee.


In this case, ty_employee is a structure that the user has defined, and ls_employee is a work area (variable) that is of that structure type.

Structure Definition in SAP ABAP

In SAP ABAP, structures can be defined in two ways.

1 With a Programmatic Declaration (Local Structures)

Defined in the ABAP code directly using either TYPES or DATA as shown above. These structures are local to the program and can only be accessed in the program.

2 ABAP Dictionary (SE11) – Global Structures

You can define global structures in ABAP Dictionary via Transaction SE11:

  • Go to SE11 → Click on Data Type → Provide a name (For instance: ZEMPLOYEE_STRUC)
  • From the given options, pick Structure
  • Provide fields with their respective data elements or types.
  • Click Activate and then Save.

Global structures are readily available in multiple programs, function modules, and enhancements thereby suiting enterprise-level SAP development.

Types of Structures in SAP ABAP

SAP ABAP supports a variety of structure types, each of which is relevant for specific situations. We will deal with each in turn.

1 Flat Structure

Structures which only contain elementary fields (no structures or table types nested) are known as flat structures. This is the simplest and the most frequently used type of structure.

TYPES: BEGIN OF ty_address,
         street  TYPE char50,
         city    TYPE char30,
         country TYPE land1,
       END OF ty_address.

All elements of a flat structure reside next to each other in memory. This makes flat structures very effective for performance-critical applications.

2 Deep Structures in SAP ABAP

A deep structure in SAP ABAP has at least one component which is a complex type — another structure, an internal table, a string, or a reference type.

TYPES: BEGIN OF ty_order,
         order_id   TYPE numc10,
         order_date TYPE dats,
         items      TYPE TABLE OF ty_order_item WITH DEFAULT KEY,
       END OF ty_order.

In this example, items is an internal table defined with respect to ty_order, thus making it a deep structure.

  • Cannot be moved directly using MOVE-CORRESPONDING in all cases — use component-wise movement instead.
  • Need special treatment when passed to remote function modules (A deep structure cannot be transported directly through RFC).
  • Useful for hierarchical modeling of data like an order header and its order items.

3 Include Structures in SAP ABAP

An include structure allows you to embed the fields of one structure into another structure without redefining them. This promotes code reuse and consistency across data models.

TYPES: BEGIN OF ty_person,
         first_name TYPE char30,
         last_name  TYPE char30,
       END OF ty_person.

TYPES: BEGIN OF ty_full_record,
INCLUDE TYPE ty_person,
emp_id TYPE numc10,
department TYPE char20,
END OF ty_full_record.


Now the fields in ty_person become part of ty_full_record. In SE11, use the Include component type to achieve the same result for global structures.

4 Append Structure in SAP ABAP

In SAP ABAP, an Append Structure is a unique method used to add custom fields to an existing standard SAP table or structure. Using an Append Structure does not alter the original object, and is therefore a part of SAP's no-modification enhancement concept.

Creating an Append Structure in SAP ABAP:

  • Access SE11 and enter the standard SAP table name (for example, VBAK).
  • Select the Append Structures tab, then select Create.
  • Enter your Append Structure name (for example, ZZ_VBAK_APPEND).
  • Provide the custom fields (the field names should begin with ZZ or YY to avoid name space collisions).
  • Select the Append Structure Activate.

The custom fields are added to the database table and will appear in all referenced programs.

Important Facts About Append Structures:

  • A maximum of one append structure can be created for each SAP table, per SAP client (but can have multiple additional fields).
  • They remain intact after SAP upgrades.
  • They do not support nesting.

5 Dynamic Structure in SAP ABAP

In SAP ABAP, a dynamic structure is created at runtime utilizing the Run Time Type Services (RTTS), and specifically the CL_ABAP_STRUCTDESCR and CL_ABAP_TABLEDESCR classes. This is helpful when the structure field names are unknown at design time.

Example: Dynamic Structure in SAP ABAP

DATA: lo_structdescr TYPE REF TO cl_abap_structdescr,
      lt_components  TYPE cl_abap_structdescr=>component_table,
      ls_component   TYPE cl_abap_structdescr=>component,
      lo_struct      TYPE REF TO data.

FIELD-SYMBOLS: <fs_struct> TYPE ANY.

" Dynamically define components
ls_component-name = 'MATNR'.
ls_component-type = cl_abap_elemdescr=>get_c( 18 ).
APPEND ls_component TO lt_components.

ls_component-name = 'MAKTX'.
ls_component-type = cl_abap_elemdescr=>get_c( 40 ).
APPEND ls_component TO lt_components.

lo_structdescr = cl_abap_structdescr=>create( lt_components ).

CREATE DATA lo_struct TYPE HANDLE lo_structdescr.
ASSIGN lo_struct->* TO <fs_struct>.

Dynamic Structures Use Cases:

  • Generic ALV reports with differential columns per user
  • Dynamic data transformation
  • Metadata programming techniques

6 Generate Field Catalog from Structure in SAP ABAP

While using ALV Grid (via CL_GUI_ALV_GRID or REUSE_ALV_GRID_DISPLAY), building a field catalog to describe the display columns is necessary. With the function module LVC_FIELDCATALOG_MERGE, creating one automatically through a structure in SAP ABAP is possible.

DATA: lt_fieldcat TYPE lvc_t_fcat.

CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
EXPORTING
i_structure_name = 'ZY_REPORT_STRUC'
CHANGING
ct_fieldcat = lt_fieldcat
EXCEPTIONS
inconsistent_interface = 1
program_error = 2
OTHERS = 3.


The field catalog development time is cut significantly because of this method, which simplifies the documentation of data descriptions and text in the ABAP Dictionary to conform with the DRY (Don't Repeat Yourself) principle.

Append Structures and Include Structures in SAP ABAP: A Comparison

In both Include and Append structures of SAP ABAP, structures can be extended, however, their purposes and internal workings differ.

Feature Include Structure Append Structure
Purpose Use fields of one structure as parts of another Utilize additional fields in SAP table/structure
Where Used Properties of custom and standard structures (SE11) Integrated in and generated by SAP standard/custom tables in SE11
Modification-Free No (you change the target structure) Yes (append is a separate object)
Upgrade Safe Depends on the situation Yes, survives the upgrade of SAP
Direction Both ways (included in the custom structures) Unidirectional (appended at the end)

Difference Between Include and Append Structure in SAP ABAP

The nuance between include and append structure in SAP ABAP is slight but significant:

Design time methods are used in the construction of include structures where fields are included within the definition of the structure. Through a logical design, both the including and the included structures exist as separate Dictionary objects.

Design time methods are also used in the construction of append structures where the physical construction of the structure is achieved through the design of additional columns to an existing table. The fields are included within the database as a design element.

As a rule, create reusable data models from the ground-up with include structures and use append structures to add to the SAP Standard Blocks without altering the standard blocks.

Difference Between Table and Structure in SAP ABAP

There is often confusion when differentiating between table and structure in SAP ABAP. Here is a breakdown.

Aspect Internal Table Structure
Rows Multiple rows (similar to a spreadsheet) Single row (similar to one record)
Memory Collection of records One record
Usage Stores and processes data sets Work area / buffer of one record
Declaration TYPE TABLE OF ty_type TYPE ty_type
Database Not directly related to DB Can relate to a DB table row
Looping LOOP AT ... INTO ... Access fields directly

In ABAP programs, the structure is a work area (variable ls_) and the internal table (variable lt_) is a collection. To read a row, you have to loop through the internal table and read it into the structure.

LOOP AT lt_orders INTO ls_order.
  WRITE: / ls_order-order_id, ls_order-order_date.
ENDLOOP.

How to Delete Append Structure in SAP ABAP

Product Cleanup or restructuring a data model may also require the removal of an append structure. This is the process of deleting an append structure in SAP ABAP:

How to Delete an Append Structure:

  1. SE11 is opened with the name of the base table (example: VBAK) entered.
  2. Append Structures tab is selected.
  3. The Append Structure is selected, and then Delete entry is selected.
  4. The base table is activated to save the changes.
  5. The Append Structure is opened directly in SE11 by entering the name of the Append Structure and selecting change.
  6. Utilities and then delete are selected.
  7. Confirming the deletion and activating the base table.
⚠️ Warning: Ensure that no programs, function modules, or reports are utilizing the custom fields before deleting an append structure. Active append structures with data stored in fields on a database table may cause data loss. Always do this in a development environment first and use the transport system with care.

Practices to Follow While Working with SAP ABAP Structures

  • Use consistent and meaningful naming standards to help identify different objects, for example, custom structures should be prefixed with ZY_ or ZT_.
  • Use global structures instead of local structures to promote reusability in programs and function modules.
  • Avoid the use of deep structures in RFC enabled function modules.
  • Use include structures to share common fields (for example, audit fields) across multiple structures.
  • When extending SAP standard tables, use append structures and do not make direct changes.
  • Use the LVC_FIELDCATALOG_MERGE function to generate the field catalogs from the SE11 to make structure maintenance more efficient.
  • Test dynamic structures to their limits as runtime type errors become difficult to debug and implement TRY…CATCH with CX_SY_* exceptions.

Final Thoughts

Every ABAP Developer, whether they are creating reports, creating enhancements, and/or performing systems integrations, must understand SAP ABAP structures when they are using flat structures or deep structures, or dynamic structures, or performing system integrations with append structures.

Knowing when to use structures and tables in SAP ABAP, as well as when to use include and append structures, allows you to keep your ABAP code clean, maintainable and extendable.

Continue to test these concepts in your own SAP sandbox, and use this guide to structure creation in SAP ABAP whenever you need to refresh your memory.

Frequently Asked Questions (FAQs)

Q1: What are the limits for the number of fields in an SAP ABAP structure?
There is no hard-coded limit for the number of table fields that can be added to an SAP ABAP structure, but the number of fields will generally not exceed the number of columns in the underlying database table (usually capped at 999 fields in an ABAP transparent table).
Q2: Can I append a structure to a custom table?
Yes, as long as you are in SE11, you can append a structure to any of the SAP standard or custom (Z/Y) tables.
Q3: Are the terms nested structure and deep structure interchangeable?
Yes, deeper structures are a type of nested structures that encompass non-elementary components (like internal tables or structures).
Q4: Are deep structures permissible in ALV reports?
Yes, ALV reports are commonly extended to include the use of class CL_GUI_ALV_GRID that allows dynamic reporting.
Q5: What is the consequence of deleting the appended structure?
If the appended structure is deleted, the contents of the appended columns would be lost. The structure should be thoroughly tested in a quality environment to ensure that the data is backed up as expected.

Tags

#structure in sap abap#what is structure in sap abap#append structure in sap abap#create dynamic structure in sap abap#create field catalog from structure in sap abap#deep structure in sap abap#difference between include and append structure in sap abap#difference between table and structure in sap abap#how to delete append structure in sap abap#include and append structure in sap abap#structure creation in sap abap

Share this article

Help others discover this valuable SAP content

About Best Online Career

Experienced SAP consultant with expertise in various SAP modules. Dedicated to helping professionals advance their SAP careers through quality training and guidance.

Related Articles