Goal for the Blog
In this blog I want to show how to implement an “ABAP calls Java” scenario.
On the Java side, we will implement a very simple Enterprise Java Bean (EJB) that echoes a string. On the ABAP side, we will call the EJB, pass a string and print the result of the function call including any error messages that might occur.
Using the example provided in this blog series, you will be able to
implement the Java and ABAP side of an “ABAP calls Java” RFC scenario
configure the connection
apply the solution in a componentized scenario (using SCs and DCs instead of mere EAR and JAR archives)
understand the difference between the old JCO Framework and the JCO RFC Server.
We will use an up-to-date set-up and freely available software.
On the Java side, we’re going to work with CE 7.1 and use a software component, development components and public parts so you can easily transfer the example to an NWDI development scenario. The CE server can be downloaded from SDN.
On the ABAP side, we’re going to work with release 7.01 (7.00 with Enhancement Package 1) because it’s the most recent evaluation version you can download on SDN.
On my laptop with 3 GB of RAM I run the CE and the ABAP Server in parallel. The CE 7.1 SP01 is installed as system CE1 with system number 01, while the ABAP 7.01 is installed as system NSP with system number 02 and client 000.
The NetWeaver Developer Studio 7.1 installation comes as part of the CE download.
Differences between the JCo and JCo RFC Provider
While the Java Connector or JCo is an excellent framework you can use to call ABAP from Java or Java from ABAP, it has its limitations.
You can use the classic JCo framework to provide an RFC function which can be called from ABAP. It performs well because it supports techniques such as connection pooling and makes efficient use of system resources. A function implemented in Java using the classic JCo framework may be called from ABAP just like a regular function module. It works by starting a server program which binds to a TCP port and dispatches incoming calls to a method of a Java handler class.
Alas, the classic JCo framework doesn’t fit into a Java EE server environment. Of course you could write an EJB which starts the server program on the host, but that leads to unpredictable results if the server is a cluster consisting of several nodes. Also, re-deploying the application will result in different versions of the handler class being alive at the same time, leading to random run-time behaviour of your application, which is probably not what you expect.
Also, the classic JCo framework is not integrated with SAP’s AS Java. For example, connections to ABAP systems cannot be configured in the NetWeaver Administrator.
This is why the JCO RFC Provider was created. It is the JCo for the Java EE server environment, suited especially to the SAP AS Java. This means that it makes use of the server’s capabilities such as clustering and can be configured as well as started and stopped using the NetWeaver Administrator.
Road-map for this multi-part blog
This is the road-map for the blog.
ABAP calls Java via RFC (1): Introduction
ABAP calls Java via RFC (2): Setting up the Project
ABAP calls Java via RFC (3): Creating the Development Components
ABAP calls Java via RFC (4): Implementing and Deploying the Enterprise Java Bean
ABAP Calls Java via RFC (5): Configure the Connection and Run
In the next part…
…we will talk about installing the Java and ABAP server and the Netweaver Developer Studio.
Links to new parts of the series will be added here as soon as they become available.
I hope to see you again in the ABAP calls Java via RFC (2): Setting up the Project.