SAP MII connection to External HANA database
SAP MII (Manufacturing Integration and Intelligence) is a very powerful tool provided by SAP to connect shop floor systems (PLC / SCADA / Historians) to ERP (SAP ECC / SAP S/4 HANA). By such seamless integration between shop floor and ERP systems, it provides customers better visibility in terms of manufacturing production and it helps in reducing operational costs by providing various dashboards, KPI monitoring and visual representation of machine data. In today’s world where everyone is talking and researching about IoT and the massive amount of data that any manufacturing company is going to deal with, the expectation from the SAP MII customers is to handle huge volume of time-series and tabular data collected from operations/PLCs at the manufacturing plants to perform long-term trend and regression analysis on it near real time. Moreover, customers also want to predict and prevent operational issues such as machine downtimes, material quality and performance bottlenecks in production lines.
MII in its traditional architecture usually has its own Netweaver database and an external database (commonly known as Application Database) where most of transaction data and certain master data is stored. In this blog, we are solely going to concentrate on external application database that MII connects to. Before the birth of HANA database, MII generally had MS SQL or Oracle as its application database. But looking at the computing power of HANA database and its massively fast i/o operations, customers are demanding HANA as their external database that should connect to MII for all the transaction data and analytics.
There are many ways MII can connect to external HANA database but we are going to learn how to connect to HANA database using JDBC API.
SAP HANA provides a driver that enables Java applications to connect to the SAP HANA database with the JDBC application programming interface (API). To install JDBC driver for HANA, please follow these two very detailed and informative blogs:
- https://help.sap.com/doc/0eec0d68141541d1b07893a39944924e/2.0.01/en-US/ff15928cf5594d78b841fbbe649f04b4.html
- https://www.sap.com/developer/how-tos/2016/08/hxe-connect-hxe-using-jdbc.html
Now once we have a confirmation that HANA database has JDBC driver installed and configured,we can perform belowsteps in MII to connect to HANA database.
- Go to Data Sevices / Data Servers :
2. Click on Create and below screen will be shown:
- Provide Server Name – Any meaningful name
- Connector Type: IDBC (As we are going to use JDBC connection, connector type would be IDBC)
- Description: Meaningful Description
- Click on Finish
3. Provide Server Details and other information (Critical Step) :
a. Check “Enabled” & “Allow Dynamic Query” Checkboxes in Settings tab:
b.Open Connection Tab:
- JDBC Driver: com.sap.db.jdbc.Driver
- Server URL:
jdbc:sap://<server>:<port>[/?<options>] where <port> should be 3<instance number>15
Lets say Server name in MySERVER101.com & HANA Database instance is 01.Then Server URL would be: jdbc:sap://MySERVER101.com:30115/?autocommit=false
- User Name: User Name of the HANA Database
- Password: Password of the HANA Databse
- Validation Query: Select ‘Hello World’ from Dummy
If we have provided all the correct information then if we go to Status tab, we can see ‘Running’ Status:
4. Open MII Workbench, select New SQL Query and newly created data server External-HANA-DB will appear in Available Servers:
5. We can see all the tables and can query them:
Please note that by directly querying HANA database tables via MII SQL Query will not give us any benefits that HANA’s in-memory database management provides. Hence optimal way to perform this activity is to create tables in HANA as columnar tables and then define the Attribute views (fact tables), Analytic views (measure and dimensions) and Calculation views (complex calculations and data processing). Then MII SQL Query can directly query these views and can enjoy all of the HANA benefits.
I hope information provided in this blog proves useful to you.
Thanks.
Hi Soham,
Apart from Pulling data from MII and Pushing to HANA DB is there any other way where in we can directly get the events from machine and Push into HANA DB directly.
If yes please let me know the alternative. Looking forward for your reply.
Regards,
Shekar.
Hi Shekar, take a look at this document, I think is what you are looking for.
https://archive.sap.com/documents/docs/DOC-69597
regards
Andrea
Hi Andrea,
In this document they are retrieving Data from SAP MII and Pushing into HANA DB.
But my scenario is I need to collect the machine events directly from the machines with help of sensors attached to the machines.
Regards,
Shekar.
Hi Shekar,
If you need to collect the machine events then you may ave to use SAP PCo (Plant Connectivity) which comes bundled with SAP MII license. SAP PCo has many source systems which PCo can connect to and can send notifications to MII BLS.
SAP PCo:
https://help.sap.com/saphelp_pco23/helpdata/en/e5/0481c78f50441a8df23c8e548063fa/frameset.htm
Thanks,
Soham
Hi,
I have just seen your question.
First of all, you can only pull data from PCO. As far as i know, there is no push mechanism. PCO is like a web service to read data, that you read with a scheduled task. On MII workbench, you tie your pco call to a rfc and trigger events on SAP via RFC + you can save/process data as you like.
or :), dont use MII and create your own opc that calls web api, rfc or a web service whenever data changes. But then you will have some licensing problems with SAP. SAP wants you to use MII even if it does not fit to your needs ?
I hope that helps.
Cheers
Hi, could this 'external app database' requirement of MII (whether its HANA or anything else) be met by using the same NW Database in a seperate schema? I cannot get a clear answer on this or a support statement from MII / ORA colleagues. We use an oracle database (dont think it matters which database product though)
thx