SAP Builders Discussions
Join the discussion -- ask questions and discuss how you and fellow SAP Builders are using SAP Build, SAP Build Apps, SAP Build Process Automation, and SAP Build Work Zone.
cancel
Showing results for 
Search instead for 
Did you mean: 
A New Home in the New Year for SAP Community!

OData Filtering in SAP Build Apps – Could This Work For You?

dan_wroblewski
Employee
Employee

People always want full OData filtering (and other OData manipulations) in SAP Build Apps. But the filtering is severely limited for most people (see this recent question).

The Potential Solution

Currently, there is no way to do a lot of the filtering OData provides, like Contains or Ends With and things like that.

To "solve" this, I used the REST data resource with destinations, instead of the OData integration. I admit you lose a lot of the advantages of the OData data resource – interpretation of the metadata, selecting all the entities, filtering/paging/ordering, and even converting the response. All that has to be done manually.

Still, I was able to filter and I thought perhaps it might help someone. Here's what I did.


I created a data resource of type "SAP BTP destination REST API integration" using a destination to the Northwind OData service.

dan_wroblewski_0-1687416847521.png

I enabled the list action, and set it's path to a formula.

query.search.query

dan_wroblewski_3-1687416052032.png

I then created a data variable (collection of records), and in the logic of the data variable, set the Get record collection's Search parameter.

dan_wroblewski_4-1687416113593.png

Inside there is just query field, and I set this to the entity I wanted plus any filtering, such as:

/Customers?$filter=contains(CustomerID, 'AL')

dan_wroblewski_5-1687416159655.png

The only other thing I had to do is, when setting the data variable from the output, I used a formula to remove the OData header:

outputs["Get record collection"].records.value

Because the OData response adds a header and my REST data resource does not handle this.

2023-07-17_08-52-53.png

And it seemed to work:

dan_wroblewski_6-1687416184851.png

 

My Challenge to You

OK, this is just something I threw together in response to a question in the community. But:

  • Is it helpful to anyone?
  • Can you improve on it?
  • Are there fatal limitations to it?
  • Is there a better solution?

Leave your comments below.




--------------
See all my blogs and connect with me on Twitter / LinkedIn
0 REPLIES 0