We demonstrate how to extend S/4HANA Cloud using the powerful Mendix SAP OData connector.

Background 

We have developed a procurement planning solution that needed to extract purchasing data from an S/4HANA Cloud 2408 system. Here we show how to get the basic plumbing working using the tooling provided by Mendix.

Conceptually the OData protocol is powerful - SAP uses it across their application portfolio. The challenge for rapid application developers, with limited SAP knowledge, is the complexity of the entity sets the API provides can be overwhelming. It is really simple to discover which APIs are available using the SAP Business Acceleration Hub.

business_acceleration_hub

The purchase order API for S/4HANA Cloud Public Edition can be viewed here

Steps to build integration

As a developer you will need to complete the following:

  • Configure S/4HANA Cloud - to expose the API for consumption
  • Export metadata for service - download the edmx file for use in Mendix
  • Generate a sap data schema - for use in your application 
  • Import model into application - generate the domain model in your application
  • Configure microflow - configure a microflow to call the REST service

This guide assumes that you have some Mendix experience and Studio Pro installed and that you have the relevant roles in the S/4HANA Cloud system for configuration (BR_ADMINISTRATOR & BR_PURCHASER).

Configure S/4HANA Cloud

Now that we have identified the purchase order API from the Business Accelerator Hub, we need to configure our SAP system to expose the data, this will require us to:

1. Create a new communication user & associated system.

2. Create a communication arrangement for scenario SAP_COM_0053_020

These are performed using the Communication Management page in your launchpad:
admin_communication

The end result should be a user that has the following assigned to it:
Launchpad_admin_config

If you would like to test this service, you can do it directly from the Business Acceleration Hub, by configuring the system with the relevant details that you created above.

Export the metadata

OData services are self-describing you can access the endpoint url and add the $metadata suffix to your URL. The url for viewing the metadata can be accessed using the following URL: 
https://XXXXX/sap/opu/odata4/sap/api_purchaseorder_2/srvd_a2x/sap/purchaseorder/0001/$metadata

metadata

Download this file and save it with an .edmx or .xml extension - you will need it in the next step.

Generate the data schema

Now we need to import this into a service provided by Mendix which will convert the metadata description into a domain model that can be used within your Mendix application. Open the following URL: https://sap-model-creator.home.mendix.com/

 

generate model

In the next step, upload the metadata file that you created in the previous step, select the schema and after model has been generated. 

upload _file

Download the Mendix MPK file for you to import into your Mendix application in the next step.

generate_mpk

Configure your application

Now we finally get to building our Mendix application, follow these steps:

  1. Create a new application using the blank template.
  2. From the marketplace import the SAP OData Connector module.
  3. Import the MPK file into your project that was downloaded from the previous step, by right clicking on your project in Studio Pro.

import_mpk

Now is you look at your domain model you should see the domain model for purchase order, look at how many entity sets etc there are, the model generation tool saves application developers a huge amount of time.
domain_model

Now we have the domain model in place, the next step is to configure a microflow to fetch details. 

Configure Microflow & Page

Now that we have the domain model the next steps are:

  1. Create a Microflow to call the service
  2. Configure a page to show some purchase order details

The marketplace module that we installed provides additional capabilities within the Microflow editor. Add the following steps into the microflow (using the toolbox with new functionality):

basic_microflow

In the basic authentication step, include the username and password for the communication user. In the Get list microflow add the OData query string based on your specific needs and return a list based on the entity you require. In our case we wanted a list of purchase orders.

get_list

Final step is to create a page with a datagrid where the attributes you would like to see can be displayed. Below is an example of the results.
Purchase_order_page

Next steps

Of course this is just a basic extraction scenario, improved token management and caching would likely be the next steps you would want to build. Let us know if we can help accelerate your projects with our fast start service.

Submit a comment

You may also like

No-code ERP innovation across four dimensions
No-code ERP innovation across four dimensions
10 August, 2023

Today, innovation isn't just a buzzword; it's the lifeblood of any thriving business. No-code can be a catalyst for inno...

Why you need developers for your no-code project
Why you need developers for your no-code project
10 August, 2023

Developers for no-code projects sounds counter-intuitive - while no-code definitely reduces the burden on IT - eliminati...

Setting Up Neptune SAP Edition on Nuve Platform : A Step-by-Step Guide
Setting Up Neptune SAP Edition on Nuve Platform : A Step-by-Step Guide
1 February, 2024

Learn how to install Neptune Software SAP Edition on the Nuve platform with this comprehensive step-by-step guide.