Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SAP JCo: JCoDestination vs. JCoClient

Tags:

java

sap

jco

bapi

I'm calling a function in SAP from Java with the JCo library. So far my call works, but when I look for help in the Internet, there is always a JCoClient that is being used to get the functions, making commits etc.

But a JCoClient class does not exist in JCO 3.

Instead I use an instance of the JCoDestination that I created with a config file.

What is the difference between JCoClient and JCoDestination? And why is nobody talking about JCoDestination, but always JCoClient?

like image 393
FiveO Avatar asked Oct 24 '12 08:10

FiveO


People also ask

What is JCo connection SAP?

The SAP Java Connector (SAP JCo) is a development library that enables a Java application to communicate with SAP systems via SAP's RFC protocol. The SAP JCo supports both communication directions: inbound Remote Function Calls (Java calls ABAP) as well as outbound Remote Function Calls (ABAP calls Java).


2 Answers

The SAP Java Connector has been completely reworked from 2 to 3 version. The old JCO.Client class has been substituted with JCoDestination, but it's not just a name change, the library architecture changed completely, so porting code from JCo 2 to JCo 3 is not just a matter of changing class names. For example, to connect to a SAP service with Jco 2 one had to write something like this:

JCO.Client client = JCO.createClient(...);

client.connect();

whereas with JCo 3 you have:

JCoDestination destination = JCoDestinationManager.getDestination(serviceName);

You can find information about the two libraries at this URL. Furthermore, at this link there is a detailed guide for migration from 2 to 3. The latter link can also be accessed from the left side index on the former link, from which you can access information about client programming in both versions.

like image 143
remigio Avatar answered Sep 29 '22 09:09

remigio


Most of the "stuff" you'll find will implicitly refer to the old version (2.x) of the Java Connector. You can still grab that version from SAP, and I'd encourage you to do so - not to use it, but to compare the javadoc. You'll see that the class structure was changed radically between the 2.x and 3.x releases (and to the better, I'd say). However, that means that you have to re-work many of the examples because the class names have changed.

like image 34
vwegert Avatar answered Sep 29 '22 10:09

vwegert