Technical Articles
Create contact persons using Web service APIs
In SAP Business ByDesign you can create business partner organizations (for example corporate accounts) with assigned contact persons. Each contact person is a business partner itself. The business partner relationship between the contact person and the organization is a separate entity representing the association between both business partners with some attributes such as workplace address information.
In general you can read and write business partner organizations, contact persons and business partner relationships in a single web service call using the Web service APIs for accounts (QueryCustomerIn and ManageCustomerIn) and suppliers (QuerySupplierIn and ManageSupplierIn). However, I prefer to create and change contact persons and contact person relationships using the web services APIs for contact persons: QueryContactIn and ManageContactIn.
Here are 3 example use cases:
Create a new business partner with role “contact person” and assign the person to an account by creating the business partner relationship of type “Contact Person”:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:glob="http://sap.com/xi/SAPGlobal20/Global" xmlns:a00="http://sap.com/xi/AP/CustomerExtension/BYD/A0014">
<soapenv:Header/>
<soapenv:Body>
<glob:ContactBundleMaintainRequest_sync_V1>
<BasicMessageHeader>
<!-- <UUID>?</UUID> --> <!-- Idem Potency! -->
</BasicMessageHeader>
<Contact actionCode="01" addressInformationListCompleteTransmissionIndicator="false" relationshipListCompleteTransmissionIndicator="false" isContactPersonForRelationshipListCompleteTransmissionIndicator="false" noteListCompleteTransmissionIndicator="false" responsibleEmployeeListCompleteTransmissionIndicator="false">
<ObjectNodeSenderTechnicalID>1</ObjectNodeSenderTechnicalID>
<ChangeStateID></ChangeStateID>
<InternalID>KH-C11</InternalID>
<LifeCycleStatusCode>2</LifeCycleStatusCode>
<GivenName>Knut</GivenName>
<FamilyName>Heusermann</FamilyName>
<IsContactPersonForRelationship actionCode="01" workplaceTelephoneListCompleteTransmissionIndicator="true">
<ObjectNodeSenderTechnicalID>2</ObjectNodeSenderTechnicalID>
<!-- Organisation Account ID -->
<RelationshipBusinessPartnerInternalID>KH-C1</RelationshipBusinessPartnerInternalID>
<MainBusinessPartnerIndicator>true</MainBusinessPartnerIndicator>
<BusinessPartnerFunctionTypeCode></BusinessPartnerFunctionTypeCode>
<BusinessPartnerFunctionalAreaCode></BusinessPartnerFunctionalAreaCode>
<!-- Per default the contact workplace is the corporate main address -->
<!--<WorkplaceBusinessAddressUUID>?</WorkplaceBusinessAddressUUID>-->
<WorkplaceEmailURI>myworkplaceemail@sap.com</WorkplaceEmailURI>
<WorkplaceTelephone>
<ObjectNodeSenderTechnicalID>3</ObjectNodeSenderTechnicalID>
<FormattedNumberDescription>+49 67227 742963</FormattedNumberDescription>
<MobilePhoneNumberIndicator>false</MobilePhoneNumberIndicator>
</WorkplaceTelephone>
<WorkplaceFunctionalTitleName>Product Manager</WorkplaceFunctionalTitleName>
<WorkplaceDepartmentName>Cloud SME Product Management</WorkplaceDepartmentName>
<WorkplaceBuildingID>WDF</WorkplaceBuildingID>
<WorkplaceFloorID>1</WorkplaceFloorID>
<WorkplaceRoomID>123</WorkplaceRoomID>
</IsContactPersonForRelationship>
<!-- Private address: -->
<AddressInformation actionCode="04">
<ObjectNodeSenderTechnicalID>4</ObjectNodeSenderTechnicalID>
<!--<UUID>?</UUID>--><!-- required for address updates -->
<Address actionCode="04" telephoneListCompleteTransmissionIndicator="false">
<ObjectNodeSenderTechnicalID>5</ObjectNodeSenderTechnicalID>
<EmailURI>knut.heusermann@home.de</EmailURI>
<PostalAddress>
<CountryCode>DE</CountryCode>
<CityName>Heidelberg</CityName>
<StreetPostalCode>12345</StreetPostalCode>
<StreetName>Somewhere in Heidelberg</StreetName>
<HouseID>42</HouseID>
</PostalAddress>
</Address>
</AddressInformation>
<DuplicateCheckApplyIndicator>false</DuplicateCheckApplyIndicator>
</Contact>
</glob:ContactBundleMaintainRequest_sync_V1>
</soapenv:Body>
</soapenv:Envelope>
Assign an existing person to an account as “Contact Person”:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:glob="http://sap.com/xi/SAPGlobal20/Global" xmlns:a00="http://sap.com/xi/AP/CustomerExtension/BYD/A0014">
<soapenv:Header/>
<soapenv:Body>
<glob:ContactBundleMaintainRequest_sync_V1>
<BasicMessageHeader>
<!-- <UUID>?</UUID> --> <!-- Idem Potency! -->
</BasicMessageHeader>
<Contact actionCode="06" addressInformationListCompleteTransmissionIndicator="false" relationshipListCompleteTransmissionIndicator="false" isContactPersonForRelationshipListCompleteTransmissionIndicator="false" noteListCompleteTransmissionIndicator="false" responsibleEmployeeListCompleteTransmissionIndicator="false">
<ObjectNodeSenderTechnicalID>1</ObjectNodeSenderTechnicalID>
<ChangeStateID></ChangeStateID>
<InternalID>KH-C11</InternalID>
<IsContactPersonForRelationship actionCode="04" workplaceTelephoneListCompleteTransmissionIndicator="true">
<ObjectNodeSenderTechnicalID>2</ObjectNodeSenderTechnicalID>
<!-- Organisation Account ID -->
<RelationshipBusinessPartnerInternalID>KH-C1</RelationshipBusinessPartnerInternalID>
<MainBusinessPartnerIndicator>true</MainBusinessPartnerIndicator>
<BusinessPartnerFunctionTypeCode></BusinessPartnerFunctionTypeCode>
<BusinessPartnerFunctionalAreaCode></BusinessPartnerFunctionalAreaCode>
<!-- Per default the contact workplace is the corporate main address -->
<!--<WorkplaceBusinessAddressUUID>?</WorkplaceBusinessAddressUUID>
-->
<WorkplaceEmailURI>myworkplaceemail@sap.com</WorkplaceEmailURI>
<WorkplaceTelephone>
<ObjectNodeSenderTechnicalID>3</ObjectNodeSenderTechnicalID>
<FormattedNumberDescription>+49 67227 747474</FormattedNumberDescription>
<MobilePhoneNumberIndicator>false</MobilePhoneNumberIndicator>
</WorkplaceTelephone>
<WorkplaceFunctionalTitleName>Product Manager</WorkplaceFunctionalTitleName>
<WorkplaceDepartmentName>Cloud SME Product Management</WorkplaceDepartmentName>
<WorkplaceBuildingID>WDF</WorkplaceBuildingID>
<WorkplaceFloorID>1</WorkplaceFloorID>
<WorkplaceRoomID>123</WorkplaceRoomID>
</IsContactPersonForRelationship>
</Contact>
</glob:ContactBundleMaintainRequest_sync_V1>
</soapenv:Body>
</soapenv:Envelope>
Delete the contact person relationship between a person and an account. Both business partners stay alive – I only deleted the relationship:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:glob="http://sap.com/xi/SAPGlobal20/Global" xmlns:a00="http://sap.com/xi/AP/CustomerExtension/BYD/A0014">
<soapenv:Header/>
<soapenv:Body>
<glob:ContactBundleMaintainRequest_sync_V1>
<BasicMessageHeader>
<!-- <UUID>?</UUID> --> <!-- Idem Potency! -->
</BasicMessageHeader>
<Contact actionCode="06" addressInformationListCompleteTransmissionIndicator="false" relationshipListCompleteTransmissionIndicator="false" isContactPersonForRelationshipListCompleteTransmissionIndicator="false" noteListCompleteTransmissionIndicator="false" responsibleEmployeeListCompleteTransmissionIndicator="false">
<ObjectNodeSenderTechnicalID>1</ObjectNodeSenderTechnicalID>
<ChangeStateID></ChangeStateID>
<InternalID>KH-C11</InternalID>
<Relationship actionCode="03">
<ObjectNodeSenderTechnicalID>2</ObjectNodeSenderTechnicalID>
<RelationshipBusinessPartnerInternalID>KH-C1</RelationshipBusinessPartnerInternalID>
<RoleCode>BUR001-2</RoleCode>
</Relationship>
</Contact>
</glob:ContactBundleMaintainRequest_sync_V1>
</soapenv:Body>
</soapenv:Envelope>
Helpful blog ...
Do you know of any concrete examples using the Business Partner OData API?
Hi Steve,
you a set of examples using OData to access ByD business partners in my GitHub repository GitHub - ByD API Samples.
Best regards, Knut
Thanks for your attention, Knut. What I was really looking for were examples of calls to OData API_BUSINESS_PARTNER to create business partners and associated contacts.
Hi Steve,
the OData API API_BUSINESS_PARTNER (aka "Business Partner (A2X)") is part of the S/4HANA Cloud package and therefore I would suggest to post the question in the S/4HANA Cloud community.
As quick help, the API descriptions on api.sap.com/api/API_BUSINESS_PARTNER and SAP Help - Business Partner (A2X) (with some examples) may get you a step further.
Best regards, Knut
Thanks, Knut. You raise a good point. Although I am working in S/4HANA HEC, which is basically an on-premise version, still I think the APIs have been in usage for a longer period of time in the S/HANA Cloud version.