Skip to Content

UI5/OData filter on deep entity

Hello all!

i'm working with deep entities and i'd like to explore a bit the filters on deep entities.

Scenario

Given a Purchase Organization, retrieve all the linked Suppliers (which are deep entities of PurchaseOrganization).

Note i know is not really useful, but i built something easy for a quick example before dipping into deeper waters.

What i did

i found the documentation and example on StackOverflow and Odata.org (i.e. this thread ) and i managed to make a proper call to my OData service like this

 http://<server>/sap/opu/odata/sap/ZPURCHINFORECORD_SRV/PurchaseOrganizationSet?$expand=SupplierLink&$filter=(PurchaseOrg eq 'PO' and SupplierLink/Supplier eq 'supplier')

And set up my GET_EXPANDED_ENTITYSET method on my NW 731 system.

And it's correctly triggered!

The problem

The problem i'm facing right now is how to handle the filters.

Because if i put my filters only on top level (PurchaseOrg eq 'PO'), i get it in the table MT_FILTER_SELECT_OPTION of the object Filter under IO_TECH_REQUEST_CONTEXT object.

If i add the the subentity-filter, the result is that i have just the MV_FILTER_STRING

The question

There is any idea on how to parse it?

i know, i can spend some time and build a custom logic to do it but i'm more interested into a standard solution.

Thanks all!

untitled1.png (23.1 kB)
Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

3 Answers

  • Sep 15, 2017 at 12:02 AM

    There is no easy way other than building your own custom solution.

    All the filter strings which Gateway framework cannot put into a Select Option table are just skipped from parsing. So all you have is raw filter string.

    Add comment
    10|10000 characters needed characters exceeded

    • First of all, thanks for the answer.

      i'll not be very polite and i'll abuse your kindness for some more questions / doubts :)

      the question is: why PURCH_ORG is not into the MT_FILTER_SELECT_OPTION table? Because it's into a complex structure?

  • Sep 14, 2017 at 09:59 PM

    Hi Simone,

    it is unfortunately not possible to to phrase this in V2,

    Filtering on all levels in expanded result sets is only part of the V4 protocol.

    Best Regards,

    Andre

    Add comment
    10|10000 characters needed characters exceeded

    • Hi Andre,

      i'll take advance of your kindness too for some more questions.

      It's something related to the Gateway version (that as to be update to handle and parse the request) or just the UI5 model?

  • Sep 15, 2017 at 04:58 AM

    Hello,

    Delete your () in the filter, do this :

    http://<server>/sap/opu/odata/sap/ZPURCHINFORECORD_SRV/PurchaseOrganizationSet?$expand=SupplierLink&$filter=PurchaseOrg eq 'PO' and SupplierLink/Supplier eq 'supplier'

    Regards,

    Add comment
    10|10000 characters needed characters exceeded