[9/29/2014] – Please note that GWPA (available with Eclipse Juno) is superseded by SAP Mobile Platform Tools (Eclipse Kepler). SAP has officially ended the support of Eclipse Juno and hence you need to now use Eclipse Kepler and work with SAP Mobile Platform Tools.
You can refer SAP Development Tools for Eclipse and also this blog How to install SAP Mobile Platform Tools for Integration Gateway in Eclipse Kepler for more details.
Refer End of support for Eclipse Juno in SAP HANA Cloud Platform Tools planned for end of June 2014 for more details on Eclipse Support
It was my dream to build at least one android application which will display SAP data on mobile/tablet devices. As I am not very much skilled in developing android application, I was struggling on how to start with this. And then I came across GWPA and started exploring it. I explored it; I liked it and now I’m loving it!
It is very simple to create android application consuming OData with the help of Gateway Productivity Accelerator (GWPA) plug in installed on Eclipse IDE.
Let’s get into the details,
In this technical blog, I will focus on how we can build simple Android application consuming OData service with the help of SAP NetWeaver Gateway Productivity Accelerator (GWPA).
To know more about GWPA, please refer http://scn.sap.com/community/netweaver-gateway/blog/2013/06/03/gateway-productivity-accelerator-10-launched
It can be downloaded from https://tools.hana.ondemand.com/#gateway
We need to follow steps as mentioned below [Reference – https://tools.hana.ondemand.com/#gateway ]
To start using SAP NetWeaver Gateway Productivity Accelerator (GWPA), proceed as follows:
- Download and install Java SE6 .
- Download and install the Eclipse IDE for Java EE Developers from Eclipse .
- Install the SAP NetWeaver Gateway Productivity Accelerator (GWPA) feature(s).
From the Eclipse menu, choose Help > Install New Software…
Add the URL https://tools.hana.ondemand.com/juno.
Select the feature(s) you want to install and follow the steps of the installation wizard.
For information about the individual features, see the documentation.
To Develop Android application using GWPA, we need to install Android SDK tools on Eclipse IDE and then install GWPA features.
- Toolkit for Android (GWPA)
The Android Toolkit consists of an environment, a pattern and templates, suitable for developing SAP solutions for use in the Android environment.
Prerequisite for installation of this feature is to install the Android SDK Tools.
Once you install Android SDK tools, it will look as below under Window –> preferences.
After doing all these steps, I faced issue with android application regarding getting error, “R cannot be resolved to a variable” and hence after searching lot on it, I resolved it by installing Android SDK Build-tools and hence your Android SDK Manager image should look as below.
After this step, you can start installing Toolkit for Android (GWPA) as mentioned below. You need to select checkbox for Toolkit for Android (GWPA).
Once installed successfully, you can open Windows –> Preferences and check under SAP NetWeaver Gateway.
Please note: we do not require separate installation for SAP OData Mobile Client SDK.
With all above required steps, you are now ready to develop Android application!
Create new project. Under OData Development, select Starter Application Project.
Give appropriate project name, select Build Target and package name and press Next.
We can create 3 types of application using below templates. Here, we will select List/Details Application.
Now, we need to select service URL from Remote location. Click on Catalog.
Click on Manage Connection if no connection is maintained earlier.
As displayed below, provide required details and click OK.
P.S. – If you do not have access to SAP NetWeaver Gateway system then you can access demo system from SAP at http://scn.sap.com/docs/DOC-31221?rid=/webcontent/uuid/1051f6d9-e87a-2e10-d188-e2786c7878b1 and accordingly configure connections and access OData services. Please refer my blog http://scn.sap.com/community/developer-center/front-end/blog/2013/05/31/how-to-create-sapui5-application-consuming-gateway-service-with-the-help-of-sap-nw-gateway-plugin and see section Additional Details for more information.
If the connection is made, you will be able to see services. For this demo, we will select service RMTSAMPLEFLIGHT and click OK.
Provide Activity title, select Activity type and add fields.
Add 2nd Activity of type Details.
We selected Flights as List activity and FlightBooking as Details Activity. Our final project structure will look something like below screen.
As displayed below, SAP Gateway system service details will be found under res/raw folder.
Also the auto-generated code provides commented code to handle Sybase Unwired Platform (SUP) server mode. This is really nice feature as when we have SUP, we need not to modify much logic.
Now we are ready with Android application and want to test it. To test android application, you can use Real device or Android Emulator http://developer.android.com/tools/help/emulator.html
We need to manage device using AVD. Please refer http://developer.android.com/tools/devices/index.html
An Android Virtual Device (AVD) is an emulator configuration that lets you model an actual device by defining hardware and software options to be emulated by the Android Emulator.
As displayed below, AVD can be added.
Now we are absolutely ready to test our application on emulator. We need to test as mentioned below,
Under Console screen, you will be able to see the log of AVD launch etc…
Please note: Android emulator sometime is very slow and hence you need to be patience and can take break for Coffee 😎 .
AVD will launch emulator device as displayed below,
Here sometime you need to press F2 or keyboard commands as per your AVD settings. Refer Keyboard commands at http://developer.android.com/tools/help/emulator.html
You may see screen as below. Here you can see all your Android based application. In this case, you can see MyFlightAndroidApp. Double click on app icon.
It will launch login screen. Provide credentials that you used while connecting to your gateway SAP system.
Under LogCat window, you will see the log of application being executed.
After successful launching, you will see the Flights list view.
Selecting any item will open details screen for FlightBooking as below
You can search for different flight id and it will be displayed accordingly.
Note that under LogCat window, all these events will be logged which can be very useful for troubleshooting purpose.
Closing Remarks –
With the help of SAP NetWeaver Gateway Productivity Accelerator (GWPA), we can create Android application with very minimum efforts.
This step-by-step blog is written to explain how we can,
- Install Android SDK tools, GWPA etc. in Eclipse IDE.
- Configure SAP NetWeaver Gateway system and search for OData services
- Create simple Android application
- Configure and Launch Android application on ADV
- Use Console and LogCat for troubleshoot purpose
GWPA is extremely helpful tool from SAP to leverage OData capability and it will certainly helpful for all developer community who want to develop simple android application based on SAP business suite data in the form of OData.
It is generating starter application which we can modify as per our business/organizational requirement 🙂