SAP Knowledge Base Article - Public

2796677 - SAP OData Service accounthierarchylist Does not Fetch the Parent Account Data for the Entity BusinessPartnerBusinessPartnerCollection

Symptom

Your requirement is to get the Parent Account related information from Account Hierarchy using the SAP OData Service accounthierarchylist. Upon executing the query for the entity BusinessPartnerBusinessPartnerCollection, the Account IDs does not contain the Parent Account details.

Environment

SAP Cloud for Customer

Reproducing the Issue

1. Go to Administrator work center
2. Go to OData Service Explorer view
3. Show SAP OData Services
4. Highlight the Service name: accounthierarchylist and select Test
5. On the OData Console, in the left pane, select the Entity Set BusinessPartnerBusinessPartnerCollection
6. Select the Test tab
7. For the Request Method GET, execute the query https://myxxxxxx.crm.ondemand.com/sap/c4c/odata/v1/accounthierarchylist/BusinessPartnerBusinessPartnerCollection
(where myxxxxxx represents the tenant)
8. Check the Response in the XML tab
9. Account IDs do not contain the Parent Account details

Example:
https://myxxxxxx.crm.ondemand.com/sap/c4c/odata/v1/accounthierarchylist/BusinessPartnerBusinessPartnerCollection
(where YYYYY represents the Account ID)

When you execute the Request Method for the above query, you notice that the Account ID: YYYYY does not contain the Parent Account details

<d:Parent_Account/>
<d:Parent_Account_Name/>
<d:Top_Level_Account/>
<d:Top_Account_Name/>

Cause

The SAP OData Service accounthierarchylist is modeled to fetch the details of a single Account at a time.

Resolution

While calling the GET method, the particular Account ID needs to be passed. The SAP OData Service accounthierarchylist can accept one Account ID and gives the complete hierarchy structure of the respective Account, for example all the Child Accounts and its Parent and Top details.

Example:
https://myxxxxxx.crm.ondemand.com/sap/c4c/odata/v1/accounthierarchylist/BusinessPartnerBusinessPartnerCollection?$filter=InternalID eq 'YYYYY'

Parent Account details are available when you execute the above OData Query

<d:Parent_Account>ZZZZZ</d:Parent_Account>
<d:Parent_Account_Name>Max Mustermann</d:Parent_Account_Name>
<d:Top_Level_Account>ZZZZZ</d:Top_Level_Account>
<d:Top_Account_Name>Max Mustermann</d:Top_Account_Name>

(where ZZZZZ represents the Parent Account and Top Level Account in this example)

Keywords

Account Hierarchy, accounthierarchylist, Top Level Account, Parent Account, BusinessPartnerBusinessPartnerCollection , KBA , LOD-CRM-INT-API , OData API (C4C Only) , Problem

Product

SAP Cloud for Customer add-ins all versions