Post

Accessing Change Information in EML Using WITH CHANGES

Learn how to use READ ... WITH CHANGES in ABAP EML to access accumulated change info and see which fields changed in a RAP transaction.

Using READ ... WITH CHANGES 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:

1
2
3
4
READ ENTITIES OF ZRootEntity IN LOCAL MODE
  ENTITY RootEntity WITH CHANGES
  ALL FIELDS WITH CORRESPONDING #( keys )
  RESULT DATA(lt_result1).

Variant 2:

1
2
3
4
READ ENTITY IN LOCAL MODE ZRootEntity
  WITH CHANGES
  ALL FIELDS WITH CORRESPONDING #( keys )
  RESULT DATA(lt_result2).

Example: If carrname is changed in the UI from “Air India” to “Air India Updated”, the control indicator is set to 01 at the time of a determination, indicating the field change.

Availability: Currently released only in SAP S/4HANA Public Cloud and SAP BTP ABAP Environment.

For more information, refer to the ABAP EML Cheat Sheet.

WITH CHANGES EML result

This post is licensed under CC BY 4.0 by the author.