Integrating S4HANA and a model factory
This blog post describes a student project in which a model factory was connected to a SAP S/4HANA system. The blog post describes how to connect an on-premise manufacturing execution system (MES) with a SAP S/4HANA instance running on the Google cloud platform. The focus of the blog post is on the required tools, how these tools are related to each other, as well as the necessary programming to achieve the outlined project goal.
As part of a student project my fellow student Meik Kubek and me conducted under the supervision of Christian Drumm (FH-AACHEN) connected a model factory from Lukas-Nuelle GmbH to a SAP S/4HANA trial system. The constraints of the project were to use SAP standard products for the integration wherever possible. Furthermore, the integration should require a minimum of locally installed software besides the proprietary manufacturing execution system (MES) of the model factory. The goal of this integration was to send released production orders from the S/4HANA system to the MES of the model factory. An integration of the material stock or the confirmation of production activities was not part of this initial prototype. In this blog post I will describe the technical details of this integration. The overall system architecture is depicted in the following figure.
The left-hand side of the figure shows the on-premise system including the MES and the model factory. The goal is to connect to this system to a SAP S/4HANA hosted on Google Cloud platform. The S/4HANA system is shown on the right-hand side of the figure. The subsequent sections describe which software and tools were used to realize the described scenario. The remainder of the blog post is structured as follows:
Google Cloud Platform
SAP Cloud Platform
SAP Cloud Appliance Library
SAP Cloud Connector
1. Integration architecture
To integrate the on premise MES with the S/4HANA system running in the Google cloud platform the following software components were used:
- Google Cloud Platform
- SAP Cloud Platform
- Destination (Service of CP)
- WEB IDE (Service of CP)
- SAP Cloud Appliance Library
- SAP S/4HANA
- SAP Cloud Connector
The following figure shows the relationship of the individual software components.
The bottom part of the right-hand side of the figure shows the SAP Cloud Appliance Library (SAP CAL). In the described project the SAP CAL was used to deploy a S/4HANA trail system into the Google cloud platform. In S/4HANA a BAdI was implemented to send data of released production orders to a predefined destination (using a HTTP Post). The central part of the figure shows the SAP cloud platform. Several services of the cloud platform are used in the architecture. The Web IDE is used to create a website to receive and forward our HTTP data to a destination in the SAP Cloud platform. The website basically acts as a proxy forwarding all incoming request to a defined destination. The service destination is the API of the MES running on premise. Using the SAP Cloud Connector the API of the MES system is made available in the SAP Cloud Platform. Finally, the MES running on premise receives the data send via HTTP and triggers the execution of the production process in the model factory.
To set up the S/4HANA system on the Google Cloud the following steps are necessary. Fortunately, there are already different blog posts available describing the required configuration steps.
1.1 Google Cloud Platform
In this blog post you will find the steps to set up your Google Cloud Platform:
Let’s Set Up Google Cloud Platform
Necessary: 1.1; 1.2; 1.3; 1.4
(Getting access to the SAP CAL and the S/4HANA)
1.2 SAP Cloud Platform Cockpit
In this blog post you will find steps how to set up your SAP Cloud Platform Cockpit, which you will need for getting access to the services “destination” and “WEB IDE”.
1.3 SAP Cloud Appliance Library
In this blog post you will find the step to set up your Cloud Appliance Library which is necessary for the integration of the S/4HANA instance:
Let’s Set Up SAP Cloud Appliance Library (CAL)
Create SAP NW ABAP 7.51 instance.
1.3.1 SAP S/4HANA
In this blog post you will find the step to set up your S/4HANA instance:
Let’s Connect to Your Instance of SAP S/4HANA 1709 via SAP GUI
We only use 3a for this connection.
(Connecting to S/4HANA)
1.4 SAP Cloud Connector
After the previous steps it is now possible to connected to the SAP S/4HANA trail instance via the SAP GUI. The next step is the installation of the SAP Cloud Connector. We used the steps 1 to 3 of this blog post.(Access to the Cloud Connector, which ensures a connection between the SAP Cloud Platform and our MES)
2. Establishment of the architecture
2.1 Cloud Connector – Exposing the MES to the SAP Cloud Platform
Now that all the required tools are ready, the next step is to expose the MES to the SAP Cloud Platform.
As data needs to be send from the SAP Cloud platform to the MES system via Cloud Connector a “Cloud To On-Premise” connection has to be configured.
A “Cloud To On-Premise” connection can be added in the SAP Cloud Connector in the following view Cloud To On-Premise > Access Control. Add a new system mapping using the +Icon.
In the following dialog the type of the back-end system needs to be selected. In our case the type is Non-SAP System.
In the next step we selected HTTP as the communication protocol.
We used the IP address and port of the MES system as the internal host and port.
Next, a virtual host and port can be defined. In this project we simply reused the IP and port of the MES system.
The principle type is set to None and an optional description is provided.
The result is the virtual system as shown in the following screenshot.
In order to enable access to the API of the MES system the accessible resources need to be configured. Using the +icon a new resource can be added.
In this project the URL Path was set to “/” and the access policy
“Path and all sub-paths” was selected. This configuration enables access to all the APIs published by the MES system. Of course, in a productive scenario only the necessary resources of a back-end system should be published.
In the SAP Cloud Platform cockpit, the MES system is now shown as “available” in the Connectivity > Cloud connectors area.
2.2 Destination – Configuring a destination in the SAP Cloud Platform
In order to access the MES system in any service on the SAP Cloud Platform a destination needs to be created.
A destination created in the SAP Cloud Platform cockpit in the Connectivity > Destinations area. A new destination is added by click the “New Destination” icon.
This opens a dialog where a name is given to the destination and the URL of the MES system is configured. In this project the URL https://*backend IP*:*backend port* was used. Note, that the IP and port used here needs to be the virtual IP and port set during the configuration of the SAP Cloud Connector. The proxy type is set to “OnPremise” and “NoAuthentication” is chosen as the authentication method.
Please remember the Name you type in here, you will need it in the next step.
If everything is configured correctly, checking the destination should be successful.
2.3 WEB IDE – Creating the proxy Web Site
In order to expose the destination in the SAP Cloud Platform to the SAP S/4HANA running in the Google Cloud a proxy Web site is necessary. This website simply forwards all incoming requests to a defined destination. The SAP Web IDE can be used to build this Web site.
The SAP Web IDE is available in the Services section of the SAP Cloud platform. To access the SAP Web IDE for the first-time, type “Web” in the search bar in the “Services” section. Now the SAP Web IDE can be enabled, if necessary.
To access the SAP Web IDE klick on the SAP Web IDE Full-Stack.
In the Service overview of the SAP Web IDE click on “Go to Service” to get to the Web IDE.
The source code of the proxy web site is available here . The project can simply be imported into the Web IDE.
First you have to create a new folder in the SAP Web IDE workspace.
Then the downloaded zip-file can be imported by clicking on File > Import > File or Project select the file and your just created folder. The result is a webapp folder with an index.html and a neo-app.json file.
If you now open neo-app.json you should see something like in the following picture.
If anything isn’t as shown here please change it like this excluding the section “name”.
To forward incoming http request to the destination configured in the SAP Cloud Platform, type in the name of your destination set in the previous step.
Finally, the proxy Web site needs to be deployed on to the SAP Cloud platform. Once this is done, the set-up of the integration infrastructure is complete. Any HTTP request to the proxy Web site should now be routed to the MES.
2.3 BAdI – Sending released production orders to the MES
The final step is to implement a Business Add-In (BAdI) in the S/4HANA system. This BAdI (WORKORDER_UPDATE [Operation: UPDATE]) is responsible for sending the data of released production orders to the MES system via the proxy Web site.
The prototype for the BAdI implementation code can be found here.
In the BAdI implementation a logical system destination is used. This destination needs to be configured in transaction SM59 and point to the URL of the proxy Web site.
Once the BAdI is implemented and activated any release of a production order results in sending this production order to the MES using the described integration architecture.
In this student project, we came to the conclusion that the integration of interfaces via SAP is very easy to manage with the services already included in SAP. We found out that very little information about this topic can be found on the internet. So we came up with the idea to write this blog post to provide you with this manual.
We hope that you can easy follow each step of this blog post and come to your desired result.