Skip to Content
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>
1 Comment
You must be Logged on to comment or reply to a post.