Enterprise Resource Planning Blogs by SAP
Get insights and updates about cloud ERP and RISE with SAP, SAP S/4HANA and SAP S/4HANA Cloud, and more enterprise management capabilities with SAP blog posts.
cancel
Showing results for 
Search instead for 
Did you mean: 
susanne_zeller2
Employee
Employee
You are using the SOAP API “Service Confirmation - Create, Change (Asynchronous)” and are creating duplicate service confirmations. This can happen if the same request for the creation of a service confirmation is sent twice and the request doesn’t contain a differentiator.

Solution:

There are three fields that you can use to ensure that your requests are unique:

ExtServiceConfirmation and

ExternalDocLastChangeDateTime on header level, and

ExtServiceConfirmationItem on item level.

If the value in the field ExtServiceConfirmation in a create request, is identical to a request that was processed previously, the system rejects the request. This also applies to the field ExtServiceConfirmationItem. For the duplicate check to work correctly, you should also fill the field ExternalDocLastChangeDateTime.

In a change request, the value in field ExternalDocLastChangeDateTime must be higher than the timestamp of the previously processed request for the same object.

Remark: The fields are also available in the outbound requests: Service Confirmation - Confirm Processing (Asynchronous) and Service Confirmation - Notification Processing (Asynchronous).

Creating service confirmations


To avoid duplicates during creation, it is necessary to fill field ExtServiceConfirmation with a unique ID and ExtServiceConfirmationItem with a unique number on item level.

Remark: ExtServiceConfirmation must be unique across the system. ExtServiceConfirmationItem must be unique within a service confirmation.

Example: Create request - Same request is sent twice


Request payload:
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" 
xmlns:s4c="http://sap.com/xi/S4CRM/">
<soap:Header/>
<soap:Body>
<s4c:ServiceConfirmationRequest>
<MessageHeader>
<CreationDateTime>2018-11-13T12:00:00.1234567Z</CreationDateTime>
</MessageHeader>
<ServiceConfirmation actionCode="01">
<ServiceConfirmationType>SVC1</ServiceConfirmationType>
<ServiceConfirmationDescription languageCode="EN">sample
</ServiceConfirmationDescription>
<ReferenceServiceOrder>8000241542</ReferenceServiceOrder>
<ExtServiceConfirmation>Z21022601</ExtServiceConfirmation>
<ExternalDocLastChangeDateTime>2021-02-26T12:20:00.1234567Z
</ExternalDocLastChangeDateTime>
<Item actionCode="01">
<Material>SRV_01</Material>
<Quantity unitCode="hur">0.4</Quantity>
<ServiceDuration unitCode="hur">0.4</ServiceDuration>
<SrvcContrDetnIsSpprsd>1</SrvcContrDetnIsSpprsd>
<ReferenceServiceOrderItem>10</ReferenceServiceOrderItem>
<ExtServiceConfirmationItem>100</ExtServiceConfirmationItem>
</Item>
</ServiceConfirmation>
</s4c:ServiceConfirmationRequest>
</soap:Body>
</soap:Envelope>

System behavior: If you send this request twice, the first request is processed and a service confirmation in SAP S/4HANA  is created. The second request is rejected with error message “Can't use ext. service conf. ID Z21022601 to create another service conf..”

Example: Create request - Two requests with different ExtServiceConfirmation


The difference between the two requests is the ID in ExtServiceConfirmation.

Payload of the first request:
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" 
xmlns:s4c="http://sap.com/xi/S4CRM/">
<soap:Header/>
<soap:Body>
<s4c:ServiceConfirmationRequest>
<MessageHeader>
<CreationDateTime>2018-11-13T12:00:00.1234567Z</CreationDateTime>
</MessageHeader>
<ServiceConfirmation actionCode="01">
<ServiceConfirmationType>SVC1</ServiceConfirmationType>
<ServiceConfirmationDescription languageCode="EN">sample
</ServiceConfirmationDescription>
<ReferenceServiceOrder>8000241542</ReferenceServiceOrder>
<ExtServiceConfirmation>Z21022601</ExtServiceConfirmation>
<ExternalDocLastChangeDateTime>2021-02-26T12:20:00.1234567Z
</ExternalDocLastChangeDateTime>
<Item actionCode="01">
<Material>SRV_01</Material>
<Quantity unitCode="hur">0.4</Quantity>
<ServiceDuration unitCode="hur">0.4</ServiceDuration>
<SrvcContrDetnIsSpprsd>1</SrvcContrDetnIsSpprsd>
<ReferenceServiceOrderItem>10</ReferenceServiceOrderItem>
<ExtServiceConfirmationItem>100</ExtServiceConfirmationItem>
</Item>
</ServiceConfirmation>
</s4c:ServiceConfirmationRequest>
</soap:Body>
</soap:Envelope>

Payload of the second request:
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" 
xmlns:s4c="http://sap.com/xi/S4CRM/">
<soap:Header/>
<soap:Body>
<s4c:ServiceConfirmationRequest>
<MessageHeader>
<CreationDateTime>2018-11-13T12:00:00.1234567Z</CreationDateTime>
</MessageHeader>
<ServiceConfirmation actionCode="01">
<ServiceConfirmationType>SVC1</ServiceConfirmationType>
<ServiceConfirmationDescription languageCode="EN">sample
</ServiceConfirmationDescription>
<ReferenceServiceOrder>8000241542</ReferenceServiceOrder>
<ExtServiceConfirmation>Z21022602</ExtServiceConfirmation>
<ExternalDocLastChangeDateTime>2021-02-26T12:20:00.1234567Z
</ExternalDocLastChangeDateTime>
<Item actionCode="01">
<Material>SRV_01</Material>
<Quantity unitCode="hur">0.4</Quantity>
<ServiceDuration unitCode="hur">0.4</ServiceDuration>
<SrvcContrDetnIsSpprsd>1</SrvcContrDetnIsSpprsd>
<ReferenceServiceOrderItem>10</ReferenceServiceOrderItem>
<ExtServiceConfirmationItem>100</ExtServiceConfirmationItem>
</Item>
</ServiceConfirmation>
</s4c:ServiceConfirmationRequest>
</soap:Body>
</soap:Envelope>

System behavior: Two service confirmations in SAP S/4HANA are created.

Changing service confirmations


To avoid processing of the same change request twice, fill the timestamp field ExternalDocLastChangeDateTime.

Example: Change request - Same request is sent twice.


Request payload:
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" 
xmlns:s4c="http://sap.com/xi/S4CRM/">
<soap:Header/>
<soap:Body>
<s4c:ServiceConfirmationRequest>
<MessageHeader>
<CreationDateTime>2018-11-13T12:00:00.1234567Z</CreationDateTime>
</MessageHeader>
<ServiceConfirmation actionCode="02">
<ServiceConfirmationDescription languageCode="EN">sample 2
</ServiceConfirmationDescription>
<ExtServiceConfirmation>Z21022602</ExtServiceConfirmation>
<ExternalDocLastChangeDateTime>2021-02-26T12:20:00.1234567Z
</ExternalDocLastChangeDateTime>
</ServiceConfirmation>
</s4c:ServiceConfirmationRequest>
</soap:Body>
</soap:Envelope>


System behavior: If you send the request twice, the first request is processed and the service confirmation with external ID Z21022602 is changed. The second request is rejected with the error message: “The timestamp in the ext. doc. is older than the last changed timestamp.”

 

Example: Change request -  Two requests with different timestamp


The difference between the two requests is timestamp in ExternalDocLastChangeDateTime.

Payload of the first request:
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" 
xmlns:s4c="http://sap.com/xi/S4CRM/">
<soap:Header/>
<soap:Body>
<s4c:ServiceConfirmationRequest>
<MessageHeader>
<CreationDateTime>2018-11-13T12:00:00.1234567Z</CreationDateTime>
</MessageHeader>
<ServiceConfirmation actionCode="02">
<ServiceConfirmationDescription languageCode="EN">sample 2
</ServiceConfirmationDescription>
<ExtServiceConfirmation>Z21022602</ExtServiceConfirmation>
<ExternalDocLastChangeDateTime>2021-02-26T12:30:00.1234567Z
</ExternalDocLastChangeDateTime>
<Item actionCode="02">
<ServiceDuration unitCode="hur">1</ServiceDuration>
<ReferenceServiceOrderItem>10</ReferenceServiceOrderItem>
<ExtServiceConfirmationItem>100</ExtServiceConfirmationItem>
</Item>
</ServiceConfirmation>
</s4c:ServiceConfirmationRequest>
</soap:Body>
</soap:Envelope>

Payload of the second request:
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" 
xmlns:s4c="http://sap.com/xi/S4CRM/">
<soap:Header/>
<soap:Body>
<s4c:ServiceConfirmationRequest>
<MessageHeader>
<CreationDateTime>2018-11-13T12:00:00.1234567Z</CreationDateTime>
</MessageHeader>
<ServiceConfirmation actionCode="02">
<ServiceConfirmationDescription languageCode="EN">sample 3
</ServiceConfirmationDescription>
<ExtServiceConfirmation>Z21022602</ExtServiceConfirmation>
<ExternalDocLastChangeDateTime>2021-02-26T12:40:00.1234567Z
</ExternalDocLastChangeDateTime>
</ServiceConfirmation>
</s4c:ServiceConfirmationRequest>
</soap:Body>
</soap:Envelope>

System behavior: Both requests are processed in the order of the timestamp and the service confirmation with external ID Z21022602 is changed twice. As a result, the description is changed to “sample 3”.

 

Technical details


Technical name: ServiceConfirmationRequest_In

Communication Scenario: Service Confirmation Integration (SAP_COM_0423)

Supported Operations: SAP_COM_0423 - SERVICE_CONFIRMATION_REQUEST

Scope Items: Service Order Management and Monitoring (3D2)

Business Object: Service Confirmation

Business documentation

 

Summary


By using these fields in your SOAP requests, you make sure that no duplicate service confirmations are created.

For any questions related to the SOAP API “Service Confirmation - Create, Change (Asynchronous)”, please use the “Ask a question” option in the Community Topic “SAP S/4 HANA Cloud for Service”.

I'm looking forward to any feedback and comments about this Blog Post in the Comments section.
1 Comment