Skip to Content
Technical Articles
Author's profile photo Ronald Schertle

Connect to SAP Netweaver in a Jupyter notebook using i-OhJa


In this blog post I want to show how to use our solution called i-OhJa for connecting to SAP Netweaver based systems in Jupyter notebooks.
i-OhJa is a solution based on the SAP Java Connector for being able to interact with SAP Netweaver systems in the application layer. It is written in the Scala programming language and provides wrapper classes for all the basic JCo classes. In addition to that it contains SAP modules specific libraries, servers, conversion and SerDe libraries for different formats and a lot more.
In the following I will show how to use Jupyter notebooks together with i-OhJa to directly interact with an SAP Netweaver system by using the i-OhJa client library and by setting up a simple server instance for getting data in a more stream-oriented way.
Jupyter notebook is a common tool for data scientists to create and share documents, code and reports. We will use the Almond kernel here to execute Scala code directly in Jupyter notebook.


Local installation and usage of python and Jupyter notebook is straight forward and well described on the web. In addition to that you need to install the Almond kernel and download the SAP Java Connector native library (.dll/.so) and Java archive (.jar) from SAP marketplace.

Client connection

i-OhJa includes a SAP BW client library and we will use it to download time tracking data from a BW DataStoreObject. At the end we will aggregate the times per person and display it in a nice and simple bar chart. This will be achieved by implementing the following steps in a Scala notebook:

  1. Load all necessary libraries
  2. Setting up the client connection to a SAP system
  3. Query for time tracking data stored in a standard DSO
  4. Aggregate the data and display it in a Vegas bar chart

Data streams

Getting data as a continuous stream from a SAP system requires to set up a server instance in the notebook itself. In the example shown here we will start a simple server instance that will listen on incoming RFCs issued by a SAP system. The RFC function we will use has a simple signature that allows to send a text together with a timestamp. This function module will be used in a simple ABAP report to send a ‘Hello World’ together with the current timestamp in a loop of 20 iterations to the running i-OhJa server instance in Jupyter.

Figure: ZHELLOWORLD RFC function module

REPORT zhelloworld.

DATA: lv_timestamp TYPE timestampl.


  GET TIME STAMP FIELD lv_timestamp.

      iv_text      = 'Hello World'
      iv_timestamp = lv_timestamp.



Notebook implementation

The following notebook includes the implementation for both scenarios described above.

Almond runs on Ammonite REPL that allows to load managed and unmanaged java archives during runtime. We used it to load the dependencies mentioned in the prerequisites.

Setting up a connection to a SAP system requires to provide some property values like hostname, username and password. This can be done by setting up a secured network connection and single sign on, by implementing a custom destination provider service or by simply passing the properties in the notebook itself.

As you can see in paragraph “Get DSO data” it just takes some seconds to set up the connection to the SAP system and to download a set of nearly 250.000 records. In this simple example we chose to select only two columns: personnel number and duration.

In the last paragraph of the notebook we run a server listening on “Hello World” requests and printing out the request instances in a human readable html format. Almond allows to update the output of a cell and we used this to display only the current requests of the stream. The output will be updated as soon as a new request arrive, which will be the case every 10 seconds.


Jupyter notebook together with i-OhJa provide a simple and yet powerful solution to interactively query and process data coming directly from a SAP Netweaver system. Data Scientists can make use of this solution to build rich reports and dashboards or prototypes on productive data in SAP. The i-OhJa server scenario furthermore enables to display and plot data flowing in as streams in real time.

Assigned Tags

      Be the first to leave a comment
      You must be Logged on to comment or reply to a post.