ABAP Keyword Documentation → ABAP − Reference → ABAP RESTful Programming Model → Derived Types
Specific Derived Types
Other versions:
7.31 | 7.40 | 7.54
Syntax
TYPES type_for_update TYPE TABLE FOR UPDATE CDS_entity_name.
TYPES type_for_id
TYPE LINE OF type_for_update-%key.
TYPES type_for_data TYPE LINE OF type_for_update-%data.
TYPES type_for_row TYPE STRUCTURE FOR type_for_update.
Effect
Alongside derived parameter types (the types of the input parameter and output parameter), certain derived data types can also be defined for the ID fields and data fields.
Using TYPE STRUCTURE FOR it is possible to directly get the row type of a derived table type. This way, the two-stage solution using LINE OF can be avoided.
Example
In the following example, the data from the ABAP flight data reference scenario (or flight data scenario for short) is used. It represents a legacy business logic that can be used to create and edit flight bookings. The root entity Travel represents the business object for managing flight trips. The underlying data model and the behavior of the root entity Travel are described in ABAP BDL - Example.
INHERITING FROM cl_abap_behavior_handler.
PRIVATE SECTION.
TYPES:
tt_travel_update TYPE TABLE FOR UPDATE travel
ts_travel_update_id TYPE LINE OF tt_travel_update-%key
ts_travel_update_data TYPE LINE OF tt_travel_update-%data
tt_travel_update_row TYPE STRUCTURE FOR tt_travel_update.
...
ENDCLASS.
This translation does not reflect the current version of the documentation.