SAP SQL MAPPING FROM ENTITY ABEXA



Get Example source ABAP code based on a different SAP table
  



AB_SQL Statements with the Addition MAPPING FROM ENTITY
This example demonstrates AB_SQL statements using the additions MAPPING FROM ENTITY. The internal tables and work areas used in the example are typed with BDEF derived types. These types are based on a simple managed RAP BO.
Data model
The CDS data model consists of the root entity DEMO_MANAGED_ROOT_MAP and its child entity DEMO_MANAGED_CHILD_MAP which is not used in this example.
Root entity:
DDLS DEMO_MANAGED_ROOT_MAP
Behavior definition
The RAP behavior definition DEMO_MANAGED_ROOT_MAP is defined in RAP BDL as follows:
BDEF DEMO_MANAGED_ROOT_MAP
Behavior implementation
For the above RAP behavior definition, one ABP is created. The global class of the behavior pool is BP_DEMO_MANAGED_ROOT_MAP. It is not relevant in this example.

ABAP_SOURCE_CODE
DEMO CL_DEMO_RAP_MAPPING_FROM_ENTTY

ABAP_DESCRIPTION
The example shows the four AB_SQL statements INSERT, MODIFY, UPDATE, and DELETE with the addition MAPPING FROM ENTITY. For each statement , a structure and an internal table are filled with sample values. Both structure and internal table are typed with the BDEF derived types TYPE STRUCTURE FOR and TYPE TABLE FOR respectively. After the statements, a SELECT statement is used to retrieve the entries from a database table and insert them into an internal table to visualize the effect of the AB_SQL statements.
The example for UPDATE also shows the addition INDICATORS SET STRUCTURE.