Additional Blogs by Members
cancel
Showing results for 
Search instead for 
Did you mean: 
Former Member
0 Kudos

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