The OData Connector for SAP solutions is a specific SAP connector for integrating with SAP back-end systems like SAP Business Suite (SAP ERP 6.0), SAP S/4HANA, SAP S/4HANA Cloud, and SAP SuccessFactors.
This how-to will teach you how to do the following:
- Add the OData Connector for SAP solutions to your Mendix app
- Configure the OData Connector for SAP solutions
- Display product data from the SAP OData service GWSAMPLE_BASIC in your Mendix app
The OData Connector for SAP solutions only supports SAP OData Gateway Services which use OData version 2 or version 3. OData version 4 is not yet supported.
Before starting this how-to, make sure you have completed the following prerequisites:
- Create an app in Mendix Studio Pro
- Get authorization credentials for the SAP NetWeaver (ES5)
3 Getting the OData Connector for SAP Solutions Module
To be able to use the OData Connector; first create your project. Inside, navigate to the Mendix Marketplace to download the OData Connector for SAP solutions module. You will then find this module in your app project’s Marketplace modules.
For more information, see How to Use Marketplace Content in Studio Pro.
4 Getting an SAP Data Model
In this example, you will display a list of products from the GWSAMPLE_BASIC OData service. You will need to create an SAP data model module for the GWSAMPLE_BASIC OData service. The module contains a pre-built domain model that you can add to your app.
Open the OData Model Creator for SAP solutions.
Click SAP Catalog Service.
Enter your User name and Password for the ES5 SAP Service Catalog (see Prerequisites, above).
Type sapes5.sapdevcenter.com as the Server. (Leave the protocol as
https://and the Port as
Type GWSAMPLE in the search box and press Enter.
Select GWSAMPLE_BASIC and click Continue.
Select GWSAMPLE_BASIC again and click Continue.
Click Generate .mpk.
Click Download once the model is ready.
Select Save File.
Choose the /resources folder within the folder where your app project is stored on your PC and click Save.
Open your app in Mendix Studio Pro.
Right-click the project in the Project Explorer and select Import module package….
Find the file that you stored in the /resources folder and import it.
The GWSAMPLE_BASIC data model will now be included as a module in your app.
5 Using the OData Connector for SAP Solutions
In this section, you will learn how to implement the data connector in your Mendix app. These steps assume you are using a blank Mendix app with a module called MyFirstModule.
5.1 Creating a Microflow
To create the microflow for this retrieve, follow these steps:
- Create a constant in MyFirstModule called ES5_Username and make the default value your ES5 Username credential.
- Create a second constant in MyFirstModule called ES5_Password and make the default value your ES5 Password credential.
- Create a data source microflow called DS_GetProductList in MyFirstModule.
- From the Toolbox, drag a Create request params action into your microflow.
- Open the properties and change the return variable name to SAPRequestParams.
- Drag an Add basic authentication action into your microflow.
- Open the properties and set the following:
- Request parameters -
- Username -
- Password -
- (You do not have to use the return variable)
- Request parameters -
- Drag the Get List action into your microflow.
- Fill in the required fields of the Get List connector. For this example, you should use these settings:
- Response type –
- Destination –
- Query –
@GWSAMPLE_BASIC.GWSAMPLE_BASIC + '/' + toString(GWSAMPLE_BASIC.EntitySetNames.ProductSet)
- Request parameters –
- Parent –
- Result info –
- Use return variable –
- Variable –
- Response type –
- In the microflow, make the return value of the microflow List of Customers. This is so that you can call the microflow as a data source in a page.
The final result of your microflow should look like this:
5.2 Creating a Page
To create a page to show the objects in a list, follow these steps:
- Add a blank page to your MyFirstModule module.
- Insert a Data grid widget in the page.
- Select the microflow you created in the section Creating a Microflow, above, as the data source for the grid.
Select the Name, Category, and Price attributes to display in the data grid.
Your page should look like this:
Drag a open page button on your homepage.
Select the page you have just created to be displayed.
Congratulations! You can now run your app and see a list of the products available in the GWBASIC_SAMPLE application.