Get Example source ABAP code based on a different SAP table
Using %control> This example demonstrates the use of %control> with a managed> RAP BO >. Data model> The CDS data model consists of the root entity DEMO_MANAGED_ROOT_4 > and its child entity DEMO_MANAGED_CHILD_4>. Root entity: DDLS DEMO_MANAGED_ROOT_4 Child entity: DDLS DEMO_MANAGED_CHILD_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_DESCRIPTION Access with ABAP using EML> There are two ABAP_EML modify requests that cover several RAP modify operations. The first ABAP_EML modify request covers a RAP create and create-by-association operation. The RAP create operation is based on the construction of an internal table using the VALUE>> operator. In this case, %control> is specified and enabled for all fields for all RAP BO instances> after the first bracket. See the concept here>. The create-by-association operation does not need to have %control > specified. The addition FIELDS ( ... ) WITH>> is used which automatically enables %control>. With a COMMIT ENTITIES> > statement, the instances are saved to the database. The second ABAP_EML modify request covers a RAP create and update operation. In the create operation, %control> is specified for each field of the RAP BO instances individually while purposely disabling %control> for some of the fields. The same is true for the update operation. Here, %control> is specified using the VALUE> operator. With a COMMIT ENTITIES>>, the instances are saved to the database. The output shows the database table entries of the root and child entity.