SAP Knowledge Base Article - Public

2930423 - How to Download Accounts Within Their Account Hierarchy Using OData


You are aware that the SAP OData Service accounthierarchylist is modeled to fetch the details of a single account at a time. You are wondering if there is an alternative approach to get the account hierarchy for multiple accounts.


SAP Cloud for Customer


The following approach allows to download all business partners within their account hierarchy. This can be achieved in three steps, and you may have to build an interim custom code to do this.

1. Download all account hierarchy records:

This will return up to 1000 records. You can check how many accounts there are in the hierarchy using the following query:$count

To download more than 1000 records, you can use client side paging ( or use the built-in server side paging. You can check to see more on this.

2. Download the IDs of the accounts within the accounthierarchy:'<ObjectID of each record returned from the previous call>')/BusinessPartnerBusinessPartner

These individual calls can be combined and executed in one round trip using $batch (

3. Download the Business Partner Data for each InternalID returned from the above calls:$filter=AccountID eq 'InternalID 1' or AccountID eq 'InternalID 2' or ...

Note: If the $filter query parameters becomes too large, in order to avoid URL size limits, the above call can also be executed as a $batch call.

Note: You can use the same endpoint to update existing Account Hierarchy

See Also

See also KBA 2796677


not possible able enable get customer customers account export business partner partners , KBA , LOD-LE-BP-HIE , Business Partner Hierarchy , LOD-CRM-INT-API , OData API (C4C Only) , How To


SAP Cloud for Customer add-ins all versions ; SAP Cloud for Customer core applications all versions