Skip to Content
Author's profile photo Nicolas Busson

My journey creating a SAPUI5 mobile app at home [Part II]

Create your first service with SAP Gateway 2.0 SP4

Here is the second part of my journey (also known as “How-to create a simple mobile app for newbies”):

Part    I: Make sure your phone can access SAP Gateway

Part   II: Create your first service with SAP Gateway

Part  III: Develop your mobile app on Eclipse

Part IV: Test your mobile app on your phone

Part  V: Troubleshooting… and finally make it work!

Useful links:

New E2E Tutorial: Gain Hands-on Developer Experience with SAPUI5 and SAP NetWeaver Gateway

Gateway Service Builder (SEGW) with a focus on DDIC Importer

Step 1: activate SAP Gateway

Start tcode SPRO and click the following IMG to activate SAP Gateway:


A popup will be shown where you have to click the “Activate” button.

Then click the “Manage SAP system aliases” as shown below:


Add the following entry and save:


Start tcode SICF and activate service Default_Host/sap/opu and all its subnodes:


Step 2: create a new project

Start tcode SEGW and click the “New” button to create a new project which will hold our brand new service dedicated to read business partner data (I created everything as local objects because obviously on my own PC I do not intend to transport anything, but remember to enter a correct package on a “real” development system):


Right click the “Data Model” Node and select Import >> DDIC Structure


In the next screen, select structure BUT000, flag checkbox “As entity type” and press “Enter” (if you do not press “enter” at this point in time, the system will overwrite the name of the entity and give it the name of the structure). Now fill in the name “Partner” and select the components you want. On my system I marked every component with usage “Ignore” except the following ones:


Now double click on the node named “Entity Set”, and add the following entry:


Save and generate your service:


Step 2: fix any generation error

If you selected exactly the same components as I did, the system will probably throw the following error during generation:


In fact, the name of my entity was the same as one of its component… which seems to be forbidden. So let’s fix it by double clicking on the “Properties” subnode of our “Partner” entity, and rename component “Partner” to “PartnerNo”:


Save and activate again.

If other issues are thrown, try to fix them accordingly.

Step 3: add some code to retrieve partner data

Now expand “Service Implementation” Node, and right click the “GetEntitySet” node to select “Go to implementation” as shown below:


Ignore the popup that is telling you no implementation was found.

Redefine method PARTNERSET_GET_ENTITYSET (do not change it directly, otherwise your code will be lost with next generation of the service):


To keep things very simple, I decided to return every entry found in BUT000 table (in my case this is a sandbox system so this table contains only 2 entries):


Now redefine method PARTNERSET_GET_ENTITY. As far as I’m concerned I used the same “KISS” principle as above:


Save and activate everything.

Step 4: activate and test your service

Go to the SPRO and select the following IMG:


Click the “Add service” button


Fill-in the required information to retrieve your service and select its technical name:


In the popup that is displayed you do not have to change any value. Just fill in a package name:


Come back to the previous screen: you should now see your “Z_Partner…” service. Click the “Call browser” button to test it:


If everything goes as expected, you should see something like this (meaning the service is up and running):


Step 5: troubleshooting

OK nice, our service seems to work fine. But is it?

If you try to start the following URL, you should see a list of business partners:

But instead of the expected list, you’ll probably face an HTTP 500 error page:


In my case that was happening because I selected components CHDAT and CHTIM when I created the “Partner” entity… Unfortunately if those fields are left blank in the database, the service is throwing an exception at some point in the program. So I expected this to be a bug in the software and searched for OSS notes. [Update: thanks to Sebastien BENOIT who added a comment below, I now know that I should have marked the checkbox ‘nullable’ in the entity types properties to tell the system that this exception could be ignored].

However, as I couldn’t find any patch, I tried to simply remove those components from my service definition by clicking the delete button (tcode SEGW >> Data Model >> Entity Types >> Partner >> Properties) :


I saved and activated my service again.

But the problem still remained… so I analyzed the service metadata via the following URL:


I realized that even though those components were successfully removed via tcode SEGW, they were still there in the service definition… So I suspected another bug in the software. [Update: to regenerate your service after a change, it seems that you need first to delete the assignment to a system, then delete the service itself, only then will your changes be taken into account]

Again, I couldn’t find any notes, and I didn’t know how to change the service metadata manually, so instead of creating a new service from scratch again, I opened all business partners created in my system (they were only 2) to change of one their properties. After saving my modifications, fields CHDAT and CHTIM were no longer empty in the database and the service was working smoothly:



It took me approx. 4 hours to reach this point where I finally have a Gateway service up and running on my laptop… Let’s see if I can create a mobile app consuming that service now: go to Part III.

Assigned Tags

      You must be Logged on to comment or reply to a post.
      Author's profile photo Tahir Öz
      Tahir Öz

      Very well explained Nicolas, thank you !

      Author's profile photo Nicolas Busson
      Nicolas Busson
      Blog Post Author

      Thanks! I'm glad you appreciate it. I'm finalizing Part III.. I'll probably publish it tomorrow.


      Author's profile photo Andy Silvey
      Andy Silvey

      Hi Nicolas,

      again, an excellent blog and I look forward to part III and the rest of the series.

      Thank you.


      Author's profile photo Nicolas Busson
      Nicolas Busson
      Blog Post Author

      Thanks Andy!

      I've just published Part III... hope it will be useful too even if I couldn't test my application to be 100% sure it is correct.




      Author's profile photo Former Member
      Former Member

      Dear Nicolas,

      Woah..great..and am gonna try out soon..



      Author's profile photo Nicolas Busson
      Nicolas Busson
      Blog Post Author

      Thanks for the kind words Anandh!



      Author's profile photo Former Member
      Former Member

      Nice blog, for the issue with the date/time you just have to set your properties as "Nullable" in your entity types and then the exception is skipped.

      Also to regenerate your service after a change, delete first the assignment to a system, then delete the service itself, after that you can recreate it and the changes will be taken into account.

      Author's profile photo Nicolas Busson
      Nicolas Busson
      Blog Post Author

      Thank you very much Seb!

      That's what I've been looking for. I'll give it a try when time allows.



      Author's profile photo Midhun VP
      Midhun VP

      Written well. Hats off. Thanks. 🙂

      Defiitely I will try this.

      - Midhun VP

      Author's profile photo Former Member
      Former Member

      Good report. I have an issue with the PartnerSet URI (http://<host>:<port>/sap/opu/odata/sap/Z_PARTNER_SRV_SRV/PartnerSet), all I get is this:

      <error xmlns="">


      <message xml:lang="en">

      In the context of Data Services an unknown internal server error occured



      I already added two Partners through the BP transaction.

      I'm totally new to ABAP development and still have to grasp on all the concepts behind it, so frankly I seldom know what to do after SAP GUI Login.

      Any idea what might cause this or where to look to find out?