ABAP Keyword Documentation → ABAP − Reference → ABAP RESTful Programming Model → Derived Types
Type of the Output Parameter
Other versions:
7.31 | 7.40 | 7.54
Syntax
TYPES type_for_export_parameter TYPE TABLE FOR
FAILED [LATE]|
MAPPED [LATE]|
REPORTED [LATE]|
READ RESULT
CDS_entity_name.
TYPES type_for_action_export_parameter TYPE TABLE FOR
ACTION RESULT
CDS_entity_name~action_name.
TYPES ts_reported TYPE RESPONSE FOR
FAILED [LATE]|
MAPPED [LATE]|
REPORTED [LATE]
behavior_definition_name.
Effect
The output parameters FAILED, MAPPED, and REPORTED are structure types that contain one component for each entity of the business object:
- MAPPED [LATE]
Provides the consumer with ID mapping information.
The mapping information is available in the interaction phase by default. The %CID is then mapped to the real key or to the %PID. The addition LATE specifies that the mapping information is available only when saving. This is important when late numbering is used (the method adjust_numbers), during which the %PID is mapped to the real key.
- FAILED [LATE]
Contains information that identifies the data record when an error occurs.
FAILED is provided during the interaction phase and contains the %CID or the %KEY to specify instances for which an operation (CREATE, UPDATE, DELETE, LOCK, or READ IMPORT) has failed. FAILED with the addition LATE is provided during the save phase only and contains the %PID or the %KEY, but not the %CID.
- REPORTED [LATE]
This parameter is used to send error messages.
REPORTED is provided during the interaction phase and contains the %CID or the %KEY to specify instances for which an operation has failed. REPORTED LATE is provided when saving only and contains the %PID or the %KEY, but not the %CID.
- READ RESULT
This parameter is used to return the result of the operation READ.
The type name of the output parameter (type_for_export_parameter, type_for_action_export_parameter, and ts_reported) can be specified freely.
CDS_entity_name refers to the name of the CDS entity or the alias as defined in the behavior definition for the CDS entity.
...TYPE RESPONSE FOR... are structures that contain one component for each entity of the business object.
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_failed TYPE TABLE FOR FAILED travel
tt_travel_mapped TYPE TABLE FOR MAPPED travel
tt_travel_mapped_late TYPE TABLE FOR MAPPED LATE travel
tt_travel_reported TYPE TABLE FOR REPORTED travel
tt_booking_read_out TYPE TABLE FOR READ RESULT booking.
TYPES:
tt_travel_set_status_booked_ou
TYPE TABLE FOR ACTION RESULT travel~set_status_booked.
tt_travel_get_status_out
TYPE TABLE FOR ACTION RESULT travel~get_status.
...
ENDCLASS.