SAP ABAP, structures are data types that group together components (fields) under one name, where each component can have a different data type. They are used to represent a record or a logical grouping of data fields — similar to a "struct" in languages like C or a "record" in Pascal.
🔹 Key Characteristics of Structures in ABAP:
- Non-repetitive: Unlike internal tables, structures hold only one row of data at a time.
- Composite data type: They consist of multiple fields, each with its own data type.
- Used in: Data declarations, interfaces between programs and function modules, data transport between screens and programs, etc.
🔸 Types of Structures:
- . Flat Structures C
- . Nested Structures
🔸 Declaring and Using Structures:
- Declaration using
TYPES
andDATA
: abapCopyEditTYPES: BEGIN OF ty_person, name TYPE string, age TYPE i, END OF ty_person. DATA: ls_person TYPE ty_person.
- Assigning Values: abapCopyEdit
ls_person-name = 'Alice'. ls_person-age = 30.
- Structures from Data Dictionary: You can also use predefined structures from the Data Dictionary (SE11). abapCopyEdit
DATA: ls_vbak TYPE vbak. "vbak is a DDIC structure for Sales Document
🔸 Use Cases:
- Passing data to function modules
- Populating screen fields (dynpros)
- Working with SELECT statements (e.g., SELECT INTO a structure)
- Structuring internal tables (
TABLES OF
a structure)
Call us on +91-84484 54549
Mail us on contact@anubhavtrainings.com
Website: Anubhav Online Trainings | UI5, Fiori, S/4HANA Trainings
Comments
Post a Comment