This is a test message to test the length of the message box.
Login
ABAP RAP Side Effects
Created by Software-Heroes

RAP - Side Effects

1942

How can you update parts of the Fiori UI without doing a complete refresh? With Side Effects, this is easily possible in ABAP and RAP.



In this article we look at the different types of side effects and how you can use them effectively in your everyday life.

 

Introduction

To do this, we will expand our application from the Report Pattern series to include additional functionality. If you have already worked with the application, you will certainly have noticed that certain components of the application are only loaded when updating, such as after processing the Excel file or when adding a new country.

Side effects can be created for this purpose. These define a trigger, which in turn triggers an effect on an object. Only the affected objects are reloaded. For example, if it is a field, then only this field will be reloaded. In principle, this function was already possible in Fiori, but you can now control this from the RAP behavior.

 

Options

Currently, certain actions can trigger a side effect, including:

  • Fields - A specific field is changed in the UI.
  • Actions - An action is triggered, usually linked to a button in the UI.
  • Determination - An determination is initiated that automatically changes the contents of fields.
  • SELF - Refers to the own entity.

 

The following objects can then be influenced:

  • Fields - Updating individual fields in the UI, but also individual fields of associations.
  • Permissions - This can be used to deactivate buttons, such as custom actions and standard actions.
  • Entity - This can be used to reload complete associations if data in entire nodes has changed.
  • Messages - Forces the reloading of messages generated via REPORTED.
  • SELF - Refers to the own entity.

 

In principle, you can use side effects in the RAP business objects (managed and unmanaged), as well as in the projection layer of the objects. You can also find further details in the technical documentation that we have linked below. However, you need an S/4HANA 2023 system on-premise for this.

 

Example

In this example, we want to equip the upload button with an action. To do this, after executing the action, the country entity should be updated and the Excel file field, as this will be deleted after the upload. Let's take a look at what it looks like before the action.

 

To do this, we extend the projection of the behavior definition and insert the new statement under the "LoadExcelContent" action. With SIDE EFFECTS you open the area where you can define all side effects. To do this, we define an effect for our actions that affects the Country entity and the ExcelAttachment field. Since the object can only be listed once, we separate the effects with a comma at the end.

side effects {
  action LoadExcelContent affects entity _Country, field ExcelAttachement;
}

 

After this small change, let's look at the impact on the UI. It is noticeable that the interface has already been reloaded after the action has been carried out.

 

Full example

All changes made in this article can be found in the GitHub repository under the corresponding commit. This will help you better understand all changes.

 

Conclusion

Side Effects can be integrated into the UI with very little effort and make the user's work much easier, as they can immediately see the updated information without having to reload the application.

 

Source:
SAP Help - Side Effects


Included topics:
RAPBTPEvents
Comments (0)



And further ...

Are you satisfied with the content of the article? We post new content in the ABAP area every Friday and irregularly in all other areas. Take a look at our tools and apps, we provide them free of charge.


RAP - Multiple filters and settings

Category - ABAP

What happens if we want to set several filters and fields as default in RAP and also need a default sorting?

05/16/2025

RAP - Message Length

Category - ABAP

Is your message truncated when outputting with RAP? Let's look at the problem and a solution.

05/13/2025

RAP - Optimize Search and Keys

Category - ABAP

In this article, we will optimize our search help in the custom pattern, use the additional binding, and make our RAP application fit for the end user.

05/06/2025

RAP - Fixed Value Filter

Category - ABAP

How do you use fixed values from a domain for a filter and customize it to your needs in RAP? Learn more here.

05/02/2025

RAP - Custom Pattern (Behavior)

Category - ABAP

In this article, we extend the Custom Pattern in RAP with additional data and behavior, allowing us to create added value in the implementation.

04/29/2025