Posts

New Monitor for SAP CPI

After working with SAP CPI for some period of time, I did find it a little difficult to monitor the application. So we decided that we could add a better way to monitor the application and include it into the Figaf IRT application. Because the purpose is to make your usage of SAP Integration easier.

We are reusing the tile concept from SAP CPI, that allows you to create different tiles with different concepts. So you in one screen can see multiply overviews of what is happing on your system. We are using the OData monitoring service that allow us to give users access to data. IRT just work as a proxy and perform the query in real time without saving anything to the Figaf IRT application. We also have the other option and it is really useful for triggering alerts or restart messages.


Up can edit the tiles and write what you want to see in it. You do have the option to select multiply iflows in just one screen, different periods and status. Based on the name IRT then creates two roles on that can view the metadata of the message and one that can view the payloads. It mean that you can give access to tiles for business users. So the people from finace will be able to see all tiles related to finance but not monitor HR. Admins can still monitor everything.

Once you open the monitor you then have the option to view multiply rows in and relavant data in the overview screen. This allow you to search a lot easier for messages with some application id or Receiver.
You can also do filtering in the iflow you have access to already. This way users can only see the data they need.

Check out the easy way of monitoring your SAP CPI flow.

I do believe that this will make it a lot easier to monitor your SAP CPI system. And give access to other users to monitor what is going on in your processes.

You can view my video presentation of it here.

You can try it out IRT/Cloud soon. You can signup already now and start using all the other function there to help improve your SAP CPI development flow. There is a free 30 day trial that you can try for your organisation.

A different way to restart SAP CPI content

It is pretty difficult to restart SAP CPI messages from any external applications. There is just two ways that include either the Enterprise Messaging/JMS or the Datastore. Some times this can create some complex scenarios for the user to develop.

We wanted to make some of the development a little easier. It requires just one groovy script and two script steps in your iflow. We will show a different way that allows you to restart messages in an external application and setup rules for how often it can be reprocessed. We leverage that the Figaf IRT application is able to download messages that have a specific filter like Receiver is LOG. Then the message will be downloaded and you can apply some rules to it like it should be reprocessed 3 times. There is also the option to send notifications to emails or systems like Jira.

Check out the video where you can see how simple it is to restart a SAP CPI message.

We currently do not know how this will affect count of connections on your SAP CPI system, so use with caution.

You can try out Figaf IRT on your own system. We have both a cloud and an on-prem version to deploy the application.

You can see the code below, it will be updated so you can find a more uptodate version in the IRT application.

package com.figaf.irt
import com.sap.gateway.ip.core.customdev.util.Message
import org.apache.camel.converter.stream.InputStreamCache
import groovy.json.JsonOutput
import groovy.json.JsonSlurper
def Message initalSave(Message message) {
    try {
        //Body
        def body = message.getBody(java.lang.String)
        def base64 = body.bytes.encodeBase64().toString()
        Map map = message.getHeaders()
        map.put("body", base64)
        message.getHeaders()
        def json = JsonOutput.toJson(map)
        def cache = new InputStreamCache(json.bytes)
        // we save the json as a property, so we can restore it in the pipeline
        message.setProperty("IRTSAVE", cache)
    } catch (Exception ex) {
        try {
            def messageLog = messageLogFactory.getMessageLog(message)
            messageLog.setStringProperty("CustomLog", ex.getClass().getName() + ":" + ex.getMessage())
        } catch (Exception ignored) {}
    }
    return message
}
/**
 * An error have occurred then save the payload as an attachement
 * @param message
 * @return
 */
def Message savePayload(Message message) {
    try {
        def messageProperties = message.getProperties()
        def ex = messageProperties.get("CamelExceptionCaught")
        if (ex == null) {
            return message
        }
        def irtpayload = message.getProperty("IRTSAVE")
        JsonSlurper jsonSlurper = new JsonSlurper()
        def map = jsonSlurper.parseText(irtpayload.getText())
        map.put("Cause", ex.getClass().getName() + ":" + ex.getMessage())
        irtpayload = new InputStreamCache(JsonOutput.toJson(map).bytes)
        ByteArrayOutputStream bytesOut = new ByteArrayOutputStream()
        irtpayload.writeTo(bytesOut)
        def messageLog = messageLogFactory.getMessageLog(message)
        messageLog.addAttachmentAsString("IRTSAVE", new String(bytesOut.toByteArray()), "application/json")
        message.setHeader("SAP_Receiver", "LOG")
    } catch (Exception ex) {
        try {
            def messageLog = messageLogFactory.getMessageLog(message)
            messageLog.setStringProperty("CustomLog", ex.getClass().getName() + ":" + ex.getMessage())
        } catch (Exception ignored) {}
    }
    return message
}

How to monitor SAP CPI using Figaf IRT

So, how can Figafs Integration Regression Tool help you to optimize your workflow while working on the CPI? You can do a lot of error handling in your flows. It does sometimes mean you will have to spend more time setting up correct error handling in each flow. We want to make it faster for you to develop and deliver your integrations.

In the standard CPI monitoring it is pretty fast to find errors, but if you want to find the iflows you have where there are extra attachments on it becomes more complex. You will have to use the OData interface self.

In Figaf IRT has many cool functions that will make your work a lot easier. IRT allows you to support and monitor all your different systems in one place. If you, for example, have many different kinds of errors in your system, it can be a big challenge to handle all of them, but with IRT you can set up rules, based on criteria of your choice.

A rule is defined with Xpath making it easy to figure out how to set it up with the information. Then you can send data to Jira, Slack or as an Email, then the correct persons can be informed about the error. You also have labels to identify what the error is related to and how critical it is.

In this video  I explain much more about how to monitor SAP CPI using Figaf IRT:

So, you want to try Figaf IRT? It is really easy to get started.

You also have the option to subscribe to our coming Cloud solution for CPI.

The easy way to find IDOCs in the PI monitor

When you are working to help the support of an organization you often find that you need to find the PI message from an IDOC. This can be quite a problem. But it is quite easy. This video shows how it is possible.