Skip to Content
Author's profile photo Scott Maynard

Building A Logistics App With SAP Leonardo And Blockchain

In recent memory, nothing has made such a stir as the development of hardware and software that can be used in the Internet of Things (IoT). Not to be outdone, SAP has released SAP Leonardo, their technological framework for use with blockchains, machine learning, and IoT. Combining this framework with Mendix, we can develop a logistics app that can utilize all the best cutting-edge advances in technology in these fields while at the same time providing an app that works seamlessly across a global enterprise network. In order for us to build a fully-functional app with SAP Leonardo and the blockchain, we have to see how each of these parts are going to be used in our app construction.

As part of the Mendix technical strategy and research and development team, I helped develop the SAP Cloud Platform and Mendix partnership which has so far built two applications using the Mendix Platform. But how did we build these applications? What services did we use? In this blog post, we will uncover what it took to build the connected logistics app.

The Blockchain

While many of us are familiar with the idea of distributed ledgering across multiple systems via the blockchain, we tend to overlook another of the very creative uses of the blockchain in developing and enforcing smart contracts. Smart contracts are agreements that automatically check to see if certain conditions are met and then perform actions on those conditions. For example, in the case of a logistics app, if delays in shipping were to dynamically occur due to unforeseen accidents (like say a blown tyre on a transport truck) the delivery system and the receiving client can be updated automatically to the location and estimated delay. The immutability of blockchain is perfect for setting up and fulfilling smart contracts since it ensures that once a contract is struck it can’t be altered and the conditions must be met for the contract to be fulfilled. SAP blockchain is SAP’s framework for developing a blockchain and using this we can easily create chaincode (which defines the basic functions of the blockchain such as querying or invoking) and run it on the SAP blockchain service. The SAP blockchain is based on an open source platform known as Hyperledger Fabric which is not used in any cryptocurrency. Adding a block to the chain is a simple matter of utilizing Mendix’s native REST capabilities to develop a microflow for adding a single block to the chain. The API’s for both SAP blockchain and Mendix can be assigned in the SAP service cockpit.

The Internet of Things – Building with SAP Leonardo

Basically, from a programmer’s perspective, the IoT turns everyday objects into smart object – sort of like classes that know a little bit of information about themselves. For us to utilize the SAP IoT framework, we must first connect to it using MQTT or alternatively, REST protocols. If we use the apps from the Mendix App Store we can seamlessly build integration of Mendix with the SAP IoT platform. The smart objects (crates, boxes etc.) would send real-time, real-world information into the IoT platform which can then be serialized and forwarded to our own custom designed system to parse and output that serialized data in a human-readable format. Using Mendix, we can set a microflow to bundle up that incoming data into a JSON packet that can be sent directly to our processing system for output.

 S/4 HANA and the SAP Cloud Platform

S/4 HANA is one of the most robust and easily adaptable database management solutions available for large enterprises. Mendix integration is easy with free apps allowing the incorporation of purchase information from an S/4 HANA database into our logistical app so we can have details on customer information directly available to forward necessary updates to the client. The Cloud Platform provided by SAP allows us to run the app on the cloud and take advantage of the business application and in-memory database technology that SAP has already implemented. We first start by choosing a SAP-enabled site template by hitting the “Create App” button. Authentication with the SAP Cloud Platform will follow. After authentication we will have the option to choose which region we are deploying to. Once these details are completed, we can then hit the “Run” button in the app on our Desktop Modeler which will make the app stage then deploy onto the cloud. For existing apps, the Cloud Settings (located under General Settings) can aid us to deploy the app to the cloud and make use of its services. Once the app is deployed, HANA, blockchain, etc. can easily be added to the app without having to rebuild it.

Application Development with SAP Leonardo

This demonstrates one of the most exciting parts of working with the IoT, the ability to build an app that utilizes the data generated by the interconnectivity of objects. This has multiple uses, from spotting lags in the logistics network, to developing means of tracking and improving product delivery across wide geographical delivery areas. SAP Leonardo, with a little help from Mendix, is ideal for developing a logistical tracking application with a minimum of fuss.

Assigned Tags

      1 Comment
      You must be Logged on to comment or reply to a post.
      Author's profile photo Vijaya Kumar Malyavantham
      Vijaya Kumar Malyavantham

      Thanks Scott, It’s a great blog which provides high level architecture on implementing Blockchain. As far hyperledger is considered do you use hyperledger composer tool for development?

      Regards - vijay