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

348

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 - Events

Category - ABAP

How can you actually create events in RAP and process them with ABAP? Here you can find out more about event-driven processing.

12/23/2024

RAP - Load Excel File

Category - ABAP

In this practical example we look at processing Excel in ABAP with the new XCO classes and how we get the file into our RAP object.

12/20/2024

RAP - Semantic Key

Category - ABAP

What do you need the semantic key for and how is it represented in the ABAP RESTful Programming Model? You can find out more here.

12/13/2024

RAP - File Upload (Stream)

Category - ABAP

How can you easily load files into your RAP object and make them available in ABAP? Let's take a look at the details.

12/10/2024

RAP - Report Pattern

Category - ABAP

How is the Report Pattern structured in RAP and what can you do with it? Read more in this ABAP article.

12/06/2024