Skip to Content
1
Dec 11, 2020 at 09:45 AM

How to update Profit Center in S/4HANA with SOAP service profitcentrereplicationbulkreq?

150 Views

Dear community,

I am trying to update profit centers using the following SOAP API:

SAP Documentation

My communication arrangements are all setup and calls made from SoapUI reach the S/4HANA Message Dashboard. Within the dashboard, we see the error message: Profit Center already exists from 05/18/2020 to 12/31/2030.

Clearly, S/4HANA thinks I want to create the Profit Center, but in fact I want to update the existing one.

The sent payload is as follows:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
   <soapenv:Header/>
   <soapenv:Body>
      <ns3:ProfitCentreReplicationBulkRequest xmlns:ns3="http://sap.com/xi/SAPGlobal20/Global">
         <MessageHeader>
            <CreationDateTime>2020-05-18T00:00:00.000</CreationDateTime>
         </MessageHeader>
         <ProfitCentreReplicationRequestMessage>
            <MessageHeader>
               <CreationDateTime>2020-05-18T00:00:00.000</CreationDateTime>
            </MessageHeader>
            <ProfitCentre actionCode="04" nameListCompleteTransmissionIndicator="false" companyAssignmentListCompleteTransmissionIndicator="true">
               <ID>A00099999</ID> <- Area code + profit center ID
               <BusinessCharacterValidityPeriod>
                  <StartDate>2020-05-18</StartDate>
                  <EndDate>2030-12-31</EndDate>
               </BusinessCharacterValidityPeriod>
               <Name>
                  <Name languageCode="EN">English Name</Name>
                  <Description languageCode="EN">English Description</Description>
               </Name>
               <SegmentAssignment>
                  <SegmentID>1000_S</SegmentID>
               </SegmentAssignment>
               <CompanyAssignment>
                  <CompanyID>4000</CompanyID> <- our actual company code is different
                  <CompanyIdentifierUsageCode>AA</CompanyIdentifierUsageCode>
               </CompanyAssignment>
               <ResponsibleManager>
                  <ResponsibleManagingEmployeeID/>
                  <FormattedName>Kevin Dekker</FormattedName>
               </ResponsibleManager>
            </ProfitCentre>
         </ProfitCentreReplicationRequestMessage>
      </ns3:ProfitCentreReplicationBulkRequest>
   </soapenv:Body>
</soapenv:Envelope>

When I do not send one of the nodes 'ResponsibleManager, CompanyAssignment, or SegmentAssignment' I get the notification in the message dashboard: "not all required fields are filled". Another indication that the API expects me to create a new rather than update an existing profit center. I have tried to leave out the action code and filling it with a space, resulting in the same error: "profit center already exists from ..."

The same method / message structure worked for me with cost center updates. I must be doing something wrong, but haven't found out what it is.

Does anyone know how to update a profit center using this S/4HANA SOAP API?

Thanks in advance!