SAP DERIVED TYPES KEY ABEXA



Get Example source ABAP code based on a different SAP table
  



Using %key
This example demonstrates the use of %key with a managed RAP BO in the RAP interaction phase.
Data model
The CDS data model consists of the root entity DEMO_MANAGED_ROOT_4 and its child entity DEMO_MANAGED_CHILD_4. The child entity is not used in the example.
Root entity:
DDLS DEMO_MANAGED_ROOT_4
Behavior definition
The RAP behavior definition DEMO_MANAGED_ROOT_4 is defined in RAP BDL as follows:
BDEF DEMO_MANAGED_ROOT_4
Behavior implementation
For the above RAP behavior definition, one ABP is created. The global class of the behavior pool is BP_DEMO_MANAGED_ROOT_4. The actual behavior implementation takes place in local classes that are defined and implemented in the BP_DEMO_MANAGED_ROOT_4========CCIMP of the behavior pool. In this case, the behavior pool does not include any implementations that are relevant for the example.

ABAP_SOURCE_CODE
DEMO CL_DEMO_RAP_DRVD_TYPES_KEY

ABAP_DESCRIPTION
Access with ABAP using EML
There is one ABAP_EML modify request that covers a RAP create and update operation. In both create and update operation, %key is specified in different ways just to demonstrate the variety of specification options of this component group. See more information on this in the topic Using Keys and Identifying RAP BO Instances in a Nutshell.
With a COMMIT ENTITIES statement, the instances are saved to the database. The output shows the database table entries as well as the mapped and failed responses for the root entity.