Dinesh M
🚀 Boosting RAP
with Augment⚡
ABAP ON
CLOUD
⚡ Augmentation in SAP RAP
Augmentation allows developers to add data or
modify incoming requests at the projection layer
before they reach the transactional buffer.
👉 What it enables
Add default values to incoming requests.
Trigger additional operations (like
CREATE_BY_ASSOCIATION) alongside the original
request.
Support behavior-enabling scenarios such as
editing language-dependent fields.
✨ Augment + Precheck
When both the projection BO and base BO define a
precheck method, the execution order is
1️⃣ Precheck on Projection
2️⃣ Augment on Projection
3️⃣ Precheck on Base
💡 In short: Operation Augmentation is a powerful
RAP capability that extends business object behavior
without changing the base BO. 🚀
🚀 Augmentation in SAP RAP
With augmentation, you can add data or even new
instances to requests from RAP BO consumers before the
requests are forwarded to the base BO’s handler methods.
📌 Supported Operations
You can define augmentation for the following operations:
🟢 CREATE ✨
🟡 UPDATE 🔄
🔵 CREATE BY ASSOCIATION 🔗
⚠️ Important Rules for Augmentation
🚫 You cannot overwrite fields already set in the original
request.
👉 Any attempt to change existing values is ignored by
the RAP runtime.
✨ Augmentation can only populate unset fields.
🔒 Fields defined as readonly cannot be set during
augmentation.
⚡ Since augmentation is treated like an external
modification, trying to change a readonly field will cause a
runtime error.
Projection Behaviour
In this projection behavior, use create(augment) and use
update(augment) enable request augmentation at the projection
layer, allowing modification of incoming CUD operations before they
reach the underlying transactional buffer of the base BO.
For example, during a CREATE on zc_travel_ex, you can:
➡️ Inject default values
➡️ Compute derived fields
➡️ Trigger additional Create requests for associated entities
The create(augment) on the _cust association enables context-
aware propagation when creating related entities via associations,
ensuring data consistency in draft scenarios.
🚀 Augmentation in SAP RAP
3 Key Scenarios in RAP Augmentation
1️⃣ Create Augmentation – Enhance standard CREATE
requests by adding custom logic before persisting data.
2️⃣ Additional Create Request (Child Entity) – Extend the
original CREATE with an extra CREATE_BY_ASSOCIATION
request to handle dependent/child entities.
3️⃣ Update Augmentation – Enrich or modify incoming
UPDATE requests before they reach the transactional
buffer.
Projection Behaviour Definition
⚡ Create Augment
Projection Behavior Implementation
➡️ Step 1 – Copy the incoming entities to the local table
➡️ Step 2 – Loop the Local table to assign the default value for the fields..
Set a default CurrencyCode = 'USD'
Mark the field as changed using %control.
➡️ Step 3 – call MODIFY AUGMENTING ENTITIES to pass the updated
data back to the framework.
Output Screen
👉 While creating a Travel entity, the Currency Code is
automatically defaulted to ‘USD’ and pre-populated on the
initial screen.
⚡ Create Augment- Additional
Create request (Child entity)
Projection Behavior Implementation
➡️ Step 1 – Prepare main entity data (zi_travel_ex)
🔹 Add default value → CurrencyCode = 'USD'
🔹Mark as controlled → %control
➡️ Step 2- Call MODIFY AUGMENTING ENTITIES again for main entity creation
➡️ Step 3– Collect input entities and prepare child entity data (zi_travel_ex_cust)
🔹Add custom values like country = 'US’.
🔹Mark the field as controlled (%control).
➡️ Step 4 – Execute MODIFY AUGMENTING ENTITIES to create child entities
👉 While creating a travel entity, the system enriches the request by
assigning the default CurrencyCode = 'USD' and also triggers a new
create request for the associate child custom entity with the default
Country = 'US'.
Output Screen
Travel Entity - Initial Create screen
Customer Data - Initial screen
🖱️ When the create button is pressed in the application, ✈️ the
system enriches the travel entity create request by assigning the
default 💵 CurrencyCode = 'USD' and simultaneously triggers a new
create request for the 🔗 associated custom child entity with the
default 🌍 Country = 'US'.
⚡ Update Augment
Projection Behavior Defintion
Projection Behavior Implementation
➡️ Step 1: Collect incoming update entities into an internal table (lt_travel).
➡️ Step 2: Loop through the entities and enhance data.
🔑 Assign a default CustomerId = 138.
🛡️ Mark the field as controlled using %control.
➡️ Step 3: Use MODIFY AUGMENTING ENTITIES to pass enriched data
back for the update operation.
Output Screen
📝 When the edit button is pressed and any field of the ✨
travel entity is changed, the 🔄 augment_update method is
triggered. 📌 On save, it automatically updates the 🆔
CustomerId to the default value 138.