How to perform a CAP bound action on a Collection?

Hello experts,

in a Fiori Elements frontend (FPM) I need to perform a CAP bound action on several entities (selected from a table) but I am experiencing some issues.

TL;DR I can’t find a proper way to pass a collection to my bound action modeled as such: 

    entity MyEntity as projection on db.myTable actions {
             action actionOnCollection(in: many $self); 
     };
 
First, I implemented such action with simple annotations and implicit binding parameter, so each entity was passed to the backend handler and processed individually: the side effect showed up on the UI as soon as the single action was performed in a not very nice manner, also with InvocationGrouping set to #ChangeSet…

Then I improved the situation by calling the action in a controller extension via the editFlowAPI invokeAction: setting the invocationGrouping to ChangeSet from the API packs all the POST and GET requests in a single batch request. Each entity is still processed individually but the response is unique so the UI receives a single update when all operations are done. The problem is that sometimes the process takes too long and the request has a timeout.

In the documentation, I found a very promising statement about explicit binding parameter that can fit my needs:

“Use the keyword many to indicate that the action or function is bound to a collection of instances rather than to a single one.”

I tried many solutions but as soon as I add this parameter to my bound action, no params nor data are passed to my backend although the edmx file expects an entity collection as intended. I can’t find a clear explanation on how to use it nor examples on how to pass a collection…

How can I pass a collection to my bound action? Is it really possible or am I misinterpreting the whole thing?

Thanks a lot

Chiara

Scroll to Top