Here the link to the latest download Download
Just unzip the sap2java.1.X.X.jar in the <eclipse_home>\plugins\ directory. The plugins directory will now have com.sap.plugin.Sid1.X.X directory in it. Copy you jco.jar/sapjco.jar file into this directory In that directory you will find test.jar which is needed for the plugin to run. Refer to the Readme file in that directory for more information.
Here is a sample scenario where a function module makes an outbound call --
Goto SE37 and create a Function module Z_TEST_SID. Make it RFC Enabled ( You should see it in Admin tab ). Create the following interfaces
Import params
RFC_PARAM4 SY-UNAME
Export params
RFC_PARAM3 SY-LISEL
RFC_PARAM5 BAPIRETURN
Table
ZIT_LEG_CLASS ZIT_CLS
ZIT_DET ZIT_OUT
The R3 function module code will be --
call function 'Z_TEST_SID' destination 'PROGID'
exporting
rfc_param4 = sy-uname
importing
rfc_param3 = rfc_param3
rfc_param5 = bapireturn
tables
zit_leg_class = zit_cls
zit_det = zit_out
exceptionscommunication_failure = 1
system_failure = 2.
Java CustomListener class will be --
package com.sap.bapi.util;
import com.sap.bapi.listener.SAPListener;
import com.sap.mw.jco.JCO;
import com.sap.generated.*;
public class CustomListener extends SAPListener
{
public CustomListener(String host, String progId , String gateway , String clientID, String userName, String passWord)
{
super( host, progId, gateway , clientID, _ userName,passWord);
}
public static void main( String a[] )
{
CustomListener s = new CustomListener("sapdev",_ "ProgID", "3300", "130", "username", "pass");
s.setPackageName("com.sap.generated");
}// handleRequest overrides superclass function
public void handleRequest(JCO.Function function)
{
// The first call should be to the super class function
super.handleRequest(function);
//Get the input Objects
Object input[] = super.getInput();
InputZ_test_sid in = (InputZ_test_sid) input[0];
if ( input[0] != null )
System.out.println ( "Input is >> " + in.getRFC_PARAM4() );
//Get the table Objects
Object tables[] = super.getTables();
if ( tables != null ) {
// Do processing.
//Set the table Objects.
super.setTables(s);
}
//Set the Output Structures
OutputZ_test_sid o = new OutputZ_test_sid();
o.setRFC_PARAM3("success");
setOutput(o);
}
}//end CustomListenerDont bother about the ZTable definitions .. The code tells you how to use the generated java objects to handle outbound calls from R3.
There could be a number of reasons
Plugin did not install properly . In this case Go Here
You are not able to connect to SAP using SAP-JCO. Here are the steps to install JCO.
No problems. If you don't want to use the plugin then you should do the following
Download the jar.
Extract test.jar from the downloaded jar file.
Write a java client which would call the SAP2Java class. Add test.jar to your classpath.
Here is how you can call SAP2Java to generate java-objects-
public static void main(String args[]){
String
host="r3dev";
String
client="110";
String
uname="username";
String
pass="passwd";
String
sysNo="00";
String
lang="EN";
String
basePath="/test";
String
packName="com.sap.generated";;
try
{
com.sap.bapi.mapper.SAP2Java s
= new
com.sap.bapi.mapper.SAP2Java(host,client,uname,pass,sysNo,lang);
com.sap.bapi.io.Filer.setBasePath(basePath);
com.sap.bapi.io.Filer.setPackageName(packName);
s.execute( fileName );
}catch ( com.sap.bapi.mapper.exception.BAPIException ){
}
}
The SAP Java Connector (SAP JCo) is a toolkit that allows a Java application to communicate with any SAP system. It combines an easy to use API with unprecedented flexibility and performance. The package supports both, Java to SAP System as well as SAP System to Java calls.
You can obtain the jCO.jar file from the SAP site( you will need a user id /password ).
Windows NT, Windows 2000
Unzip the file Note: If you already had an older version of JCo
installed on your system, please make sure that you delete the libraries
jRFC11.dll and jRFC12.dll from |
I am still working on it. However here is the link to the Partial Documentation
The data type mapping between ABAP and Java is based on the following set -
ABAP Type Java
Type
RFCTYPE_CHAR java.lang.String
RFCTYPE_DATE java.util.Date
RFCTYPE_BCD java.math.BigDecimal
RFCTYPE_TIME java.util.Date
RFCTYPE_BYTE byte []
RFCTYPE_NUM java.math.BigInteger
RFCTYPE_FLOAT double
RFCTYPE_INT int
RFCTYPE_INT2 short
RFCTYPE_INT1 byte
The function module meta data information is retrieved using the JCO.ParameterList's methods ( isStructure, isTable etc) . The mapping between the java and sap at runtime is done using the Reflection API
This gives an idea of how to use the plugin to generate java objects and how to extend the other sample classes available to make calls to R3 .
Coming Soon!
Send me a mail