This blog post is an article from a series of articles on the book published in December 2019 “Blockchain with SAP” (Rheinwerk publishing, Bonn, ISBN 978-3-8362-6914-8). This blog post concerns the seventh chapter from the book, in which the data from a Hyperledger Fabric blockchain is combined with a SAP HANA database to enable structured queries.

One of the highlights of our book “Blockchain with SAP” is the integration of collected transactional data from a blockchain to a SAP HANA database in order to formulate queries, for example, in SQL or to aggregate the blockchain data with other existing data.

The general process here is that the data exported from a blockchain’s blocks are shown as virtual tables in a SAP HANA database entity from where they can be further processed.

The blockchain Application Enablement service

The basis for the integration of blockchain data in a SAP HANA database is the blockchain Application Enablement service. This offers a standardized interface for querying the data from the blockchain for other applications. In combination with the SAP HANA blockchain, it enables the merging of blockchain data and a SAP HANA database.

(c) Rheinwerk Verlag

The SAP HANA blockchain service consists of two components, the…

  • SAP HANA Blockchain Adapter and
  • the SAP HANA Integration Service

The SAP HANA Blockchain Adapter is an SDI connector (smart data integration) for the HANA database. It links to the SAP HANA integration service and transfers the data from the blockchain to the HANA database format.

(c) Rheinwerk Verlag

Connecting the data from the blockchain via the blockchain Application Enablement Service, the SAP HANA integration service, the SAP HANA blockchain SDI adapter, and displaying the data as virtual tables in a SAP HANA database entity.

Activation of the Blockchain Application Enablement

The Blockchain Application Enablement service can be selected in the service marketplace.

(c) Rheinwerk Verlag

It is available for various service plans including the blockchain Hana integration.

(c) Rheinwerk Verlag

After creating the new service entity, it needs to be configured – specifically, this is the setup of the message structures. These are the data structures which describe the translation of the data to be read from the blockchain for the SAP HANA target database:

(c) Rheinwerk Verlag

For this, a previously self-defined data model needs to be translated into a message structure that is to be defined. A ProductOffering of the decentralized energy market was therefore defined in the go program code as follows:

type ProductOffering struct {

ObjectType string `json:"docType"`

//docType is used to distinguish the various types of objects

//in state database

ProductName string `json:"productName"`

Description string `json:"description"`

OfferorID string `json:"offerorId"`

BuyerID string `json:"buyerId"`

Price float32 `json:"price"`

Status int `json:"status"`

Timestamp string `json:"timestamp,omitempty"`


Transferred into the world of message structures for the SAP HANA database, this results in:

(c) Rheinwerk Verlag

The individual attribute names have been retained; only its type has been adjusted to the SAP HANA data types.

Connection architecture

(c) Rheinwerk Verlag

SAP HANA Integration

As a final step, the SDI adapter for the blockchain data is linked to the SAP HANA database and incorporated as an external data source:

(c) Rheinwerk Verlag
(c) Rheinwerk Verlag

Via the credentials, or the access token, the database creates a connection to the blockchain via the adapter. A screenshot is below.

(c) Rheinwerk Verlag

The results are virtual tables with the data from the blockchain which can be incorporated under various aspects (pure user data view, only metadata, mixed view). Below is a screenshot of the ProductOfferings table from the blockchain with the data of offered products.

(c) Rheinwerk Verlag

This table can now be queried and evaluated in SAP HANA using SQL.

More articles of this series can be found here:


Wollen Sie mehr zur SAP Cloud Platform und der Funktionsweise der Blockchains erfahren? In unserem Buch „Blockchain mit SAP“ erläutern wir Ihnen ausführlich die Funktionsweise und demonstrieren Ihnen anhand zahlreicher Beispiele die Vorzüge dieser innovativen Technologie. Eine ausführliche Leseprobe zum Buch stellt der Verlag online bereit.

Would you like to find out more about the possibilities of Hyperledger Fabric for your company? Our book “Blockchain with SAP” gives a detailed explanation of the advantages of the Hyperledger Fabric blockchain integration with SAP HANA. A detailed extract from the book is available online from the publisher.


Recommended articles

Digital Supply Chain

Optimizing Inventory Positions in a Month or Less!

This article shall help readers, especially supply chain managers and BPOs, to understand the idea, which is not a trick! This …

read more
Digital Core

Implementing SAP S/4HANA Cloud with SAP Cloud ALM

To keep up with an accelerating market, we at Camelot recognized the need for a single system lifecycle management process. This …

read more
Supply Chain Management

Key Trends in Demand-Driven Supply Chain Management

The Demand-Driven Radar by CAMELOT Management Consultants illustrates the status quo of Demand-Driven Supply Chain Management. Find our key takeaways in …

read more

Reimagine your Value Chain with us

Contact us