Query for SAP ODATA connector - Get List of SalesOrderLines

0
Dear all,  I have a simple question that derives from my  inexperience with the SAP OData connector. I have to retrieve all the Sales Lines Items of a specific sales order. This means that I have to write a query in the GET List action of a microflow. According to the following guides I will have to use the attribute ToLineItemsDeferred to point at the correct SalesOrder https://gettingstarted.mendixcloud.com/link/module/86/lecture/600/4.3-How-Order-Lines-are-Associated-with-Sales-Orders https://docs.mendix.com/partners/sap/sap-odata-connector#4-1-9-parent   Unfortunately I don’t know the sintax of the query. Does anyone can help with issue? Thank you 
asked
1 answers
1

Hey Gianmarco,

The SAP odata Connector queries use odata v2 uri-conventions:
(https://www.odata.org/documentation/odata-version-2-0/uri-conventions/)
 

Option (a):
If you have the Sales Order object already, you should correctly use a “get list” action and then apply a $filter query option to the query of Sales Line Items to get only the Sales Order’s attribute ToLineItemsDeferred associated Sales Line Items. The $filter query option is explained very thoroughly in the link in the top (section 4.5), and briefly in the previous steps in the learning path.

Option (b):
In the guide the “get list” action refers to a list of Sales Orders (each of which has a separate Sales Line Item association), if you want to make a query for a specific single Sales Order entry you should query it by the key-values of the entry you need using the “get entry” action instead of the “get list” action in Mendix. 

The Sales Lines Items are retrieved by association using the query options $expand={association_attribute}, in this case the {association_attribute} would be ToLineItemsDeferred, that you mention; querying a Sales Order with the “get entry” action using the $expand=ToLineItemsDeferred query option, gives you a Sales Order object in Mendix with the List of Sales Lines Items as an association to the object.

Cheers.
Hope it helps!

answered