RAP Type Mapping Constants
Learn how to use RAP type mapping constants in the BDEF to store a fixed field value in a persistent table without using determinations.
Have you ever faced a RAP scenario where a field always needs to store the same fixed value in the table? Earlier, we handled this using determinations or get defaults to set default values. Now, it’s much simpler with RAP Type Mapping – Constant.
You can directly define a fixed value in the RAP type mapping using the constant syntax. This is especially useful when:
- Multiple entities are mapped to the same persistent table based on one value
- A specific field must always store a constant value
Example: In one RAP BO, the employee type is always 'FT', and in another it is 'PT', both stored in the same table.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
define behavior for ZI_FullTimeEmployee
persistent table zemployee_t
...
{
mapping for zemployee_t corresponding
{
EmployeeId = employee_id;
EmployeeName = employee_name;
EmployeeType = constant 'FT';
}
}
define behavior for ZI_PartTimeEmployee
persistent table zemployee_t
...
{
mapping for zemployee_t corresponding
{
EmployeeId = employee_id;
EmployeeName = employee_name;
EmployeeType = constant 'PT';
}
}
Availability: Currently available only in SAP Public Cloud and SAP BTP ABAP Environment.
This post is licensed under CC BY 4.0 by the author.
