RAP - Accessing Change Information Using WITH CHANGES
Hello Everyone! 👋
𝗔𝗰𝗰𝗲𝘀𝘀𝗶𝗻𝗴 𝗖𝗵𝗮𝗻𝗴𝗲 𝗜𝗻𝗳𝗼𝗿𝗺𝗮𝘁𝗶𝗼𝗻 𝗨𝘀𝗶𝗻𝗴 𝗪𝗜𝗧𝗛 𝗖𝗛𝗔𝗡𝗚𝗘𝗦
Using 𝗥𝗘𝗔𝗗 ... 𝗪𝗜𝗧𝗛 𝗖𝗛𝗔𝗡𝗚𝗘𝗦 in ABAP EML lets you access accumulated change information for RAP BO instances within a RAP transaction.
It can be used only for managed RAP BOs, inside implementation classes, and must be combined with IN LOCAL MODE. It is not supported for unmanaged BOs, read-by-association, or RAP functions.
The read result includes the %chg component, which indicates whether an instance was created, updated, deleted, or unchanged. The %control structure shows which fields changed.
This is especially useful in determinations or validations involving multiple fields, where you want to know:
- Which operation triggered the logic (create or update)
- Which specific fields were changed
"Variant 1
READ ENTITIES OF ZRootEntity IN LOCAL MODE
ENTITY RootEntity WITH CHANGES
ALL FIELDS WITH CORRESPONDING #( keys )
RESULT DATA(lt_result1).
"Variant 2
READ ENTITY IN LOCAL MODE ZRootEntity
WITH CHANGES
ALL FIELDS WITH CORRESPONDING #( keys )
RESULT DATA(lt_result2).
𝗘𝘅𝗮𝗺𝗽𝗹𝗲
If carrname is changed in the UI from “Air India” to “Air India Updated”, the control indicator is set to 01, indicating the field change
Note: This feature is currently released only in SAP S/4HANA Public Cloud and SAP BTP ABAP Environment.
For more information checkout the documentation - ABAP EML for RAP – Accessing Change Information

Comments
Post a Comment