Issue
I try to connect ANDROID with SAP system via RFC... Is that possible ? I think its possible because this video shows de connection but I don't know why JCo version (he uses strange classes)
I am working on Windows 7 (x86) and Eclipse IDE.
I have added sapjco.jar
to the library project,
added these files to SYSTEM32 FOLDER( sapjcorfc.dll
, librfc32.dll
)
That´s my code:
package com.example.jco32;
import android.app.Activity;
import com.sap.mw.jco.*;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.Toast;
public class MainActivity extends Activity {
JCO.Client client = null;
JCO.Function funcion = null;
JCO.Table t_spfli = null;
IRepository repositorio = null;
IFunctionTemplate ftemplate = null;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Button clickButton = (Button) findViewById(R.id.button1);
clickButton.setOnClickListener( new OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
ejecutarjco();
}
});
}
> public void ejecutarjco() {
> System.out.println("i entered to hte method");
try {
client = JCO.createClient("100",
"USER",
"PASS",
"EN",
"/H/111.22.52.198/W/TESTING/H/172.25.10.21",
"02");
//abre la conexion
System.out.print("BEFORE CONNECT()");
client.connect();
Toast.makeText(getApplicationContext(),
"connected", Toast.LENGTH_LONG).show();
System.out.print("connected");
} catch (Exception e) {
System.out.println("Error:" +e.getMessage());
}
}
}
Unfortunately I got the next error (all lines below are actually prefixed 09-26 02:03:48.934: E/AndroidRuntime(670):
, e.g. the first line FATAL EXCEPTION: main
is actually 09-26 02:03:48.934: E/AndroidRuntime(670): FATAL EXCEPTION: main
):
FATAL EXCEPTION: main java.lang.ExceptionInInitializerError at com.example.jco32.MainActivity.ejecutarjco(MainActivity.java:46) at com.example.jco32.MainActivity$1.onClick(MainActivity.java:34) at android.view.View.performClick(View.java:3511) at android.view.View$PerformClick.run(View.java:14105) at android.os.Handler.handleCallback(Handler.java:605) at android.os.Handler.dispatchMessage(Handler.java:92) at android.os.Looper.loop(Looper.java:137) at android.app.ActivityThread.main(ActivityThread.java:4424) at java.lang.reflect.Method.invokeNative(Native Method) at java.lang.reflect.Method.invoke(Method.java:511) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551) at dalvik.system.NativeStart.main(Native Method) Caused by: java.lang.ExceptionInInitializerError: JCO.classInitialize(): Could not load middleware layer 'com.sap.mw.jco.rfc.MiddlewareRFC' null at com.sap.mw.jco.JCO.<clinit>(JCO.java:776) ... 13 more
I hope your help. Regards
Solution
This won't work. JCo requires a native library that is not available for Android platforms.
Answered By - vwegert
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.