7/25/2018 - 7:56 PM

Declare a local data type or structure type (TYPES)

Use TYPES to declare a local data type (i.e. instead of using the standard ABAP data types). Used to give standard type more meaning (descriptive name) or specify a specific variable structure. TYPES cannot have a user-specified default value. TYPES are local to the program. Must use the ABAP dictionary (SE11) to declare global variables.

A structure type is a group of individual types. You can encapsulate multiple data elements in a single structured TYPE. No data can be stored in this structure yet, it is only a type. You can use the type in your data declaration.

Global structures can be used in database tables and internal tables. Local structures can only be used in internal tables of the program.

TYPES typename TYPE [type specification]

TYPES: BEGIN OF employee TYPE str_employee,
    surname TYPE c LENGTH 30,
    forename TYPE c LENGTH 30,
END OF str_employee.

DATA employee TYPE str_employee.

employee-surname = 'SMITH'.
employee-forename = 'FORENAME'.