Skip to Content
Author's profile photo W. Snoep

Build a SAPUI5 app with the AppBuilder consuming a NW Gateway service – series 1 of 2

A couple of weeks we held a spotgroup (knowledge sharing session) in the company I work for. It was one of the most busy NetWeaver spotgroups handons sessions ever. We literally had to extend the room!


Together with a couple of colleagues we organised a handson session to get aquanted with NetWeaver Gateway and consuming those services. For you all to enjoy I decided to simplify and shorten the exercises a bit and share it here. In 2 blogs we will create a NetWeaver Gateway service and consume the service in a SAPUI5 app, using the just released appBuilder. It assumes no handson knowledge on NetWeaver Gateway and SAPUI5 at all, and it is a first step to get aquanted with the topics.

Still interested? sure you are, good! Let’s start;

NetWeaver Gateway

NetWeaver Gateway enables us to perform CRUD operations on data from our SAP system via OData.

The BAPI we will expose as a service is:


Note: To perform this steps a NetWeaver Gateway system is required, if you do not have it at your disposal, the ES workplace demo services can be used as service. In the 2nd blog you could then consume those services in a mobile app.

Create project

To start building our service, we need to create a project in the NetWeaver Gateway service builder.

Open the gateway service builder by starting the transaction ‘segw’ in your gateway system. Use the create button to create a new project (The package ‘ZSCN’ was created before).

1_segw create project.JPG

Create entity

After creation of the project we define our entity. There are various ways to create an entity, we choose to base it on an BAPI

Right click on data model and pick ‘import RFC/BOR interface’.

Define the entity name and the BAPI:


3_ create entity.JPG

Select the ‘FLIGHT_LIST’ as data source parameters

3_ create entity step2.JPG

Configure the AIRLINEID and CONNECTID as key.

3_ create entity step3.JPG

The following message should appear;

3_create entity_step succes.JPG

We could use the import parameters of the BAPI as filter option, so let’s setup the Airlineid as ‘filterable’. See below:

4 - set filterable.JPG

Since the entity name is taken from our BAPI parameters naming, we like to rename it to FLIGHT.

5_rename entity.JPG

Create entityset

Based on our entity we want to create an entitySet

6 create entitySet.JPG

Service implementation

Move down in your project to the entry ‘service implementation’. We would like to create a getEntitySet query which will give us a list of flights.

Use right mouse button and  ‘create mapping’ to start performing the mapping of our entityset to a BAPI.

7 move to getentityset implementation- right mouse button create mapping.JPG

Choose the BAPI you would like to map.

Note: the BAPI we selected in the beginning was just the definition of our entity, it did not call or expose any BAPI yet. We will do that now.

8. choose the bapi for mapping.JPG

Use propose mapping to perform a default export mapping for your BAPI.

9. propose mapping - should fill all fields.JPG

Click the ‘+’ to add another entity set property.

Pick Airlineid again, as property.

10.add field again to mapping with plus sign.JPG

Map it to the Airlineid input parameter of the BAPI.

11. airline id map to input parameter of bapi by selecting and okay.JPG

This will give us later on the possibility to filter the list of flights based on airlineid.

The end result of the mapping should be like this:

12 end result mapping.JPG


Since mapping is done, we basically ready to generate, yes generate our service implementation.

We need to the magic button on top to start this proces.

13. generate!.JPG

When generation is finished, classes should be generated.

14. messages log after generate - succes!.JPG


Only thing left is to register our service;

Scroll fully down in your project in the left pane and go to service maintenance. In this menu you should see at least your own gateway service registered and probably others. Open up your own system to register the just created service on this gateway stack.

After opening your system go to the right pane and in top bar, use ‘register’ to register your service.

15. register service - via register service button in service maintenance menu in tree.JPG

During registration we select ‘LOCAL’ as our system, where we would like to register our service.

After registration our service registration list should show a succesfull registration;16. click on maintain service to see the service registry and to be able to test.JPG

Test results

Click on maintain to open ‘service maintenance’.

A new transaction (/IWFND/MAINT_SERVICE) opens, in here we can normally see all registered service, in this case we only see our service, since we navigated starting from our project.

See the bottom left pane, we can decide to test our service in the browser or in the system itself via the build-in gateway client.

Let’s open the gateway client.

17. start GW client.JPG

A similar URL will appear when you start gateway client. Click on execute to see what happens, and if your service can actually be reached;

18 gw client - start.JPG

To retrieve the list of flights, fill in a similar url as below;

19. change url to this and see result.JPG

The result will show the list with flights as follows in atom-xml format;

20. service all flights result.JPG

Since we also setup a filter in our service we can see the result of this call as well. We need to add the $filter to the url, in this case filter the list on field Airlineid, which must be equal to LH. (Lufthansa).

21. use filter url.JPG

See an example result below;

22 check filtered result.JPG


Congratulations! You’ve succesfully build a simple service using SAP NetWeaver Gateway, please continue to step 2, to build an app with SAPUI5 in the appbuilder  consuming the list with flights.

Hope you enjoyed part 1 of this blog series, see you at part 2.

Assigned Tags

      You must be Logged on to comment or reply to a post.
      Author's profile photo Jitendra Kansal
      Jitendra Kansal

      really helpful. thanks for sharing.

      Author's profile photo W. Snoep
      W. Snoep
      Blog Post Author

      Glad it was helpful for you! From a feedback perspective, were you able to execute all the steps in series 1 and 2?

      Author's profile photo Jitendra Kansal
      Jitendra Kansal

      unfortunately i have old version of NWG system which doesnt have option import RFC/BOR interface. I will have to check it with basis team.

      Author's profile photo Twan van den Broek
      Twan van den Broek

      Thanks Wim, it was a great session! Also thanks to Leo van Hengel and Guido Koopmann.

      I really loved the workshop setup of the evening. The more handson and the less slides the better the sessions are.

      BTW, you are allowed to mention that you work at Ciber 😉

      Author's profile photo W. Snoep
      W. Snoep
      Blog Post Author

      Thanks Twan.

      Haha, you just mentioned it ;-).

      It was for sure a great evening, can't wait to have more next year!

      Hopefully also SCN members will benefit, by having shared handson exercices here to get aquanted with topics as SAPUI5 and SAP NetWeaver Gateway.

      Author's profile photo Former Member
      Former Member

      Hi Wim,

      Nice blog, next thing to find out is how the ?$epand is working in SAPUI5 😉

      Kind regards,

      Guido Koopmann

      Author's profile photo Former Member
      Former Member
      Author's profile photo Syam Babu
      Syam Babu




      Author's profile photo Former Member
      Former Member

      Nice blog Wim! I didn't use the mapping function before. Much easier and faster than implementing the BAPI call in the redefined method in the *DPC_EXT class. Thanks!

      Author's profile photo Arindam Samanta
      Arindam Samanta


      Excellent blog. Today I saw this. Its a very helpful blog and I really got the idea about NW gateway service. I am new in this area so I need to explore more.

      Thanks once again for your very kind and helpful blog.


      Arindam Samanta.

      Author's profile photo Former Member
      Former Member

      Thanks for sharing. This is really helpful and motivating when you're getting started.



      Author's profile photo sam jon
      sam jon

      very helpful..Thanks for ....sharing this one