Question

I want to create a communication between my Java web application and SAP. I used Java Connector and have put it in library and class path. But when I try to import the package com.sap.mw.jco.*, the program shows a compilation error. I can see that this package is not available in sapjco.jar.

This is my code snippet

// basic import statements

  import com.sap.mw.jco.*;

  public void createSnippet() throws JCoException{

         JCO.Client mConnection =
         JCO.createClient("xx", // SAP client
             "xx", // userid
             "xx", // password
             "xx", // language (null for the default language)
             "xx", // application server host name
             "xx"); // system number
  JCoFunction function = dest.getRepository().getFunction("BAPI_CR");
  JCoTable eqptable=function.getTableParameterList().getTable("EQU_LIST");
  eqptable.appendRow();
  eqptable.setValue("TEST1", "MY_VALUE1");
  eqptable.setValue("TEST2", "My_VALUE2");
    connection.execute(function);
 }

The issue I am facing with is, it is not allowing the import statement.

Était-ce utile?

La solution

Finally I found out that com.sap.conn.jco.JCo is an alternative for com.sap.mw.jco, and the alternaive is available in sapjco.jar. This was also suggested by Seelenvirtuose.

But the classes in this jar may be slightly different than the other one.

http://www.finereporthelp.com/download/SAP/sapjco3_linux_32bit/javadoc/com/sap/conn/jco/JCo.html

Check the above link for its properties

Thank you

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top