Become a hero using SAP and Mendix

Skip navigation

Become a hero using SAP and Mendix

/ April 12, 2019

MxBlue is a Dutch Mendix partner that is part of SUPERP, an SAP Consultancy firm that has been implementing and supporting SAP ERP solutions for 20 years. MxBlue is focused on delivering innovative and differentiating solutions that seamlessly integrate with our clients’ existing SAP ERP solutions. In 2018, our work was awarded an SAP Quality award in the innovation category.

Never one to rest on our laurels, we recently set out to see if we could come up with a new, innovative way to show off what we do. Our sales manager asked our team to design and implement an engaging app that we could use at a number of upcoming events. During a brainstorm session with the team, we decided to build a mobile game that would use gamification concepts to engage event users. The game would demonstrate the power you can wield when you use SAP and Mendix side by side. We wanted to challenge ourselves to see how many people and hours it would take to develop an app only using standard Mendix and SAP components.

Read on to see how we implemented the functionalities and capabilities of both systems to create a game that turns users into heroes.

Mendix and SAP, side by side

We designed a game composed of a number of quests, all aimed with the purpose of becoming a hero like the Super Mario Brothers and saving Leia the Low-code Princess. The users, event participants, can complete these quests — such as obtaining an SAP Sales Order through the app or checking the machine state of a Siemens demo kit — and are rewarded points for each complete quest. Event participants try to acquire the most points to compete for a prize.

MxBlue mobile game

Building an innovative game on top of SAP S/4HANA is a great example of how Mendix and SAP complement each other. Whereas SAP is an excellent ERP system, it’s not very well-suited for extending into technologies one would need to build a mobile game to be used at events. We used the Mendix low-code platform to develop the game and integrate with SAP and other systems (such as Siemens Mindsphere and Kafka) and create an engaging user interface. We used these integrations to help us design the game’s quests.

The gameplay would be in Mendix and SAP S/4HANA would be used to store the players (as an SAP Business Partner) and record the prizes that would be handed out (as SAP Sales Orders).

Standard SAP S4/HANA system broken into Mendix extensions

Setting up our SAP S/4HANA system

Since the SAP system would be the foundation and system of record for storing players’ information and the prizes that we hand out, we started by setting up the APIs that our app would use.

Our starting point to explore and test standard SAP APIs is the SAP API Business Hub, where we can explore what services are available for an SAP S/4HANA system.

SAP API Business Hub

To activate the API_Business_Partner and API_Sales_Order we had to activate these services in SAP Gateway (through the /IWFND/MAINT_SERVICE transaction).

SAP Gateway Service Catalog

The API to create a sales order is ‘locked’ by default. To unlock it, we set the user parameter ODATA_SD_SLS_CHANGE with value X.

Once the OData services were unlocked, we could access these services through our browser.

Setting up the Mendix SAP OData connector

Mendix offers an excellent connector (The SAP OData Model Creator) that easily generates a Mendix representation of an SAP OData service. This is a huge timesaver and makes it very easy for a Mendix developer to use SAP services.
The $metadata of an OData service can be imported in the OData Model generator.

The SAP OData Model Creator

The output of this service is a complete Mendix representation of the content of the OData service, ready to use for any Mendix developer! See the image below.

Mendix representation OData service content

Since there are a lot of fields and default values that you need to consider when calling an SAP OData service, our SAP developer helped us by providing a Postman project with a number of sample OData calls. This is great for Mendix developers to use because they can start working from a sample and see what default values need to be entered to successfully perform an SAP OData call. The structure of an SAP OData call is very SAP-specific and should be done by an SAP consultant rather than a Mendix developer.

Creating Businesspartner in Postman

Using the SAP OData services and Mendix microflows

Once we set up the SAP OData services in our Mendix application, it became very easy to use those to interact with the SAP system.

For example, one of our use cases for this game was that when an event participant visits our booth, they could scan a QR code and collect points. The prizes would be recorded as a cash sales order in SAP. To achieve this goal, we used a Mendix microflow to record a sales order in SAP.

Microflows are a super powerful set of actions that we can use to graphically “program” logic for a Mendix application. The image below shows the actual microflow that takes Mendix information and calls the Sales_Order Create API from SAP. After the sales order has been created, the player’s information is updated with the SalesOrder Nr as assigned by SAP.

Mendix Microflow for calling Sales Order Create API from SAP

Showing the results in SAP

All players of our game can collect a nice giveaway at our booth during events. To show that their information has been recorded in SAP, we would look up their sales order in a FIORI app.

Cash Sale in FIORI application

Results, lessons learned

We were able to create an engaging event app using only standard Mendix and SAP components. To build the app, we worked with one Mendix Business Engineer, one SAP consultant, and a UX designer. In total it took them approximately 40 hours to design, build, test, and deploy the app.

To deliver a Mendix and SAP-based solution, it is essential, just like Mendix and SAP, to work side-by-side to rapidly select the right SAP interfaces, configure SAP and build the Mendix functionality. We found that using Postman and asking our SAP expert to provide us with a number of sample OData calls (including the required SAP fields) was a great time-saver.

Finally, using the standard Mendix-SAP OData Model generator and OData connector greatly reduces the amount of effort and project risk.  A lot of the heavy lifting is already embedded in that standard connector, so you can really focus on building the required business functionality and not get bogged down in all kinds of technical details.

See how you can build powerful solutions with SAP and Mendix.