
RAP - Action (Processing options)
How do you actually enable multi-select in RAP and control the various processing options? Here we'll look at the different options in the framework.
Table of contents
In last week's article, we looked at an action in the area of custom entities. In this article, we provide some more details on processing and generation in BAS.
Introduction
Not all options are available as annotations during modeling. Certain options, such as autoload, extensions, or UI actions, are only set when the Fiori application is generated. To validate the various processing options, we must first activate multi-select in the table. Then we can observe the app's behavior.
Preparation
As a preparatory step, we must first generate the app so that we can then adapt and test it. We use the Business Application Studio as the standard in development, as it is available to us out-of-the-box without any further configuration. Here, we generate the project using the Tool Bridge. We should now see the overview page:
Multi Select
Using OData v2, we only get radio buttons in the list, but we can activate multi-select via the BAS. To do this, we can start Guided Development and look for the option "Configure Multiple Selection for a Table".
In the next step, we start the wizard and have to set the option in the lower area to "True" to activate multiple selection. The setting is activated in the app using the "Insert Snippet" button.
If the file has now been expanded, multiple selection of entries should now be possible in the preview. With this small adjustment, our app now has full flexibility if we want to process multiple data sets.
Processing Options
In this chapter, we'll take a look at the processing options available for actions. Using the "invocationGrouping" suffix in the UI annotation, we can control two different states of an action.
ISOLATED
This is the default setting if you define an action but don't specify the suffix. This causes each selected record in the list to generate its own query. If we execute our "Custom Action," it will be called as often as there are selected records. However, with each pass, we only receive one key for processing.
Things get a bit strange with the static "Reset" action, which behaves differently if we have not selected any records or if we have selected records from the list. If no record is selected, the action is called exactly once, as we expect. For example, if we select two records, the action is executed twice, which makes no sense for a reset, for example.
CHANGE_SET
The second option is the change set, and as the name suggests, a set of changes is created here. To do this, we set the option once for both actions and look at the behavior in detail. If we select all three entries in the list and call the "Custom Action," our implementation is called exactly once. However, we receive all the keys to the method.
Now for the static action. Here, too, we receive exactly one call to the action, regardless of whether we have selected records or not. We would actually expect this behavior from the static action by default, since the selected records are not actually relevant.
Usage
With the knowledge from above, we can define the two actions for the UI. To ensure the static action works as desired, we would work with the change set here. With the custom action, you can decide whether the records should be processed as a group.
@UI.lineItem: [{ position: 10 },
{ type: #FOR_ACTION, dataAction: 'myCustomAction', label: 'Custom Action', invocationGrouping: #ISOLATED },
{ type: #FOR_ACTION, dataAction: 'resetAllIcons', label: 'Reset', invocationGrouping: #CHANGE_SET } ]
Hint: In principle, actions should be implemented in such a way that they can also handle multiple data sets.
Complete example
The complete example of the service and the app can be found in the GitHub repository in the package ZBS_DEMO_RAP_CUSTOM_ACTION. However, you won't find the small changes from this article there.
Conclusion
You now know how to activate multi-select via the Business Application Studio and how to configure the action correctly to suit your processing.
Source:
SAP Help - invocationGrouping





