With this in mind, I set out to create a connector that wraps up the JCo and provides a ready-to-use foundation for Eclipse RCP applications, and I’ve decided to release this project as an Open Source application under the terms of the Eclipse Public License. Let me take you on a short tour of the features of RCER (pronounced racer: R/3 Connector for Eclipse RCP) – I’ll provide a more in-depth discussion of the features in the next blog posts.
One of the first things you’ll notice is the somewhat cumbersome installation process – you have to install a bootstrapping wizard, import the JCo and only then install the full SDK. Sorry for this, but the licensing policy of the JCo specifically prohibits redistribution.
On the other hand, this process already demonstrates the first advantage of RCER – you’ll get the platform-independent plug-in and the platform-specific features containing the binaries with a few clicks, complete with platform filters and all. The entire process is described in the installation instructions.
If you configure your application to include the connection management plug-ins, you’ll get a nice UI to configure the connection data for free. This is fully integrated into the Eclipse Preferences dialogs and storage:
You’ll also note a small display in the status bar of your application that will keep you informed of whether the application is currently connected to a SAP R/3 system. Using the context menu, you can connect to and disconnect from the systems and switch between multiple active connections without having to log out and log in every time you move to another system.
Of course, RCER also provides a login dialog. While you can enforce a login process, this is hardly necessary – just request an active connection and the connection management will decide whether a login is required automatically. Obtaining a connection is about as hard as ConnectionManager.getInstance().getDestination().
If you’re planning on writing a console application – no problem, the non-interactive parts of the connection data management is separated from the UI so that you can re-use most of the components. You can also choose not to use the preferences storage at all and just plug-in your own connection data and credentials provider.
Basic RFC Tools
Every SAP R/3 system comes with a function module named RFC_READ_TABLE that is very convenient for accessing customizing and other data for which no other interface exists. Due to the generic nature of this function module, it’s a bit tedious to parse the results – it just returns a list of strings, and you’ll have to separate the fields based on position and length. RCER comes with a class named TableReader that will do just this for you – just initialize it, set the selection criteria (and optionally select the fields to be read) and get an iterable result with records split into fields.
In other news, RCER also provides a set of classes to deal with the (in)famous BAPIRET2 structure – not as exciting, but very handy in daily coding.
RFC Mapping Language
If you’ve already used the JCo, you’ll know how much boilerplate code you’ll have to write to get a single RFC call done (error checking omitted!):
Now imagine that you’ll have to do this for a more complicated call with several tables of input and output data – or rather, don’t. BTW, did you notice the typo? It’s FLIGHTLIST, not FLIGTHLIST – and no way to prevent this either.
With RCER, you’ll get a DSL and some tools to make life (or at least RFC calls) easier. The SDK comes with a wizard that lets you select any number of function modules and will then generate a mapping definition for you that looks like this:
From this almost self-explanatory definition, RCER will generate the java classes required to hold the data perform the actual RFC call. The classes contain support for property change listeners and can be plugged into the databinding components without further adaption. And remember, you don’t have to write the mapping definition yourself, it is generated from the function module interface. All you’ll have to do is adapt the Java field names and optionally the comments. Oh, and you don’t need to use RCER in your project to benefit from the code generator – the generated classes require only the JCo to run, so you can use them as you would in any Java project.