Symptom
It's required to create a sales document via API and add a partner of type contact person. Previous to the order creation, it's necessary to retrieve the contact person ID (ContactPerson or Personnel short number) from the business partner master data, so then this number can be inserted in the sales document payload for creation.
Environment
SAP S/4HANA Cloud Public Edition
Reproducing the Issue
Using as an example, the sales document type Quotation:
{
"SalesQuotationType": "QT",
"SalesOrganization": "1010",
"DistributionChannel": "10",
"PurchaseOrderByCustomer": "Reproducing the issue",
"SoldToParty": "10100001",
"to_Item": {
"results": [
{
"Material": "TG11",
"RequestedQuantity": "1"
}
]
},
"to_Partner": [
{
"PartnerFunction": "CP",
"ContactPerson": {{Contact Person ID}}, // It's unknown how to fetch this number.
"ReferenceBusinessPartner": "10100002"
}
]
}
Cause
The main API available regarding business partners is the Business Partner A2X (API_BUSINESS_PARTNER), however, this API currently doesn't expose the internal Contact Person ID (ContactPerson or Personnel short number) that is required for CP assignment in the sales document creation.
- This API only provides the Business Partner ID (long ID like 200000000)
- The internal ID used in sales documents partner assignments is not available in /A_BusinessPartner or /A_BusinessPartnerRelationship.
Resolution
While this action is not possible using an standard API, there's an available workaround for this scenario:
Build a Custom CDS View to expose both IDs: if the relevant data sources are available in your tenant, you could use the 'Custom CDS View' app to join:
- I_BusinessPartnerRelationship
- I_ContactPerson or similar
Expose both:
- BusinessPartner (long ID)
- ContactPerson (internal short number)
See Also
Keywords
sales order, sales quotation, API_SALES_QUOTATION_SRV, API_SALES_ORDER_SRV, API_BUSINESS_PARTNER, contact person, CP, personnel number, partner function, to_Partner, contactperson , KBA , SD-SLS-API-2CL , API (Public Cloud) , LO-MD-BP-2CL , Business Partners for Public Cloud , How To
SAP Knowledge Base Article - Public