thespot4sap.com independent sap information
 

get SAP Access - pay monthly

SAP Tutorials    Online SAP Training    SAP CBT's    SAP Forums    SAP Articles    SAP Jobs    SAP Resumes
  SAP Access    SAP Blogs    SAP Books     Links     SAP Vendor Directory     Submit Content    Search

New Page 1

Previous Page

Next Page

SAP Netweaver
- Java Connector -

Page 5 of 6

6.0 Using the SAP Java Connector

SAP’s new Java middleware, the SAP Java Connector (JCO) allows customers and partners to easily build SAP-enabled components in Java. JCO supports both inbound (Java calls ABAP) and outbound (ABAP calls Java) calls in desktop and server applications.

In this Sample Program we connect to SAP and call two BAPIs.

Import statements: Any program using JCO should contain the following import statement:

import com.sap.mw.jco.*;

Otherwise, you have to fully qualify each class and interface which is very inconvenient.

Connecting to SAP

JCO.Client mConnection;

A connection (or session) with SAP is handled by class JCO.Client

try {
mConnection =
JCO.createClient("400", // SAP client
"c3026902", // userid
"********", // password

"EN", // language
"iwdf5020", // host name
"00"); // system number
mConnection.connect();
}
catch (Exception ex) {
ex.printStackTrace();
System.exit(1);
}

"A Client object is created via a call to createClient(). You can use a specific application server (as in the above code) or a server group (load balancing)." REFER the JCO Javadoc for the overloaded createClient() method for the latter possibility.

"The Client class's connect () method tries to log on to SAP. If that fails for any reason, an exception is thrown. If the call succeeds, we can now stay connected for as long as we like. When we are done, we can call disconnect () to explicitly log off."

Next Page

Previous Page

 

New Page 1

 

 


About Us   Contact Us   Privacy   Disclaimer   Feedback   Email Discussion   Newsletter  

Copyright © - Independent SAP Information
Learn XML, Guesthouses and B&B's