You can build business applications for the SAP Cloud Platform Cloud Foundry environment using SAP Cloud Platform Rapid Application Development by Mendix, without needing to write code.
This tutorial takes you through the basics of development in the Mendix Desktop Modeler and teaches you how to build a simple sales order application consuming the GWSAMPLE_BASIC service
from the SAP Gateway Demo System (ES5).
This tutorial also showcases the SAP OData Model Creator and SAP OData Connector, available in the Mendix App Store.
Before starting this tutorial, make sure you have followed the prerequisites.
This tutorial assumes that you are using a trial Cloud Foundry environment, but it is applicable also to productive CF environment with minor changes.
The Mendix Desktop Modeler, for building your application, is available for Windows platforms only.
Step 1: Get SAP OData Connector
Step 2: Create GWSAMPLE_BASIC service module
The SAP OData Model Creator is a web site where your OData service metadata is transformed into a Mendix domain model that can be imported into your project.
You can generate this domain model by providing your service metadata as a file, URL, or select a service from SAP API Business Hub.
We will do it by providing a file.
This file can be downloaded from the OData service URL directly using the $metadata
suffix or retrieved from SAP Gateway. Since we’re using the SAP Demo Gateway System (ES5) for this tutorial, the metadata file can be found at:
https://sapes5.sapdevcenter.com/sap/opu/odata/iwbep/GWSAMPLE_BASIC/$metadata
To generate the service module, follow these steps:
-
Save the metadata file to your hard drive.
-
Open the SAP OData Model Creator.
-
Select the Manual option.
-
Upload the OData metadata XML file and click Continue:
-
Select the Schema and click Continue.
-
Press Generate
.mpk
. A progress bar will be shown during the parsing and generation of the module.
-
Once the generation is done, the Download button appears. Notice that the file name of your module is extracted from the metadata file itself.
Press Download and save the .mpk
file locally.
Step 3: Import module in Mendix app
Now you have a Mendix module ready to be imported into your project.
-
Open the project that you created, right-click the project root folder, select Import module package… and select the .mpk
file.
You now have your GWSAMPLE_BASIC
module available in your project ready to use in combination with the SAP OData Connector.
-
Open the generated domain model and explore the entities and associations. Imagine that you had to create that manually – a lot of work!
-
In addition to the domain model, the OData Model Creator also created two other items:
- A constant with the name of the service, containing the service root URL
- An enumeration (
EntitySetNames
) containing a list of all the entity sets in the model
Step 4: Create constants for ES5 credentials
Now that we have our domain model in place, it’s time to implement the connectivity to the SAP Gateway Demo System (ES5).
Our tutorial uses basic authentication to connect to the ES5 system, so let’s store the username and password in constants.
-
Right-click MyFirstModule
and add a new folder called Constants
.
-
Right-click the Constants
folder and add a new constant called ES5Username
.
-
Enter your ES5 username as Default value.
-
Following the same steps, add a new constant and name it ES5Password
.
-
Enter your ES5 password as Default value
.
Step 5: Add logic to get sales orders – authentication
Follow these steps to create the logic to get the sales orders.
-
Right-click MyFirstModule
and add a new microflow, name it ACT_GetSalesOrders
.
-
Right-click the line between the green and red dots in the microflow editor and select Insert | Activity (or drag and drop an activity from the upper toolbar).
-
Double-click the new activity and scroll down to locate the SAP OData Connector actions.
-
Select Create
Request
Params
, and then click Select.
-
Name the variable RequestParams
. This variable (as its name suggests) will hold the request parameters, and it’s required for the Add basic authentication activity.
-
Following the same steps, add an Add basic authentication activity.
-
Select the $RequestParams
variable in the Request parameters dropdown.
-
Click Edit… for the Username and select the ES5Username
constant by entering the following argument: @MyFirstModule.ES5Username
-
Follow the same steps for the Password.
-
Change the output Variable name to Authentication.
-
Click OK to close the dialog.
Step 6: Add logic to get sales orders – request
-
Add another activity to the microflow and select the Get List action from the SAP OData Connector.
The Get List action retrieves a list of entities described in the domain model. In our case we will retrieve a list of sales orders.
-
Fill in the required fields of the Get List action. For this tutorial, use the following settings:
Field |
Value |
Query |
The URL to which you want to execute your request. In our case:
https://sapes5.sapdevcenter.com/sap/opu/odata/iwbep/GWSAMPLE_BASIC/SalesOrderSet
And it’s constructed by entering the following code:
@GWSAMPLE_BASIC.GWSAMPLE_BASIC + '/' + toString(GWSAMPLE_BASIC.EntitySetNames.SalesOrderSet) |
Response type |
The type you want to query from the OData service. Select the SalesOrder entity. |
Request parameters |
$RequestParams variable |
Parent |
empty |
Result info |
empty |
Use Cloud Connector |
false |
Output Variable |
SalesOrders |
In our case, the Use cloud connector
is set to false
because ES5 is a publicly accessible system.
If you would like to consume a service from your on-premise back-end system, you need to setup and configure the SAP Cloud Connector and then mark this field as true
.
When running the Mendix application on SAP Cloud Platform, the SAP Cloud Connector will automatically be utilized to gain access to your on-premise system.
For more information, see the SAP Cloud Connector documentation.
-
Verify the Get List dialog matches the following:
-
Click OK to close the dialog.
Step 7: Add logic to get sales orders – return value
In the microflow, make the return value of the microflow a List
of SalesOrders
so you can call the microflow as a data source in a page.
-
Double-click the End-Event
(red dot).
-
Select List
for the Type.
-
Select SalesOrder
for the Entity.
-
Click on Generate… and select the SalesOrders
variable.

-
Verify the End Event dialog matches the following:

-
Click OK to close the dialog.
Your microflow should look like the following:

Step 8: Create a new master detail page
-
Right-click MyFirstModule
, and choose to add a Page.
-
Enter a name for the page (e.g. MyFirstPage
).
-
Select the SAP_MasterDetail (SAP_UI_Resources)
Navigation layout.
-
Select the Fiori Master Lists category on the left-side menu and select the Master List template.
-
Click OK.
-
Notice the Errors tab located at the bottom pane is showing an error No entity configured for the data source of this list view
.
Step 9: Show sales orders in page – master
Now we will bind the Master section to the Sales Orders.
-
Double-click the error from the Errors tab to get the List View of the Master section selected.
-
Double-click the List View, and change its Data Source to your ACT_GetSalesOrders
microflow.
-
When prompted to automatically fill the contents of the list view, choose No.
-
Select the content of the List View, right-click it and choose Delete.
-
Open the Connector tab on the right-side pane to view the properties of the Sales Order
entity.
-
Double-click (or drag and drop) the CustomerID
property from the Connector tab.
-
In the page, select the content below the Customer ID
you just added and add the CustomerName
property.
-
Select the content below it and add the CreatedAt
property.
-
Verify it looks like the following:
Step 10: Show sales orders in page – details
Now we’re going to make some modifications in the Detail section of the page.
-
Notice the Errors tab is showing several errors regarding fields that aren’t bound to any property in the Detail section. Scroll down, select the Tab Container, and delete it. This should resolve the errors.
-
Scroll down, select the footer container, and delete it as well.
-
Scroll back up, double-click the Title text and change it to Sales Order
.
-
Double-click the Subtitle text and change it to Details
.
-
Select the container with the New
and Delete
buttons and delete it.
Now let’s bind the Detail section and present some more Sales Order properties:
-
You can see 3 containers with Category
and Value
texts.
-
Select the first container and delete both Category
and Value
texts.
-
Double-click the SalesOrderID
property from the Connector tab.
-
Select the second container and delete both texts again.
-
Double-click the CurrencyCode
and the GrossAmount
properties.
-
Select the third container and delete both texts again.
-
Double-click the Note
, LifecycleStatusDescripion
and BillingStatusDescription
properties.
-
Verify the UI looks like the following:
-
Scroll up in the page, double-click the Page Title text and change it to Sales Orders Application.
Step 11: Configure Home Page
Mendix apps work by showing pages to the user. You can define which page should be the Home page, i.e. the first page the user sees.
-
Right-click Project | Navigation and click Open.
-
Click Select…
next to Default home page.
-
Select the new page you created in the previous step as the new home page.
-
Click Select.
Step 12: Run app
Now that you’ve created the UI and business logic, you can run the app and have it connect with the SAP Gateway Demo System (ES5).
To run the app for the first time, follow these steps.
-
Click Run | Run Locally.
If you see the pop-up window asking if you want to create a database, select Yes.
If you see the pop-up window asking if you want to save your changed, select Save and continue.
-
Wait until the startup of the app has finished and the app is running.
-
Click View to view the app in your browser.
You will now see your Sales Orders Application in the browser, with live data coming from ES5.

Step 13: Run app in SAP Cloud Platform
The final step is to deploy the application to SAP Cloud Platform, Cloud Foundry environment, and run it from your space!
The application will automatically bind to the Connectivity, XSUAA and PostgreSQL service instances.
-
Click Run.
The deployment process will start and you will be notified when completed.
-
Once the application is deployed successfully, click on View to run it from SAP Cloud Platform.
Additional Information