SAP and Xamarin

None

Challenges of Mobilizing SAP MM with Xamarin - Create Service in SAP Netweaver Gateway


Overview

In the previous post, we finished our last page, called Purchase Order Items Confirm. For the next few weeks, the plan is to implement the back-end features one-by-one, and in parallel we will link these features under our existing mobile app, SAP Goods Receipt. Today, I'm going to demonstrate you, how easy is to create a simple OData service within SAP Netweaver Gateway. Ready to go?

Then, let's get started!


Create New Project

Our first task is to create a new project in the transaction, SEGW by clicking on the highlighted button.


In the popup window, we are going to set a unique Project ID, a Description, and if you don't have any specific requirements, you can leave the rest of the properties as it was by default. At last, we need to assign it to a Package, or mark it as a Local Object.


Generate Project

In the next step, we are going to generate the project, namely generate the different helper classes, such as Model Provider Class, or Data Provider Class.


In the popup window, the system fills the different class names out automatically, so our task is only to approve them.


Register Service

In the next step, we are going to register our newly created service. In order to do this, first let's select a system (in my case the SAP ECC and SAP Netweaver Gateway is installed together, but it can differ in your case).

For the case, if you don't have any entry in the list, you can find the relevant settings under the following path: SPRO -> SAP NetWeaver -> Gateway Service Enablement -> Backend OData Channel -> Connection Settings to SAP NetWeaver Gateway -> SAP NetWeaver Gateway Setting.

At last, push the button, Register in order to register our service.


In the popup window, the system gives us a prefilled screen again, so we only need to assign a Package, or mark our service as a Local Object, and approve the settings.


If everything went fine, you should see the same green traffic light.


Test Your Service in Browser

Now our service is active and running, so there is nothing left, then Test it! In order to test it in the simplest way, let's click on the button, Maintain.


If you have more than one service, then let's select the one with the technical name, ZGOODSRECEIPT_SRV.


At the bottom side of the window, we can find the different testing tools: we can test it in simple browser or using the built-in Gateway Client (that is actually an OData client). For the sake of the simplicity, let's push the button, Call Browser that opens a browser up for us with the appropriate service URL.


We can go further and test it in a browser directly with the following service URL (please replace xxxx.xxxx.com corresponding to you system settings):

http://xxxx.xxxx.com/sap/opu/odata/sap/ZGOODSRECEIPT_SRV/$metadata

Since our service doesn't do anything (it's an empty service), we got the following results back:


Summary

Our service is up and running. It doesn't do anything, but from now on, we can simply use it to authenticate into our system.

Next, we are going to move back to our Xamarin mobile app, and try to call this service using the URL (http://xxxx.xxxx.com/sap/opu/odata/sap/ZGOODSRECEIPT_SRV/), to login into our system.

I hope, you could follow me, and everything went fine. If not, then don't hesitate to leave me a comment below!

Stay tuned, keep reading! If you want to get notification about the newest posts, follow us or subscribe to our newsletter! If you liked it, please share it! Thanks!

blog comments powered by Disqus