Skip to Content

Android and SAP NetWeaver

Last November it was released the Android SDK, the first open mobile platform leaded by Google. To Promote development of applications for Android, next January 2, 2008 is beginning the Android Developer Challenge, which will provide $10 million in awards. I present an example to connect Android platform to SAP NetWeaver, feel free to use it in your applications, you have a big opportunity to participate in this incredible “ten million dollars developer challenge”.

Notes:
– You can use Android SDK in your Composition Environment or in your eclipse installation.

– Your Android emulator call to SAP NetWeaver backend by http/rfc. Android device/emulator is in public network and your ERP/CRM backend in a private network, you need to put a middleware, which take http public requests and convert them in RFC private calls, You can configure your PI/XI application to do it or try a simple middleware for testing your prototype ( The thinnest SOA middleware for SAP NetWeaver ).

 

Install Android SDK, Eclipse plugin and make your first Android application called AndroidSAP.
[http://code.google.com/android/intro/index.html | http://code.google.com/android/intro/index.html]

Include these files:

AndroidManifest.xml<br /><textarea cols=”47″ rows=”2″><?xml version=”1.0″ encoding=”utf-8″?>

<manifest xmlns:android=”http://schemas.android.com/apk/res/android

    package=”community.projects.androidsap”>

    <application android:icon=”@drawable/icon”>

        <activity class=”.AndroidSAP” android:label=”@string/app_name”>

            <intent-filter>

                 <action android:value=”android.intent.action.MAIN” />                      

                <category android:value=”android.intent.category.LAUNCHER” />

            </intent-filter>

        </activity>

        <activity class=”.LogonManager” android:label=”@string/app_name”>

            <intent-filter>                         

                <category android:value=”android.intent.category.LAUNCHER” />

            </intent-filter>

        </activity>       

        <activity class=”.FList” android:label=”@string/app_name”>

            <intent-filter>                         

                <category android:value=”android.intent.category.LAUNCHER” />

            </intent-filter>

        </activity>

    </application>

</manifest> </textarea><br /><br />main.xml (/res/layout/) <br /><textarea cols=”47″ rows=”2″><?xml version=”1.0″ encoding=”utf-8″?>

<TableLayout xmlns:android=”http://schemas.android.com/apk/res/android

     android:layout_width=”fill_parent”

     android:layout_height=”fill_parent”

     android:stretchColumns=”1″>     

     <Button

          id=”@+id/logon”

          android:layout_width=”wrap_content”

          android:layout_height=”wrap_content”

          android:text=”logon data”/>

     <TableRow>

          <TextView

               android:text=”airline”          

               android:textAlign=”end”

               android:padding=”3dip” />

       <EditText id=”@+id/airline”

           android:text=””

           android:padding=”3dip”

           android:scrollHorizontally=”true” />                  

          <Button

               id=”@+id/ok”

               android:layout_width=”wrap_content”

               android:layout_height=”wrap_content”

               android:text=”ok”/>

     </TableRow>

     <TextView

          id=”@+id/result”                          

          android:background=”@android:drawable/box”

          android:layout_width=”fill_parent”

          android:layout_height=”20dip”

          android:layout_weight=”1″

          android:scrollbars=”vertical”/>

</TableLayout>

</textarea><br /><br />logon.xml (/res/layout/) <br /><textarea cols=”47″ rows=”2″><?xml version=”1.0″ encoding=”utf-8″?>

<TableLayout xmlns:android=”http://schemas.android.com/apk/res/android

   android:layout_width=”wrap_content”

   android:layout_height=”wrap_content” 

   android:stretchColumns=”1″>

   <TableRow>

       <TextView

           android:text=”middleware”          

           android:textAlign=”end”

           android:padding=”3dip” />

       <EditText id=”@+id/sap_middleware”

           android:text=””

           android:padding=”3dip”

           android:scrollHorizontally=”true” />

   </TableRow>

   <TableRow>

       <TextView

           android:text=”host”          

           android:textAlign=”end”

           android:padding=”3dip” />

       <EditText id=”@+id/sap_host”

           android:text=””

           android:padding=”3dip”

           android:scrollHorizontally=”true” />

   </TableRow>

  

   <TableRow>

       <TextView

           android:text=”client”          

           android:textAlign=”end”

           android:padding=”3dip” />

       <EditText id=”@+id/sap_client”

           android:text=””

           android:padding=”3dip”

           android:scrollHorizontally=”true” />

   </TableRow>  

   <TableRow>

       <TextView

           android:text=”system”          

           android:textAlign=”end”

           android:padding=”3dip” />

       <EditText id=”@+id/sap_system”

           android:text=””

           android:padding=”3dip”

           android:scrollHorizontally=”true” />

   </TableRow>  

   <TableRow>

       <TextView

           android:text=”user”          

           android:textAlign=”end”

           android:padding=”3dip” />

       <EditText id=”@+id/sap_user”

           android:text=””

           android:padding=”3dip”

           android:scrollHorizontally=”true” />

   </TableRow>

     <TableRow>

          <TextView

               android:text=”password”          

               android:textAlign=”end”

               android:padding=”3dip” />

          <EditText id=”@+id/sap_password”

               android:text=””

               android:password=”true”

               android:padding=”3dip”

               android:scrollHorizontally=”true” />

     </TableRow>

     <TableRow

          android:gravity=”right”> 

          <Button id=”@+id/update”

               android:text=”Update” />

     </TableRow>

  

</TableLayout>

</textarea><br /><br />flist.xml (/res/layout/) <br /><textarea cols=”47″ rows=”2″><?xml version=”1.0″ encoding=”utf-8″?>

<LinearLayout xmlns:android=”http://schemas.android.com/apk/res/android

    android:orientation=”vertical”

    android:layout_width=”fill_parent”

    android:layout_height=”fill_parent”

    >

                   

  <ListView id=”@id/android:list”

        android:layout_width=”fill_parent”

        android:layout_height=”wrap_content”/>

       

       

</LinearLayout>

</textarea><br /><br />AndroidSAP.java (src/community/projects/androidsap/)<br />

FList.java (src/community/projects/androidsap/)<br /><textarea cols=”47″ rows=”2″>package community.projects.androidsap;

import android.app.ListActivity;

import android.os.Bundle;

import android.widget.ArrayAdapter;

public class FList extends ListActivity {

     

     private String[] mStrings;     

     

    /** Called when the activity is first created. */

    @Override

    public void onCreate(Bundle icicle) {

        super.onCreate(icicle);

        setContentView(R.layout.flist);

        Utils.readFile(this);

        mStrings = Utils.callRFC( “BAPI_FLIGHT_GETLIST”, “FLIGHT_LIST” );

        ArrayAdapter<String> a = new ArrayAdapter<String>(this,android.R.layout.simple_list_item_1, mStrings);

        setListAdapter(a);

    } 

     

   

}</textarea><br /><br />LogonManager.java (src/community/projects/androidsap/)<br />

Utils.java (src/community/projects/androidsap/)<br />Android Home – http://code.google.com/android/
Android Videos – http://www.youtube.com/profile?user=androiddevelopers
Android Documentation – http://code.google.com/android/documentation.html
Android Developer Challenge – http://code.google.com/android/adc.html

 

 

16 Comments
You must be Logged on to comment or reply to a post.
  • Ignacio!

    Wanted to post a comment since the last couple of days…However a small bug on SDN keep me away…

    It’s really nice what you have done with Android…I download the plug in a few months ago, but never actually try it…Now you have give me a nice tip to start with -;)

    Greetings,

    Blag.

  • Hi Ignacio,

    very nice blog…and nice dev tool too!!!Perhaps will get life of mobile programmers a little easier(at last!!!)

    keep in touch,
    Paolo

    • Thanks Paolo
      I see in your business card you have a lot of knowledge areas, please take note blog system is open to all community members, it could be great reading about your experiences here.
      Regards,
      Ignacio.
  • Hello Ignacio,

    This is a superb application you have developed.
    It will be of tremendous help to all mobile developers.

    I am trying it out. I needed some help with the connection part.
    Could you please explain what is supposed to be entered in:

    1) Middleware
    2) Host

    I am currently entering IP address and port of the ECC system in my company’s landscape in Middleware. Other details like Client, User and password are entered correctly but I am still not able to connect to the backend.
    Also, neither error is displayed nor output.

    It would be very helpful if you could please provide me with the details.

    Thanks & regards,
    Mayuresh Kanvinde

  • Ignacio ,
    I was looking at integrating the same with Netweaver too but then am interested to know how you have called the BAPI from within the example you have provided…

    • Ok I made some modifications in the xml file and I can see the screen on the emulator. My question is that my machine is connected to SAP system through VPN, can I connect to that SAP system? OR I MUST have a public IP?

      Please let me know
      V

    • I am seeing in Android site that version 1.1 is from February 2009, this blog is older, I think maybe you have to do some turnaround to adapt to it to newer versions.
      Regards,
      Ignacio.
  • One more things is that post Android 1.2 I guess – VPN support is enabled…

    to test your application – login using VPN on your system and then execute your application – you should be able to connect , and you would have to configure the VPN access on your mobile device for you to be able to use the same in your application.

    • hi Arun / all
      please feel free to take material from this blog and prepare a new version of the prototype including VPN access or other new features.
      Thanks,
      Ignacio.