ABAP RAP Advanced

SideEffects in RAP

More Dynamic UIs

What Are SideEffects?

  • Mechanism to control UI and data updates
  • Detect data changes that affect other fields or UI areas
  • Trigger reloads, permissions, messages, or determinations
  • Available from RAP version 7.58, SAP BTP ABAP, S/4HANA 2023

Why SideEffects?

  • Prevent inconsistent UI data after changes
  • Automatically update dependent fields in the UI
  • Improve user experience and data consistency
  • Reduce manual effort and sources of error

Types of SideEffects

Trigger Affected Targets
Field change (field) Fields, associations, permissions, messages, entity, self
Action (action) Fields, entities, actions
Determinate action Actions, fields
Event Entities, UI elements
Self Own entity or associated data

SideEffects in Behavior Definition

  • Since RAP 7.58, declarative SideEffects are possible in the Behavior Layer
side effects {
  field MyField affects field MyField1, MyField2;
}

side effects {
  action MyAction affects field MyField;
}

side effects {
  determine action MyDetermineAction executed on SourceEntity affects TargetEntity;
}

side effects {
  $self affects messages;
}
  • These definitions control automatic reloads and message triggers
  • Seamless integration into Fiori Elements and UI5 applications

Implementation Notes

  • SideEffects define dependencies between entity fields and actions
  • Optimize performance by targeting only affected elements
  • Test defined SideEffects in both draft and non-draft scenarios
  • Handle errors via SideEffects for messages

Local SideEffects in the App

  • SideEffects can be added directly in the Fiori Elements app
  • Added via UI-specific annotations in local MDEs
  • Enables targeted UI updates without backend code changes
  • Useful for quick adjustments or enhancements to backend behavior

Example: Local SideEffect Annotation

<Annotations Target="YourNamespace.YourEntity/Status">
  <Annotation Term="Common.SideEffects">
    <Collection>
      <Record>
        <PropertyValue Property="SourceProperties">
          <Collection>
            <String>Status</String>
          </Collection>
        </PropertyValue>
        <PropertyValue Property="TargetProperties">
          <Collection>
            <String>OverallStatus</String>
            <String>Messages</String>
          </Collection>
        </PropertyValue>
      </Record>
    </Collection>
  </Annotation>
</Annotations>
  • Supported by Guided Development in VSCode/BAS

Summary

  • SideEffects are essential for integrated, consistent user experience
  • Declarative definition in Behavior improves maintainability
  • Supports automatic UI updates and logic linking
  • Indispensable for complex, interactive RAP applications