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.

 

SAP S/4 Transformation: Survey on Expectations

The study "Expectations on S/4HANA in 2022" by techconsult and CamelotITLab shows possible painpoints in any migration and how they can be avoided. With data from 200 companies in Germany.

Download the complete study here

Recommended articles

Digital Core

Next Level Reporting using SAP Analytics Cloud

How to bring reporting to the next level – everyone is talking about AI, Data Science and Machine Learning, but how to …

read more
New Now in Organizations

Interns Matter – Experiences from Our Chemicals Team

CAMELOT offers students an opportunity of gaining their first practical experience via internships to help them firm up their ideas about …

read more
Innovation

SAP Analytics Cloud to Replace BPC?

Any company that has faced the tasks of aligning enterprise processes with business strategy to pursue sufficient enterprise planning with SAP …

read more

Reimagine your Value Chain with us

Contact us