A line type defines the structure of a single row in an internal table.
· It can be a:
- Data element (e.g., MATNR)
- Structure (e.g., SFLIGHT)
- Custom type created via TYPES
Example:
TYPES: BEGIN OF ty_line,
matnr TYPE matnr,
maktx TYPE maktx,
END OF ty_line.
Here,
ty_line is the line type — it represents the structure of a single row.
A table type defines the entire internal table, including:
- Line type
- Access method (standard, sorted, hashed)
- Unique/non-unique keys
Example:TYPES: ty_table TYPE STANDARD TABLE OF ty_line WITH DEFAULT KEY.
Here:
· ty_line is the line type (structure of each row)
· ty_table is the table type (definition of the whole table)
Difference Between Line Type and Table Type
| Feature | Line Type | Table Type |
| Definition | Describes a single row | Describes the entire internal table |
| Contains | Fields/data elements | Line type + table kind + key definition |
| Use | Used to define structure of rows | Used to define the full internal table |
| Declaration | TYPES: BEGIN OF … END OF | TYPES: … TYPE STANDARD TABLE OF … |