简体   繁体   中英

SAP JAVA issue with package installation

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.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM