How to connect to an SAP system using sapjco3 and Eclipse?

I need to connect to SAP Systems through standard BAPI calls. I already installed JCo (sapjco3) and added .jar to my build path in Eclipse.

But because I'm pretty new to network / server programming, I have no idea how to set up a connection between Eclipse and SAP systems ... can anyone provide a basic solution or some ideas for this?

Thanks and hi!

+5
source share
5 answers

I resolved the issue myself, finding good documentation with examples on this topic on the SAP home page. First you need to determine the destination , basically configure your host and all other relevant information for the network connection. You can find it here: http://help.sap.com/saphelp_nwes72/helpdata/de/48/5fb9f9b523501ee10000000a421937/content.htm

You can then test your connection by creating a method that receives the attributes of the server you are connecting to. You can find the code here: http://help.sap.com/saphelp_nwes72/helpdata/de/48/840186ab5a2722e10000000a42189d/content.htm?frameset=/de/48/874bb4fb0e35e1e10000000a42189c/frameff6/6f6f6b6_4_4_4_4_4_4_4_8_8_6_8_6_4_4_4_8_4_4_4_4_4_4_4_4_4_4_4_4_4_4_4_4_4_4_4_4_4_4_1j1rj1f0e0e0e0e0e0e0e0ee0e0eee0e0eeeeeeeeeeeeeeeetttttttttjttt4 needs to know their code / plain .htm & node_id = 498

The site provides good examples of working with the SAP system in Java.

+5
source

Configuring an SAP Connection Using SAP JCO3 in Eclipse IDE One You can configure an SAP application connection with a Java application using the following steps:

Production Steps:

  1. Download the SAP Java Java Connectors SAPJCO3 (32-bit or 64-bit based on your system architecture) from the SAP Marketplace.
  2. Create a separate folder, save the downloaded sapjco3 zip file and unzip it.
  3. Copy the location of the sapjco3.jar file to the newly created folder.
  4. Now go to Environment Variables and create the CLASSPATH system variables if they do not exist, and add the location sapjco3.jar and then; ex: D:\sapjco3-NTAMD64-3.0.16\sapjco3.jar;
  5. Edit the system variable PATH and add the newly created folder, and then; for example: D:\sapjco3-NTAMD64-3.0.16;
  6. Now go to Eclipse and create a new project.
  7. Create a new class with any name to connect to the SAP application.
  8. Right-click on the newly created project, go to the build path and click "Customize build path".
  9. Click on libraries and add external banks.
  10. Now select the sapjco3.jar file sapjco3.jar just downloaded.
  11. Make the name of your class the same as you created in step 7.
  12. Write Java Code
+1
source
 import com.sap.conn.jco.ext.DestinationDataProvider; import com.sap.conn.jco.JCoDestination; import com.sap.conn.jco.JCoException; import com.sap.conn.jco.JCoDestinationManager; import java.util.Properties; public class TestMySAP { public static void main(String[] args) { // This will create a file called mySAPSystem.jcoDestination String DESTINATION_NAME1 = "mySAPSystem"; Properties connectProperties = new Properties(); connectProperties.setProperty(DestinationDataProvider.JCO_ASHOST, "yoursaphost.yourdomain.com"); connectProperties.setProperty(DestinationDataProvider.JCO_SYSNR, "00"); connectProperties.setProperty(DestinationDataProvider.JCO_CLIENT, "100"); connectProperties.setProperty(DestinationDataProvider.JCO_USER, "youruser"); connectProperties.setProperty(DestinationDataProvider.JCO_PASSWD, "******"); connectProperties.setProperty(DestinationDataProvider.JCO_LANG, "en"); sap2.createDestinationDataFile(DESTINATION_NAME1, connectProperties); // This will use that destination file to connect to SAP try { JCoDestination destination = JCoDestinationManager.getDestination("mySAPSystem"); System.out.println("Attributes:"); System.out.println(destination.getAttributes()); System.out.println(); destination.ping(); } catch (JCoException e) { e.printStackTrace(); } } } 
0
source

In Docker for your application

 FROM niels58/java8:latest ARG JAR_FILE ARG SPRING_PROFILES_ACTIVE ARG LD_LIBRARY_PATH ARG CLASSPATH ENV SPRING_PROFILES_ACTIVE=${SPRING_PROFILES_ACTIVE} \ LD_LIBRARY_PATH=${LD_LIBRARY_PATH} \ CLASSPATH=${CLASSPATH} RUN export PATH=$PATH:${LD_LIBRARY_PATH} && \ export PATH=$PATH:${CLASSPATH} && \ env RUN mkdir -p /opt/sap/ COPY src/main/resources/lib/* /opt/sap/ COPY ${JAR_FILE} app.jar RUN ["java","-jar", "/opt/sap/sapjco3.jar"] ENTRYPOINT [ "java","-Xmx1024m","-Djava.security.egd=file:/dev/./urandom","-jar","/app.jar" ] 
0
source

The answer posted by @JanKonrad worked for me on the SAPJco3 jar file.

0
source

All Articles