Skip to Content

SAP B1 Service Layer $crossjoin a Document with AddressExtension

Hi,
Is there a way to properly $crossjoin a Document with AddressExtension?
I need for example to implement document filtering by ship to country.
Joining without a filter seems to be making a Cartesian product, truly matching all documents with all addresses; on another note, AddressExtension does not expose DocEntry, so I cannot apply a joining $filter expression.
Please advise, this would be a real show stopper if that's unsupported.
Maybe there is some other call I could use?

Query example to illustrate the improper cross join -

{
  "QueryPath": "$crossjoin(Orders,Orders/AddressExtension)",
  "QueryOption": "$expand=Orders($select=DocEntry, DocNum),Orders/AddressExtension($select=ShipToCountry)&$filter=Orders/DocNum eq 1200"
}
Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • May 18 at 09:27 AM

    Hi Alex,

    You are right, the DocEntry property is not available in the AddressExtension object and therefore the crossjoin is not possible.

    Checking the SDK Help Center documentation I have read the following here below. Could help you to read Address and Address2 instead?
    I'm checking internally if DocEntry property could be exposed or how best could this request be implemented, I'll keep you updated.

    Simply filtering on AddressExtension/ShipToCountry on Orders request will also not work as filtering on subcollections is not available on Service Layer.

    Description
    The Bill To and Ship To addresses for the document.
    This property enables you to specify the BillTo and ShipTo addresses by defining their component parts -- for example, the street name, city name, and country -- instead of specifying the address as free-text strings.

    After setting the AddressExtension property, the system does the following:

    1. Clears the Address and Address2 properties.
    2. Creates BillTo and ShipTo addresses based on the values in the AddressExtension property. The address format is determined by the country's address format, which is specified at Administration --> Setup --> Business Partner --> Countries. The format used is either the format for the country specified in the BillToCountry or ShipToCountry property of the AddressExtension property or, if no country is specified, the company country.
    3. Copies these addresses to the Address and Address2 properties.

    Regards,
    Trinidad.

    Add comment
    10|10000 characters needed characters exceeded