Product Lifecycle Management Blogs by Members
Get insider knowledge about product lifecycle management software from SAP. Tap into insights and real-world experiences with community member blog posts.
cancel
Showing results for 
Search instead for 
Did you mean: 
marcobarat
Explorer
Hello everybody! Last time, I showed you how to call SAP DM API’s through Node-RED. Today, I’d like to demonstrate how to easily interact and integrate a Node-RED backend with SAP DM using the “Design Production Processes” functionality.


 

Pre-requisites



  • have access to the Cloud Connector

    • Cloud Connector must have defined the connection to the Digital Manufacturing subaccount;



  • know the local IP address of Node-RED

    • Node-RED have to be located in the same network of Cloud Connector / or they must be able to reach each other;



  • BTP user with roles to add destinations

  • SAP DM user with roles to "Manage Web Servers, Manage Service Registry and Design Production Processes"  apps.


My environment


In my environment, Node-RED & Cloud Connector are easily configured inside my PC, so:

Note that Cloud Connector in a not demo scenario is not arranged inside a local PC.

The scenario


The scenario I have in mind is quite straightforward. My main goal is to demonstrate the remarkable capabilities of SAP Digital Manufacturing when it comes to integrating with third-party Web Services. Therefore, I don't intend to create a complicated scenario. Instead, I will focus on a simple one that can effectively showcase how effortless it is to connect with external services.

Our use case involves adding a new button to the POD. When the production operator clicks on this button, it will trigger a call to an external Web Service, and the resulting response message will be displayed on the operator's dashboard.

This blog is not related on how to "program" with Node-RED so, i'll create a simply flow that you can import in your Node-RED by pressing Import and paste the code below:



 

JSON Code to be imported:
[
{
"id": "83cf611c239307df",
"type": "tab",
"label": "DummyFlow",
"disabled": false,
"info": "",
"env": []
},
{
"id": "122838a49a61de25",
"type": "http in",
"z": "83cf611c239307df",
"name": "",
"url": "/dummyCall",
"method": "get",
"upload": false,
"swaggerDoc": "",
"x": 260,
"y": 820,
"wires": [
[
"0ff2ba2630dc79a9"
]
]
},
{
"id": "c1cbc218f5149342",
"type": "http response",
"z": "83cf611c239307df",
"name": "",
"statusCode": "200",
"headers": {
"Content-Type": "application/json"
},
"x": 680,
"y": 820,
"wires": []
},
{
"id": "0ff2ba2630dc79a9",
"type": "template",
"z": "83cf611c239307df",
"name": "",
"field": "payload",
"fieldType": "msg",
"format": "handlebars",
"syntax": "mustache",
"template": "\"Hey, you successfully called a third-party WebService!\"",
"output": "str",
"x": 480,
"y": 820,
"wires": [
[
"c1cbc218f5149342"
]
]
}
]

This simply code is used to create a WebService running on noderedaddress:1880/dummyCall and is returning a string response with:
"Hey, you successfully called a third-party WebService!"

Note that you can build a JSON Response and create your own custom logic.

Let’s start!


First of all we have to configure:

  • Cloud Connector to juggle traffic from SAP DM to our Node-RED instance;

  • SAP BTP to configure the destination;

  • SAP DM to mantain the WebServer and configure the WebService;

  • Consume the WS inside POD.


Cloud Connector configuration


In my example, Cloud Connector is available on default port (8443), open the web page configuration and after login select the subaccount where the Digital Manufacturing has been deployed (if you don't have this subaccount yet, follow the SAP official guide and configure it, this step is mandatory to proceed with this Blog), select "Cloud To On-Premise" and press the "+" button in order to add a new configuration.


 

And then configure as follow:



 


 

In this step, as "Internal Host" you must provide the address where your third-party WebService is located, in my example, my Node-RED server is in my PC, so i'll use "localhost:1880":


 

As Virtual Host i used the same, localhost:


 

Put the tick on "Check internal host", by this, you can check if everything is working fine:


 

And then, pressing on finish you will see your third-party system available on your Cloud Connector, but, it's not over, we have to add a resource, select the just added system and press on the "+" button below (step 2 of the image):


and configure as follow:


this will let you to reach the Node-RED's API. Press on save and you should have something like this:


so, Cloud Connector part is over!

SAP BTP Destination


Now it is time to configure our backend destination within SAP BTP. This step is necessary because, in our use case, Node-RED is not publicly accessible, and it only operates locally. To enable communication between SAP BTP and Node-RED, we will use SAP Cloud Connector's proxy tunnel to redirect requests within our local network.

Open your SAP BTP Digital Manufacturing Subaccount and navigate to Destinations and press "New Destinations":



 

and configure as follow:


 

Note that inside Location ID you must provide the location id used inside Cloud Connector for connect to the DM Tenant, if you don't know where is, just open the Cloud Connector again, navigate on the "homepage" for the right subaccount and search for Location ID:




If it's not set, i suggest you to talk with your team and provide a location ID.

Moving back to the BTP configuration, press save and test if everything is reachable:


 

If the connection is successful, it means that everything is fine, from Cloud Connector to BTP.

 

SAP DM WebServer and WebService configuration


Once that everything from Cloud Connector to SAP BTP is done, the last steps are related Digital Manufacturing configurations:

  • setup the WebServer;

  • create a WebService;

  • create a process inside "Design Production Processes".


 

Setup the WebServer


Open your SAP Digital Manufacuring app and search for "Manage Web Servers" tile and click on it. When it is loaded:

click on create and configure as follow:



press on "Save" and once you have saved a "Destination" and "Service" menu will appear, on destination press "add" and attach the previous destination created before inside SAP BTP:



When the new WebServer has been created, click back on "DMC Cloud" , we need to "connect" our new server with DM WebServer, just press on Create under "connections" and select the previous created:






This step is mandatory. If you forget to connect both, LinkedIn and the design process app, you won't be able to see the services within your WebServer.

 




Setup the WebService


Next steps requires the configuration of the WebService. In this case, we use a different SAP DM app, in the top search bar input  "Manage Service Registry" and open it. Then, once is open, click on Add -> New Service




 

And configure as follow:


 

press on Create and we are done with this part.

 

Setup a new Process






Now it's time for the most interesting part! We need to create a new process. To do this, use the search bar at the top and look for "Design Production Processes." Once you find it, open it and click on "Create."






 

Configure as above, click on create a Production Process like follow:


 




Now that the process is ready to be developed, the next step is to display our custom WebService in the "Services and Processes" list. Initially, it may not be visible, so we need to click on 'Select Services' and choose our "DummyCall" service:





 

And now it's time to drag & drop components:

  • first, select the "Start" under control and drag into the process;

  • drag our "DummyCall" services;

  • drag the "POD Message" under controls;

  • drag the "End" under controls.


Connect each block with an arrow and the result should be this:



but, it's not over, click on the first block, the "Start" and configure as follow,

Input Parameters that will be attached in the POD dynamically:


 

POD Connection:


 

Configure the "POD Message" action by clicking on that block and under "Output" attach this string:
'DummyCallResponseBody'

 

Like this:


 

Once you performed all of those steps we are ready to save and deploy it!

Make sure that in the header of our new Process the status is "Publish: yes", if not, please press on Edit Header:


 

and set "Publish to Service Registry" to ON:


 

SAP DM POD Custom configuration


Now it's time to customize the Workcenter POD by adding a basic feature. We will attach a new button that will call an external WebService to display the result of our blog post.

To begin, open the POD Designer SAP DM app, and locate the "DEFAULT_WC_POD". Once you have found it, select the "copy POD" option and copy as directed below:


 


 

Press "OK" and you will automatically redirect to POD Designer for your new POD.

Now, it's time to add a new Button, open the "Activities" TAB and drag a "Action Button":


 

click on the new button just created and navigate to "Assign actions", in the popup select "add" and configure as follow:


and fill the Parameters list as below:


And save.

Last step is to allow POD notifications, in order to get POD Messages, click on (1) button and select everything and save.


 

Press on OK and now it's time to publish the POD and test the final result, by clicking on the new POD Button, and that's it:

 


 

Conclusion


The aim of this blog post is to guide you through the process of integrating SAP DM with a third-party system and demonstrate how to integrate and consume third-party web services. As a result of our extensive research and effort, i hope that this blog post provides you with the necessary insights and step-by-step instructions to accomplish this seamlessly. i look forward to hearing from you if you have any questions or concerns. Feel free to leave a comment or send me a DM.

In this particular use case, I used Node-RED as the backend source. However, it can be used with any languages you have in mind (java, nodejs, python, ...). Additionally, by combining it with SAP BTP deployed backend, you can further enhance your development.

Thanks for reading!

2 Comments
Matthias_Kolley
Explorer
0 Kudos
Do you know wether it is possible to call that webserver directly from the POD-Plugin?
Without the usage of the Production Process.
marcobarat
Explorer
0 Kudos

Hi Matthias,

I don't think it's possible without following the steps described before.

The only other way is by developing a POD plugin inside SAP BTP, but I have never tried it yet.

Best regards,

Marco