Mobile SAP Client (Android): android SAP Customer search client demo
– Update
The app currently available on the market doesn’t work with the default settings anymore. The default settings use the SDNs ES Workplace ERP server as backend and uses the function module “RFC_READ_TABLE” directly via web service. But a necessary service on the server was deactivated.
So it is only possible to use/test the app at the moment if you connect it with your “own” SAP backend. You can do this by using “Menu -> Settings” and provide endpoint, username and password of your externally accessible SAP system.
e.g.: http://ERP_HostName:ERP_HttpPort/sap/bc/soap/rfc
Background
The android mobile OS is one of the buzz words seen very often in the media in the last weeks or month. The OS that can be used by all mobile phone vendors free of charge is one of the most important challengers of the iPhone and the Blackberry phone.
Motivation
One of the ideas behind the OS was making app development for the platform quite easy for 3rd party developers and provide a tool to easily distribute or sell the apps to all interested users to them: the android market — comparable to the iPhone app store.
So the only thing you need to start developing whatever app you can think of is some spare time. You can find all the necessary tools here: http://developer.android.com. You don’t event need a android phone. The android emulator is enough to develop.
Idea
Because of this I developed a simple android demo/proof of concept app that searches SAP ERP clients by name — by name patterns –, comparable to a standard SAP search help and that displays the customer data.
Find the necessary ingredients
To do this, I simply utilized the SAP function module “RFC_READ_TABLE” exposed as a web service. Of course there are a lot of more specific web service available in SAP to search customers, but this one is a fast approach for this POC. After all, this function module is available in every ABAP system and SAP version.
Because the android phone needs to access public available web service — outside corporate firewalls — , I decided to use the SAP ERP system of the SDN ES Workplace. You can find the wsdl-file to the ws here ( you have to apply for a user for the es workplace first):
http://erp.esworkplace.sap.com/sap/bc/soap/wsdl11?services=RFC_READ_TABLE&sap-client=800
The android version 1.6 and up is capable of connecting to your corporate network via VPN. This could be used to connect your phone to the SAP backend. One other possibility is to deploy a kind of proxy ( or middleware) between the SAP and the internet. Or just make the http port of your sap server available to the internet (at own risk).
The next problem is that the android SDK does not provide a soap client implementation. Some Google searches pointed me to an old fellow: the kSOAP2 (http://ksoap2.sourceforge.net/) lib. This is a soap client implementation targeted at J2ME application. Though i found out later that it has it’s limitations, it did a good job in this POC.
Put it all together
I don’t want to go to much into detail, but if your interested, i can send the code.
Android SDK provides UI Element (view) that with the name AutoCompleteTextView (http://developer.android.com/reference/android/widget/AutoCompleteTextView.html).
This is a simple text input box that displays predefined suggestions after every letter the user types into it. e.g. an auto complete for county search would perhaps suggest “Germany” and “Georgia” if the user types “Ge”.
This view does a query for suggestions each time a new letter is typed ( or deleted).
So my implementation queries the SAP (via web service) for clients that match the letters (2 letters minimum). In my case, i do the matching against the name (kna1-Name1), customer number, street and city. So, IF the user types “Ne Wa”, SAP could find customer “John Washington” in “New York” or customer “Isaak Newton” in Washington 🙂
When the customer is found and selected, the app displays it’s master data and enables the user to view his location an Google maps. ( you can think of more – e.g. show his sales history, his sales charts)
There is also a settings screen for the web service. With this settings, your able to connect to your server. The EndPoint looks like “http://yoursaphost:saphttpport/sap/bc/soap/rfc“.
Result
See yourself. The video provides a real device demo.
Look at the video or just install from the market place (even without a android phone http://android.modaco.com/content/general-discussion/289928/testing-getting-an-emulator-up-and-running-a-full-rom-with-the-market-etc/ ).
I was surprised how fast the online search is, even on medium quality network connection.
This is only my first POC. Think what is possible. Create orders in ERP/CRM … . Look up all kind of data. Combine SAP ERP with non-SAP data … Ideas welcome
Video
See the app on an real device:
Could you send me the code? Or post it somewhere on SDN?
Thank you,
Michelle
mcrapo@perrigo.com
You mention you are happy to share the code. Could I suggest you posting it to http://code.google.com. If not I would certainly like a copy it.
Thanks
Andrew
please change webservice endpoint, username an pw in toe code or in the settings to reach your server.
Thomas
Thomas
That's funny, I wrote a blog 2 weeks ago explaining how to consume SOAP Web Services with Android : The specified item was not found.
Regards,
Pierre
This is a great example. I used the same approach for my first POC and then switched to REST Web Services. I'll write a blog regarding this topic as soon as I can.
Regards,
Pierre
Yes, you are right. When I did the research for my app some weeks ago, I found out that the main reason that google did not provide a soap lib is the overhead. But is is very convinient to use soap in a SAP context. KSOAP is the lib mentioned the most in consuming soap services with android. Thougth I think KSOAP has its limitations. It seems to be impossible to process xml like "Prehaps it is necessary to paras xml by hamd
longlaketech@gmail.com
Check it out at http://code.google.com/p/spapandroid .
As I nentioned in another response, i think ksoap can not work with all SAP wevservices..
So i use a different approach now (manual xml request generation and response parsing. There is also some code for this in the rep. ) i cant give you more detail now because i am chilling at an thailand beach right now.
Excellent blog and I have been trying to do the same thing since the introduction of SDK 1.6. I'm actually executing a BAPI in the SAP system and getting a runtime error that process is stopped. My question to you is my machine is connected to the SAP system via VPN, can my emulator still connect to SAP?
Could you please send me the code at "to_vaib@yahoo.com"
Vaib
As far as I remember you should be able to connect to your system within the emulator if the machine is connected to your network via VPN. Just try to open a random internal webpage in the web browser of the emulator to check.
Note : the code is available here -> http://code.google.com/p/spapandroid
Regards,
Pierre
Thank you for this great blog!!
I am trying out a similar scenario and I am absolutely new to this.I am not able to download the Project from the URL given by you. could you please send me the Project at abhirbhat@hotmail.com
Thanks & Regards
Abhishek
http://code.google.com/p/sapandroid/
Also look at this, it's another (more advances) project connection android to sap:
http://code.google.com/p/crmdroid/
Thanks a lot for the link :-).
But i cannot co relate or assemble anything as i am a novice. Can you please mail the project zip file to abhirbhat@hotmail.com so that i can import it in eclipse and find my way around.
Regards,
Abhishek
I am new to this and try to learn SAP android could you please send me the Project at zzgl.kahraman@gmail.com
I'm learning SAP-Android, could you please send me the code to know how you did it?
my e-mail is: acss2@hotmail.com
Thanks in advance.
hi guys , i tried the above links but the code is no more available .
Any one can pls provide a fresh link ???
regards
sameer