I found 2 examples for creating a structure.
This one with TYPES:
TYPES : BEGIN OF employee_information,
name TYPE c LENGTH 20,
surname TYPE c LENGTH 20,
tel_no TYPE n LENGTH 12,
END OF employee_information.
and this other one with DATA:
DATA : BEGIN OF employee_information,
name TYPE c LENGTH 20,
surname TYPE c LENGTH 20,
tel_no TYPE n LENGTH 12,
END OF employee_information.
I read the documentation topic “The Statements TYPES and DATA” in the SAP Library, but I don’t understand why we use these distinct terms TYPES and DATA for creating a structured data type.
Can you explain the difference?
First of all, creating a TYPE is the newer and recommended method to use.
When you create a DATA, lets say for an internal table;
You can have the internal table with header line. But this is the old method.
When you use TYPE in order to declare an internal table you can use its headerline and its content simultaneously;
For example: You can use this TYPE in order to create as many internal tables as you want such as: