IT CanvassTalk to an advisor
SAP ABAP development · LessonBy , SAP Trainer, 10 yrs · Published · SAP S/4HANA 2023 · all levels

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

Structures can contain other structures and even internal tables (deep structures), useful for representing complex documents (a header structure containing an items table).

Key takeaways
  • A structure bundles related fields (of possibly different types) under one name, for example an order structure with order id…
  • Often you type a structure directly from a dictionary structure or a table’s line type (DATA ls_mara TYPE mara), so it always…
  • 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.

Practice challenge

+0 XPStreak ×0
Question 1 of 3
Which statement is true of Structures?

Frequently asked questions

What does the term Structures refer to in SAP?
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.
What is the practical takeaway on Structures?
Structures can contain other structures and even internal tables (deep structures), useful for representing complex documents (a header structure containing an items table).
What is worth remembering about Structures in practice?
A structure bundles related fields (of possibly different types) under one name, for example an order structure with order id, customer, date and amount.
What tends to go wrong with Structures?
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