How to Create a Structure in SAP ABAP (SE11) – Step-by-Step Guide
Table of Contents
- • What is a Structure in SAP ABAP?
- • Why Do We Use Structures in SAP ABAP?
- • Classifications of ABAP Structures
- ↳ 1. Flat Structures
- ↳ 2. Nested Structures
- ↳ 3. Deep Structures
- • Structures vs. Database Tables
- • Steps to Create a Structure in SAP ABAP (SE11)
- ↳ Step 1: Open Transaction SE11
- ↳ Step 2: Select Data Type Option
- ↳ Step 3: Select Structure
- ↳ Step 4: Short Description & Components
- ↳ Step 5: Using INCLUDE Structures (Reusability)
- ↳ Step 6: Save, Check & Activate
- • Using Structures in ABAP Code (Work Areas & Modern ABAP 7.40+)
- ↳ Traditional Work Area Usage:
- ↳ Modern ABAP 7.40+ Structural Expressions (VALUE & CORRESPONDING):
- • Structures in BAPIs & Function Modules
- • Self-Assessment Checkpoint
- • Frequently Asked Questions
- ↳ 1. How do I add custom fields to standard SAP structures without modifying standard code?
- ↳ 2. What happens to dependent programs when I alter a structure in SE11?
- • Best Practices Checklist
- • Summary
How to Create a Structure in SAP ABAP (SE11) – Step-by-Step Guide
When learning SAP ABAP, you will encounter terms like Domain, Data Element, Table, and Structure. Once you understand domains and data elements, the next critical concept to master is the Structure.
Structures in SAP ABAP are widely used because they help developers group related fields together without writing data to the physical database.
In this guide, we will explore what structures are, why they are used, how they differ from database tables, and how to create them in SAP using transaction code SE11.
What is a Structure in SAP ABAP?
A Structure is a collection of fields grouped under a single definition. It organizes related data fields but does not store any records physically in the database. Think of a structure as a reusable data template or blueprint.
For example, to represent employee information, you might need:
- Employee ID
- Employee Name
- Department
- Salary
Instead of defining these fields manually in every program, you can define a single structure in the ABAP Dictionary and reference it wherever needed.
+-------------------------------------------------------+
| Structure: ZSTR_EMPLOYEE |
| +---------------------+---------------------------+ |
| | Field Name | Data Element / Type | |
| +---------------------+---------------------------+ |
| | EMP_ID | ZDE_EMP_ID | |
| | EMP_NAME | ZDE_EMP_NAME | |
| | DEPARTMENT | ZDE_EMP_DEPT | |
| | SALARY | ZDE_EMP_SALARY | |
| +---------------------+---------------------------+ |
| (In-Memory Schema Template - 0 Database Records) |
+-------------------------------------------------------+
Why Do We Use Structures in SAP ABAP?
Structures improve development efficiency and maintain consistency across SAP applications. They help developers:
- Reuse field definitions across multiple programs.
- Group related fields together logically.
- Reduce coding effort and duplicate definitions.
- Improve readability of programs.
- Maintain consistency across different reports and forms.
Structures in SAP ABAP are heavily used in:
- ABAP Reports & ALV Grids
- Internal Tables & Work Areas
- Function Modules & BAPIs (Interface parameters)
- Smart Forms & Adobe Document Services (ADS)
- Custom Enhancements (BAdIs, Customer Exits)
Classifications of ABAP Structures
In the ABAP Dictionary and program memory, structures are classified into three types based on their component characteristics:
1. Flat Structures
A Flat Structure contains only elementary data types (e.g., CHAR, NUMC, DATS, INT4, CURR). All fields have fixed, predefined character lengths.
* Example of a Flat Structure in ABAP Code
TYPES: BEGIN OF ty_flat_emp,
emp_id TYPE numc8,
emp_name TYPE char40,
join_date TYPE dats,
END OF ty_flat_emp.
2. Nested Structures
A Nested Structure contains one or more fields that are themselves structures. This creates a multi-tier hierarchy without dynamic memory expansion.
* Example of a Nested Structure
TYPES: BEGIN OF ty_address,
street TYPE char50,
city TYPE char30,
zip TYPE numc6,
END OF ty_address.
TYPES: BEGIN OF ty_nested_employee,
emp_id TYPE numc8,
name TYPE char40,
address TYPE ty_address, " Nested Sub-Structure!
END OF ty_nested_employee.
3. Deep Structures
A Deep Structure contains fields that hold dynamic memory references — such as internal tables (TYPE TABLE OF), strings (TYPE STRING), or object references (TYPE REF TO). Deep structures require special memory handling during database operations.
* Example of a Deep Structure
TYPES: BEGIN OF ty_deep_employee,
emp_id TYPE numc8,
name TYPE string, " Dynamic string
skills TYPE TABLE OF string, " Internal table component!
END OF ty_deep_employee.
Structures vs. Database Tables
Many beginners confuse Structures in SAP ABAP with Tables. Although both contain fields, they serve completely different purposes:
| Feature / Property | Structure in SAP ABAP | Database Table |
|---|---|---|
| Data Persistence | In-memory only. 0 physical database storage. | Permanent database disk storage. |
| Primary Keys | No primary key concept. | Contains primary key fields (MANDT, etc.). |
| Database Buffering | Cannot be buffered on database server. | Supports database table buffering options. |
| Technical Settings | No technical settings (data class, size category). | Requires technical settings in SE11. |
| Usage | Used for local screen templates, BAPI structures, and work areas. | Used for permanent data storage. |
In short:
- A Structure defines how data should look in memory.
- A Table actually stores the data on disk.
Steps to Create a Structure in SAP ABAP (SE11)
Step 1: Open Transaction SE11
Log in to SAP, enter transaction code SE11 in the command field, and press Enter.
Step 2: Select Data Type Option
On the SE11 screen, click the radio button next to Data type, type your custom structure name (e.g., ZSTR_EMPLOYEE), and click Create.

⚠️ Naming Rules: Custom developer objects must always start with
ZorY(e.g.ZSTR_EMPLOYEE).
Step 3: Select Structure
In the popup dialog, select Structure and click Continue (Green Checkmark).
Step 4: Short Description & Components
Enter a Short Description (e.g., Employee Header Master Structure). In the field grid, enter components and their corresponding Data Elements:
| Component | Component Type | Short Description |
|---|---|---|
EMP_ID | ZDE_EMP_ID | Employee Identification Number |
EMP_NAME | ZDE_EMP_NAME | Employee Full Name |
DEPARTMENT | ZDE_EMP_DEPT | Department Code |
SALARY | ZDE_EMP_SALARY | Base Monthly Salary |
Step 5: Using INCLUDE Structures (Reusability)
You can include an existing structure into your new structure by typing .INCLUDE in the Component column:
- Component:
.INCLUDE - Component Type:
ZSTR_ADDRESS
This automatically merges all fields from ZSTR_ADDRESS into ZSTR_EMPLOYEE without re-typing them!
Step 6: Save, Check & Activate
- Click Save (
Ctrl + S) -> Assign to Local Object ($TMP) or Package (ZDEV). - Click Check (
Ctrl + F2) -> Verify zero syntax errors. - Click Activate (
Ctrl + F3) -> Ensure status becomes Active.
Using Structures in ABAP Code (Work Areas & Modern ABAP 7.40+)
Traditional Work Area Usage:
REPORT z_use_structure_demo.
* Declare a work area based on dictionary structure
DATA: ls_employee TYPE zstr_employee.
* Assign values to structure fields
ls_employee-emp_id = '10002948'.
ls_employee-emp_name = 'Daksh Dedha'.
ls_employee-department = 'ABAP DEV'.
ls_employee-salary = '95000.00'.
WRITE: / 'Employee ID:', ls_employee-emp_id,
/ 'Name:', ls_employee-emp_name,
/ 'Department:', ls_employee-department,
/ 'Salary:', ls_employee-salary.
Modern ABAP 7.40+ Structural Expressions (VALUE & CORRESPONDING):
REPORT z_modern_structure_demo.
* 1. Inline Instantiation with VALUE Operator
DATA(ls_emp) = VALUE zstr_employee(
emp_id = '10002948'
emp_name = 'Daksh Dedha'
department = 'SAP_DEV'
salary = '95000.00'
).
* 2. Component Mapping with CORRESPONDING Operator
TYPES: BEGIN OF ty_target,
emp_id TYPE char10,
emp_name TYPE string,
END OF ty_target.
DATA(ls_target) = CORRESPONDING ty_target( ls_emp ).
WRITE: / 'Mapped Target ID:', ls_target-emp_id,
/ 'Mapped Target Name:', ls_target-emp_name.
Structures in BAPIs & Function Modules
When calling standard SAP BAPIs (like BAPI_MATERIAL_SAVEDATA or BAPI_PO_CREATE1), interface parameters rely heavily on structures.
For example, BAPI return messages are returned using the standard structure BAPIRET2:
DATA: lt_return TYPE TABLE OF bapiret2,
ls_return TYPE bapiret2.
* Check structure fields after BAPI call
IF line_exists( lt_return[ type = 'E' ] ).
READ TABLE lt_return INTO ls_return WITH KEY type = 'E'.
WRITE: / 'BAPI Error:', ls_return-message.
ENDIF.
Self-Assessment Checkpoint
🙋♂️ Checkpoint 1: Can an ABAP structure contain an internal table as a component field?
Yes. A structure containing an internal table field is classified as a Deep Structure.
🙋♂️ Checkpoint 2: What is the difference between a Work Area and a Structure?
A Structure is a design-time schema defined in SE11 or TYPES. A Work Area is a runtime variable in memory typed after that structure to store a single record.
Frequently Asked Questions
1. How do I add custom fields to standard SAP structures without modifying standard code?
SAP provides Append Structures and CI_ Includes (Customer Includes) in SE11. By creating an Append Structure for a standard structure, your custom fields are safely added to the end without modifying standard SAP objects, preserving your changes during system upgrades.
2. What happens to dependent programs when I alter a structure in SE11?
When a dictionary structure is modified and activated in SE11, SAP’s active catalog triggers an automatic runtime check. Dependent programs and views are flagged for re-compilation on their next execution to incorporate the structural changes.
Best Practices Checklist
- Prefix custom structures with
ZSTR_orYSTR_to clearly identify object types in package navigators. - Reuse existing Data Elements for components to maintain global label and F1 help consistency.
- Use
.INCLUDEfor shared field blocks (like address or administrative audit fields) rather than re-creating components manually. - Always activate (
Ctrl + F3) after editing structures in SE11 before referencing them in ABAP code.
Summary
ABAP Structures are essential memory templates for grouping related business fields. Whether creating work areas, building internal tables, mapping BAPI parameters, or structuring ALV output, mastering structures in SE11 is fundamental to SAP development.
Written by Daksh Dedha
SAP Technical ConsultantDaksh is an SAP Technical Consultant specializing in ABAP programming, SAP S/4HANA migrations, Fiori development, and BTP cloud architecture. He authors free, hands-on tutorials to make enterprise SAP education accessible to all developers.
Test Your Knowledge
Loading question...
Quiz Completed
Related Tutorials
Search Helps in SAP ABAP — Elementary and Collective Search Help (SE11)
Complete guide to Search Helps in SAP ABAP. Learn how to create Elementary and Collective Search Helps in SE11, assign F4 help to input fields, and use search help exits.
Data DictionaryTable Maintenance Generator in SAP ABAP: Step-by-Step Guide
Learn how to create a Table Maintenance Generator (TMG) in SAP ABAP using transaction code SE11, maintain data with SM30, and avoid common mistakes.
Data DictionarySE11 Transaction Code in SAP ABAP: Complete ABAP Dictionary Guide
Master the fundamentals of the SE11 transaction code in SAP ABAP. Learn how to navigate the ABAP Dictionary, create tables, domains, views, search
Found this tutorial useful? Share it with your SAP development team.