Technology Blogs by SAP
Learn how to extend and personalize SAP applications. Follow the SAP technology blog for insights into SAP BTP, ABAP, SAP Analytics Cloud, SAP HANA, and more.
cancel
Showing results for 
Search instead for 
Did you mean: 
nicole_bohrmann
Explorer

Introduction


SAP Application Interface Framework allows you to solve tasks in different ways. In my blogs, I provide common ways how these specific tasks can be solved. In my blogs I want to provide common ways how this specific tasks, like Error Forwarding from SAP Cloud Platform to S/4 HANA Cloud Message Monitor can be solved.

In case you have additional topics where it would be nice to have a How-To-Guide, send me a message with the topic request.

Problem Description


Using AIF Monitoring and Error Handling, you can monitor errors that occur in your integration flow in SAP Cloud Platform Integration (CPI).

Up to SAP NetWeaver 7.54 (S/4HANA On-Premise 1909) it was not possible to see the information of technical errors in the S/4HANA Cloud Message Monitor that occur in CPI. Starting with SAP NetWeaver 7.55 (S/4HANA On-Premise 2020), the customers are informed as early as possible about messages with technical errors on CPI.

This document helps you in setting up an integration flow to forward errors from SAP Cloud Platform Integration to SAP Application Interface Framework.

How does it work?


The functionality can be used for an existing integration flow that is sending IDocs or WebServices to an SAP S/4 HANA system, and where the S/4 HANA interface is monitored by SAP Application Interface Framework.

You need to execute the following steps.

  1. Adapt the integration flow in SAP Cloud Platform Integration.

  2. Configure SAP AIF to display cloud integration errors.


Example


Business expects an important order from a key customer but there is a technical error in CPI, so the business has no visibility on order status.

Prerequisites


You have established a connection from SAP Cloud Platform Integration to SAP S/4 HANA using Cloud Connector. For more information on cloud connection, please refer to official documentation for Cloud Connector.

The interface is enabled for monitoring and error handling via SAP Application Interface Framework.

You have execute the WebService Configuration for service Error_Propagation_Request_In (Service Definition: /AIF/ERROR_PROPAGATION_REQUEST) in the SOA Manager (Transaction SOAMANAGER).

Preparation


In order to execute this example, you require an existing integration flow that is sending WebServices or IDoc to SAP S/4 HANA system and this WebService or IDoc interface is monitored by SAP Application Interface Framework. In this example, I’m using an easy SOAP to SOAP RM integration flow scenario. The example integration flow will be enhanced by an exception subprocess that will be triggered by an erroneous groovy script.

.


Adapt the Integration Flow in SAP Cloud Platform Integration


The integration flow modification can be decomposed into two substeps:

  • Deploy S/4HANA credentials on SAP Cloud Platform Integration.

  • Enhance the integration flow to forward errors to the AIF Message Monitor.


Deploying SAP S/4 HANA Credentials


In order to successfully establish a connection between the S/4HANA System and Cloud Integration, you must deploy the credentials that you use to login to the S/4HANA system. You use the Cloud Integration Web UI, Operations view section (Manage Security --> Security Material tile). The integration flow uses these credentials for establishing a connection when the error is being forwarded to the S/4HANA system. Here's how you can do that:

  • Login to SAP Cloud Platform Integration.

  • Access the Operations

  • Choose the Security Material tile

  • Choose Add > User Credentials

  • Specify the following details:





















Field Description
Name Provide a name for the credentials you are deploying. Please note that the same credential name must be referred to in the integration flow as well.
User The SAP S/4 HANA technical user to access the webservice (must have role SAP_INTNW_WEBSERVICE in SAP S/4 HANA system).
Password Password of the SAP S/4HANA technical user.


  • Choose Deploy


Customize Integration Flow to Forward Errors to SAP S/4 HANA


As the objective is to forward errors to AIF, we will use the Exception Subprocess integration flow step. This subprocess is triggered when the integration flow encounters an error. We will configure the subprocess to adapt the error to be readable by AIF using Content Modifier and forward the error to SAP S/4 HANA system using External Call.

  • Navigate to your integration flow and choose Edit to start editing it.

  • From the palette (Process submenu), select Exception Subprocess and place it in the integration flow as shown below.




  • In the Exception Subprocess shape, remove the End 1 event and replace it with Error End from Events submenu in the palette. This is done to ensure the integration flow will show up as status Failed in the Cloud Integration Monitoring.

  • Add a Content Modifier shape to the integration flow (from the Message Transformers subsection of the palette).




  • Select the Content Modifier and in the Properties sheet, choose Exchange Property. Choose Add and add these properties:



































Action Name Type Value
Create AIF_Namespace Constant <AIF Namespace, e.g. ORDERS>
Create AIF_Interface_Name Constant <AIF Interface Name, e.g. ORDERS05>
Create AIF_Interface_Version Constant <AIF Interface Version, e.g. 1>
Create Cloud_Integration_Tenant_Name Constant <CPI Tenant Name, e.g.. c1234>


  • In the Message Body tab, in the Type dropdown, choose Expression. In the Body field, paste the corresponding code snippet:


<aba:Error_Propagation_Request xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:aba="http://aif.com/EP">
<MessageProcessingLogID>${property.SAP_MessageProcessingLogID}</MessageProcessingLogID>
<MplCorrelationID>${property.SAP_MplCorrelationId}</MplCorrelationID>
<ApplicationID>${header.SAP_ApplicationID}</ApplicationID>
<TenantName>${property.Cloud_Integration_Tenant_Name}</TenantName>
<IFlowID>${camelId}</IFlowID>
<Namespace>${property.AIF_Namespace}</Namespace>
<InterfaceName>${property.AIF_Interface_Name}</InterfaceName>
<InterfaceVersion>${property.AIF_Interface_Version}</InterfaceVersion>
<ErrorMessage>${exception.message}</ErrorMessage>
</aba:Error_Propagation_Request>


  • In case the Message ID in the SOAP Header is filled, you have to delete the Message Header in the integration flow Exception Subprocess. Add second Content Modifier to the integration flow.




  • Select the Content Modifier and in the Properties sheet, choose Header. Choose Add and add these properties:























Action Name Type Value
Delete SapMessageIdEx Constant
Delete SapMessageId Constant


  • Add the Send step in the Exception Subprocess as illustrated in the next step (you find this step type in the Call --> External Call submenu of the palette).

  • Add a Receiver to the Exception Subprocess.




  • When you connect the Send step to the Receiver, an adapter selection prompt appears. Choose SOAP -> SAP RM and enter the following values in the Connection tab of SOAP adapter properties view.

























Field Description
Address

http://<system>:<port>/sap/bc/srt/xip/aif/error_propagation_request/<client>/<service_name>/<binding...;

(System and port of your SAP S/4HANA system)
Proxy Type On-premise (for SAP Cloud Connector) / Internet (without SAP Cloud Connector)
Authentication Basic
Credential Name Name of the credentials that you deployed (see Deploying SAP S/4 HANA Credentials)


  • Save and deploy your integration flow.


 

Configure the Message Monitor to Display Cloud Integration Errors


To display the errors from SAP CPI in AIF, a customer-specific engine has to be defined and specified for the desired interface. Currently, you can only forward errors to IDoc and WebService interface.

The configuration can be decomposed into two substeps:

  • Define Custom Engines.

  • Specify Interface Engines.


Define Custom Engines



  • Login to the SAP S/4HANA Backend System

  • Go to AIF Customizing (Transaction /AIF/CUST)

  • Go to Interface Development -> Additional Interface Properties -> Define Custom Engines.

  • Choose a namespace for the custom engine.

  • Select New Entries.

  • Define the following classes for the engines based on whether you are forwarding the errors to an IDoc or a WebService interface
































Interface Engine  
IDoc Application Engine /AIF/CL_APPL_ENGINE_CPIIDOC
Persistence Engine /AIF/CL_PERSIST_ENGINE_CPIIDOC
Logging Engine /AIF/CL_LOGGING_ENGINE_CPIIDOC in case of IDoc Status Records are used
WebService Application Engine /AIF/CL_APPL_ENGINE_CPIWS
Persistence Engine /AIF/CL_PERSIST_ENGINE_CPIWS


  • Save changes


Specify Interface Engines



  • Go to AIF Customizing (Transaction /AIF/CUST)

  • Go to Interface Development -> Additional Interface Properties ->Specify Interface Engines

  • Choose your interface namespace.

  • For the interface you want to monitor, define the following engines:

    • Application Engine: 999 - Customer-Specific

    • NS: <the namespace of previously defined custom engine>

    • Customer-Specific AIF Engine: <the name of the previously defined custom engine>

    • Persistence Engine: 999 - Customer-Specific

    • NS: <the namespace of previously defined custom engine>

    • Customer-Specific AIF Engine: <the name of the previously defined custom engine>

    • Selection Engine: 0 - AIF Index Table

    • NS: <leave empty>

    • Customer-Specific AIF Engine: <leave empty>

    • Logging Engine: 0 - AIF Application Log

    • NS: <leave empty>

    • Customer-Specific AIF Engine: <leave empty>

    • or in case of IDoc Status Records are used

    • Logging Engine: 999 - Customer-Specific

    • NS: <the namespace of previously defined custom engine>

    • Customer-Specific AIF Engine: <the name of the previously defined custom engine>



  • Save changes


Activating Error Propagation Monitoring



  • Go to transaction /AIF/CONTENT_EXTRACT.

  • Execute the program for Deployment Scenario SAP_COM_0477.

  • Go to transaction /AIF/MYRECIPIENTS and assign your user to recipient RECIPIENT_ERROR_PROPAGATION within NS: /AIFEP.


Testing


To test the CPI Error Forwarding to SAP S/4HANA Message Monitor, you have to send new messages with technical errors that occur in CPI.

Open the Message Dashboard application and select your SAP S/4HANA interface. Jump into the detailed Monitoring and Error Handling view and select a message in the Data Message view.

In the Log Messages section, you can display the integration flow parameters (MessageProcessingLog ID, MPL Correlation ID, SAP Application ID, Tenant Name, Error Message) by clicking on the Information Message(s) icon.



Note:

  • Cloud Integration errors are classified as Technical Errors (Status “A”).

  • For Cloud Integration error messages, no Restart is possible. Only the Cancel functionality is available.

  • For Cloud Integration error messages, no display of payload data is supported.


Further information on how to enable users to monitor messages via the message dashboard in the SAP S/4HANA, take a look at the blog: How to enable users to work with the message dashboard.

Summary


This blog post gave an introduction on how to setup Error Forwarding to S/4HANA Message Monitor. This is a very simple enhancement and therefore not all possible options on how to use the new Integration are described here.

Note: The functionality is available in SAP S/4 HANA Cloud 2005 and SAP S/4 HANA on-premise 2020 SP00.
3 Comments