IT CanvassTalk to an advisor
SAP ABAP development · LessonReviewed by Ravi M, SAP Trainer, 10 yrs · Updated · Published · SAP S/4HANA 2023 · all levels

SAP Structures

A structure in ABAP is a composite data type grouping several fields, like a single row of a table. Structures and internal tables together are how ABAP models and moves business data.

Quick answer

An ABAP structure bundles related fields of different types under one name, an order with id, customer, date and amount, and holds one record where an internal table of that structure holds many. Type it from a dictionary structure or table line so it matches the database. Structures can nest structures and internal tables, so a header carries its items.

Key takeaways
  • Structures and internal tables together are how ABAP models and moves business data.
  • Watch out: Field mismatches from hand-defining instead of dictionary typing.

What a structure is

A structure bundles related fields (of possibly different types) under one name, for example an order structure with order id, customer, date and amount. A single structure holds one record; an internal table of that structure holds many. Structures can mirror dictionary types (e.g. a table’s row type) or be defined locally.

Declaring and using structures

TYPES: BEGIN OF ty_order,
         id       TYPE vbeln,
         customer TYPE kunnr,
         amount   TYPE p LENGTH 9 DECIMALS 2,
       END OF ty_order.
DATA ls_order TYPE ty_order.
ls_order-id = '0000001234'.
ls_order-amount = '150.00'.

Structures and the dictionary

Often you type a structure directly from a dictionary structure or a table’s line type (DATA ls_mara TYPE mara), so it always matches the database definition. This keeps custom code aligned with SAP’s data model and avoids field mismatches.

Nested and deep structures

Structures can contain other structures and even internal tables (deep structures), useful for representing complex documents (a header structure containing an items table). Understanding work areas (a structure used to process one row of a table) is key to looping and reading tables.

Common pitfalls

  • Field mismatches from hand-defining instead of dictionary typing.
  • Confusing a structure (one row) with a table (many).
  • Deep structures misunderstood when moving/among components.
Already working on SAP and stuck on a live ticket?Get an expert SAP developer on screen-share to finish your daily tasks with you. Deliver on time, protect your reputation and your job. Monthly support only, no task-wise plans.Task assigned · no idea where to startStill stuck · your job on the lineExpert joins your screenDelivered on timeExplore On Job Support