cancel
Showing results for 
Search instead for 
Did you mean: 

SAPUI5 - oData expand multiple associations

jakob_steen-petersen
Active Participant
0 Kudos

Hi

I have an oData Entity with multiple associations. Like this:

PurchaseOrder
---> PurchaseOrderItems (PurchaseOrderToItems)

---> PurchaseOrderPartners (Po2Partners)

I can expand the items with

/sap/opu/odata/SAP/ZVDKONTRAKT_SRV/PurchaseOrderSet('4500000313')?$expand=PurchaseOrderToItem

But i wan´t to expand bot in one call. How do i do that?

/sap/opu/odata/SAP/ZVDKONTRAKT_SRV/PurchaseOrderSet('4500000313')?$expand=PurchaseOrderToItem,Po2Partners

Returns error...

Please note: PurchaseOrderPartners is a subset of PurchaseOrder NOT Items!

sergei-u-niq
Active Contributor
0 Kudos

this is how it should work

Accepted Solutions (0)

Answers (1)

Answers (1)

vibhor_bhatnagar
Participant
0 Kudos

Hi,

You can use multiple levels of $expand:

/sap/opu/odata/SAP/ZVDKONTRAKT_SRV/PurchaseOrderSet('4500000313')?$expand=PurchaseOrderItems($expand=PurchaseOrderToItems),PurchaseOrderPartners($expand=Po2Partners)
jakob_steen-petersen
Active Participant
0 Kudos

Are you sure if that syntax? I cannot get it to work.

Do we really need 4 times "expand" when i only need to expand 2 associations?

vibhor_bhatnagar
Participant
Try this:


/sap/opu/odata/SAP/ZVDKONTRAKT_SRV/PurchaseOrderSet('4500000313')?$expand=PurchaseOrderItems/PurchaseOrderToItems,PurchaseOrderPartners/Po2Partners

If this is also not working can you share the metadata ?
jakob_steen-petersen
Active Participant

Hi

Don´t know why (maybee i have misspelled..., but i got this to work:

/sap/opu/odata/SAP/ZVDKONTRAKT_SRV/PurchaseOrderSet('4500000313')?$expand=PurchaseOrderToItem,Po2Partners