apache > cocoon

Web3 Connectivity Toolkit


EFP Consulting Austria produced an open-source library called Web3 that allows you to integrate SAP R/3 seamlessly into Cocoon 2. With these components you are able to call Remote Function Calls via an easy to use XML-syntax. For most BAPIs and Remote enabled Function Calls you simply need a text editor.

This toolkit offers you ...

  • ... synchron communication to any SAP system above release 3.1H.
  • ... easy to use ABAP function calls from outside R/3 with a se37-like markup-syntax.
The following guide helps you to setup cocoon with your SAP R/3. Reasonably this guide cannot answer all questions dealing with your environment. For further questions be advised to contact your favorite SAP Consultant.

Installing SAP R/3 (TM) JavaConnector

Be sure to proper install the appropriate SAP Java-Connector from www.sap.com. To install the connector refer to the included documentations.

Configuring cocoon.xconf

With Web3 you have a flexible Toolkit where you can connect to multiple R/3 System within one single Cocoon- Instance. Enter your backend configuration into cocoon.xconf like this:


Configuration elements




Declare your logger here.


The pool element is the logical unit of all your SAP settings.


The systems client you log onto.

user, password, language



The route to your SAP system. Please refer to your SAP help to prepare the connection string.


The system-number of your SAP system you log onto.

gateway, program-id

Are mandatory and not used within Web3's szenario.

Specifics on the pool element


a boolean switch whether to use JCO's facility to trace the communication layer or not.


if @trace is true set the trace-level to your prefered value. Please refer to the JCO's documentation about tracing.


denotes the pool-size of your sap connection pool. Be aware that this is a hard-limited pool.

A configuration in your cocoon.xconf would look like this:

<web3 logger="core.web3">
	<backend name="indy">
		<pool level="0" size="10" trace="false">
	<backend name="hugo">

Implementing your own RFC's

First of all you have to setup your markup with the right Namespace

<page xmlns:rfc="http://apache.org/cocoon/Web3-Rfc/1.0">

After doing so you can enter RFC-mappings with the following syntax. You will see this is a very easy task and you will enjoy using Web3 to do the stuff for you within your SAP environment :)

Web3 rfc-Syntax

Data definitions (metadata) are created and managed in the ABAP Dictionary. The ABAP Dictionary permits a central description of all the data used in the system without redundancies. New or modified information is automatically provided for all the system components. This ensures data integrity, data consistency and data security.

The syntax used within this markup builds upon these facts. So do not wonder if you find the corresponding logical units in the Cocoon frontend.





Starts a mapping for the specified RFC.


Container element for structures and fields.


Container element for tables.


Container element for fields.


Container element for structures.


The data-fields.


First when you start to map a RFC keep in mind to get the parameters from your SAP system. Therefore you may want to use se37 where all relevant parameters are listed. The @name has to be the name of the RFC you want to map.

Since many RFC's return hierarchical data split into tables you will encounter some problems in xslt when rendering these data to trees. So you may implement org.apache.cocoon.components.web3.Web3Streamer to get a proper XML to work with. You can set your own streamer in the @streamer.





The name of the SAP RFC


The class-name of your function streamer. Most of the time you won't need to implement it anyway.


When requesting a RFC you have to fill the import parameterlist. The import parameterlist lists all relevant parameters that have to be provided to get proper results from your R/3.

se37 can provide you with the relevant information.


Some highly complex RFC's have also tables in their calling interface. You may need to read the SAP documentation of the BAPI you gotta call and when to make use of one of them.


A structure comprises fields. A field can refer to an elementary type (via a data element or by directly specifying the data type and length in the structure definition), another structure or a table type. A structure can therefore be nested to any depth.

At the time the facility to use nested structures has not been tested!


A table consists of a collection of structures with same structure type. To keep it simple we can sloppily say a table is like a SQL-database-table.


Fields, also called data elements are the smallest indivisible units of the complex types and are used to specify the types in structures and columns of tables. A field describes either an elementary type or a reference type.

In ABAP exist predefined types and custom defined types. But don't worry about the horrible task of converting into the right type. This task is excellently done for you by the JavaConnector.

Keep in mind that the communication format for numbers and date is US. So supply Date information in format YYYY-MM-DD with the slashes and number information like DDDDD.DD where the dot is the comma!

If you want to check your RFC mappings for syntactically correctness you may want to use the enclosed dtd's.

A more complex example

The included example demonstrates a more complex function call. Keep in mind that the correct execution depends on the local customizing settings of the connected SAP System.

<page xmlns:rfc="http://apache.org/cocoon/Web3-Rfc/1.0">
  <rfc:include name="XXX" streamer="XXX">
      <rfc:structure name="XXX">
        <rfc:field name="XXX">YYY</rfc:field>
        <rfc:field name="XXX">YYY</rfc:field>
        <rfc:field name="XXX">YYY</rfc:field>
        <rfc:table name="XXX">
          <rfc:structure name="1">
            <rfc:field name="XXX">YYY</rfc:field>
            <rfc:field name="XXX">YYY</rfc:field>
            <rfc:field name="XXX">YYY</rfc:field>

Setting up the sitemap

There are two ways to setup your Web3Transformer in the sitemap.

Global Configuration

If you have to deal only with one R/3 Instance you may configure your org.apache.cocoon.transformation.Web3RfcTransformer global like stated in the following sitemap snippet.

<map:transformer name="rfc" 

Parametrized Configuration

If you have setup several R/3 pools you can parametrize the org.apache.cocoon.transformation.Web3RfcTransformer as stated next

<map:transform type="rfc">
  <map:parameter name="backend" value="indy"/>

Further questions

Enjoy using Web3. For further questions feel free to contact the author Michael Gerzabek