Problem Description
Within SAP Application Interface Framework (AIF) Monitoring and Error Handling it is possible to monitor errors that occur in your Integration Flow in the SAP Cloud Platform Integration (CPI).
Up to SAP NetWeaver 7.79 (SAP S/4HANA Cloud 2002) it was not possible to see the information of technical errors in SAP S/4HANA Cloud Message Monitor that occur in CPI. Starting with SAP NetWeaver 7.80 (SAP S/4HANA Cloud 2005), 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 error 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 SAP S/4HANA system and the SAP S/4HANA interface is monitored by SAP Application Interface Framework.
The following steps must be executed.
1. Adapt the integration flow in SAP Cloud Platform Integration
2. Configure Message Monitor 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
Authorization
To be able to work with extensibility apps, your user needs business roles that are authorized for the corresponding business catalogs
Business Catalog Name | Business Catalog ID | Description | Supported Applications |
Communication Management | SAP_CORE_BC_COM | This business catalog enables users to maintain inbound and outbound communication with remote systems. |
Communication Arrangements Communication Systems Display Communication Scenarios Maintain Communication Users Maintain SAP Cloud Platform Extensions |
Communication Management – Message Monitoring Configuration | SAP_CA_BC_COM_CONF_PC | This business catalog enables you to configure the monitoring and error handling environment for these cross-system interfaces. You can, for example, define which users are responsible for which interfaces and which types of log messages the users shall see. | Assign Recipients to Users |
Communication Management – Message Monitoring and Error Handling | SAP_CA_BC_COM_ERR_PC | This business catalog enables you to get an overview of these cross-system interfaces and their data messages. You can, for example, analyze the root causes of errors, restart or cancel data messages. | Message Dashboard |
After having assigned your business roles with the right catalog authorizations you’ll have the needed applications on your Home Page within the Communication Management group and Message Monitoring group.
Preparation
In order to execute this example, you require an existing integration flow that is sending WebServices to SAP S/4HANA system and this WebService 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 contain an exception subprocess that will be triggered by a groovy script simulating an error.
Adapt the integration flow in SAP Cloud Platform Integration
The integration flow modification can be broken down into two substeps:
- Deploying SAP S/4HANA credentials on SAP Cloud Platform Integration
- Customize integration flow to forward errors to Message Monitor
Deploying SAP S/4HANA Credentials
In order to successfully establish a connection between SAP S/4HANA System and SAP Cloud Platform Integration, you must deploy the credentials that you use to login to the SAP S/4HANA system in the SAP Cloud Platform Integration security material. The integration flow will use the same credentials for establishing a connection when the error is being forwarded to SAP S/4HANA system. Here’s how you can do that:
- Login to SAP Cloud Platform Integration.
- Access the “Operations”
- Access the security material section by choosing the “Security Material”
- 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 used in the integration flow as well. |
User | The SAP S/4HANA technical user to access the webservice (must have role SAP_INTNW_WEBSERVICE in SAP S/4HANA system). |
Password | Password of the SAP S/4HANA technical user. |
- Choose Deploy
Customize Integration Flow to Forward Errors to SAP S/4 HANA Cloud
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/4HANA system using “External Call”.
- Navigate to your integration flow and choose Edit to start editing it.
- From the palette, select Exception Subprocess and place it in the integration flow as shown below.
- In the Exception Subprocess, delete End 1 and replace it with Error End from Events in palette. This is done to ensure the integration flow will show up as status Failed in the Cloud Integration Monitoring.
- Add Content Modifier to the integration flow.
- 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 a 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.
- Add a Receiver to the Exception Subprocess.
- When you connect the Send step to the Receiver, an adapter selection prompt will appear. Choose SOAP adapter and enter the following values in the Connection tab of SOAP adapter properties view.
Field | Description |
Address |
http://<system>:<port>/sap/bc/srt/scs_ext/aif/error_propagation_request (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/4HANA Credentials) |
- Save and deploy your integration flow.
Configure Message Monitor to Display Cloud Integration Errors
In order to use the Error Forwarding in SAP S/4HANA Cloud, the Communication Arrangement for Communication Scenario SAP_COM_0477 must be activated and can be broken down into three substeps:
- Setup Inbound Communication User
- Create Communication System
- Create Communication Arrangement for Communication Scenario SAP_COM_0477
Setup Inbound Communication User
- Login to SAP S/4HANA Cloud System and select “Communication Management” group
- Select tile “Maintain Communication User” and click button “New”
- The page “Create Communication User” will be displayed, fill up the User Name, Description & Password and click ‘Create’
Note: Here we would use basic authentication. Alternatively there is a way to authenticate via certificate if API has to be consumed by a different target system.
- Once you click ‘Create’, the Password Status would become Productive. Now click ‘Save’.
Create Communication System
- Login to SAP S/4HANA Cloud System, select ‘Communication Management’ group
- Select tile “Communication System”
- Click ‘New’ to create a new Communication System.
- Enter a System ID and System Name and click ‘Create’
- Give Host Name and HTTPS Port of the system you want to connect to.:
- Click ‘Add’ button for inbound communication to add the user for authenticating inbound request
- Select the Communication User (from value help) which we had just created and Click ‘OK’
- In the section “Cloud Connector” put the switch for Access using SAP Cloud Platform Cloud Connector to “ON”.
- Click button “OK”. Click button “Save” and the Communication System is created
Create Communication Arrangement
- Login to SAP S/4HANA Cloud System, select ‘Communication Management’ group
- Select tile “Communication Arrangements”
- Click “New” to create a new Communication Arrangement,
- The page “New Communication Arrangement” will be popped up, select Communication Scenario SAP_COM_0477 from the value help, fill up the Arrangement Name and click “Create”.
- The page “Communication Arrangements” will be displayed. Select the ‘Communication System’ (from value help) which we have just created. The assigned Communication User will now automatically appear in User Name field.
- Click “Save”. The Communication Arrangement is now created successfully.
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