Posts

Lessons learned while implementing SAP CPI and API management: Webinar

I held a webinar, where I talked about my experiences with SAP CPI and API management projects. And what you should remember when implementing it.

I cover some of the lessons that I had to have on the project. Like the flexibility of the platform allow you to be more agile with creating development. You can always add new paths to the processing to send results to other areas. We also touch on the use of the ProcessDirect adapter that allows you to refactor your integration for reuse. I cover my latest blog where I have talked about Calculating Fibonacci number in CPI, by the way not recommend by gives some lessons.

I have a SAP CPI course that you can take to get you started with CPI learn more

There are also some lessons for API management. It is really great for exposing Odata from your SAP Gateway and securing it pretty easy. There is some challenge with calling other scripts in javascript, so it is somewhat limited what you can do in it. API Management also has some problems with regards to transportation and documentation of changes.

With the Figaf tool you can:

  • Get a better understanding of what is developed and changed
  • Transport and documenting individual iflows
  • Monitor your CPI and set up integration with Slack, Jira
  • I will speed up your development because you will have the option to run
  • Manage your SAP PI/PO, CPI and API Management

Try the Figaf IRT tool here.

Here you can watch the replay:

As you can see, Figaf IRT can help you to optimize your workflow. If you have any questions, please contact me.

You can view the presentation here.


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
}

IRT Transporting – Improve your SAP CPI life

In this blog, I will cower how IRT Cloud will improve the way you work with transporting.

Before we get started, we need to find a clear definition of what “DevOps” are. According to wikipedia it goes like this:

DevOps is a set of software development practices that aim to shorten the systems development life cycle while delivering features, fixes and updates frequently in close alignment with business objectives

Understand what is changed

Track what object is being changed
– Is it a part of the BPMN model
– Is it scripts or mappings
– Is it configuration which is changed

Register changes with business reason

Make a service request in the IRT tool, that allow you to link the changes to the reason.

User can assign changes in iFlows to it:

Test the changes

With the build in testing tool you are able to test the modification you make does not not affect anything unexpected.

You can document what test you have run and the result of them.

iFlow configuration in the landscape

Configure an iflow once and then let IRT handle configuration in the landscape once importing the change:

Transport individual

Be able to import changes into target system. Figaf will import the object into the target system. Then configuration will be applied:

Check out the demo

So, I if want to check out how this work, please take a look at the demo video below:

So, I you ready to try Figaf IRT/Cloud to see, what IRT/Cloud can do for you? I offer a 30 days free trial at https://figaf.com/IRTCloud.