fb
WSO2 Products 5 minutes

Configuring the WSO2 SAP adapter – part 1

Thijs Volders
Thijs Volders
Strategic Technology Officer
SAP
Scroll

SAP.pngWSO2 ESB comes with a variety of adapters to connect to all sorts of different systems. One of these adapters is the SAP adapter. The WSO2 SAP adapter has full IDoc and experimental BAPI support. It used the SAP JCO library as underlying framework to communicate with SAP. Installing the adapter couldn’t be easier. Its shipped with WSO2 ESB and the WSO2 ESB documentation website describes the installation procedure from the WSO2 perspective. The installation procedure however does not guide you on how to find the settings you need in SAP.

That’s where this blogpost steps in. It is actually the first in a series of three. I’ll first take you through setting up the SAP connection. Then the next blogpost will introduce sending IDocs and the last post will take you through invoking BAPIs at SAP. So, let’s start off with some SAP adapter knowledge. I’ll refer to the WSO2 ESB SAP adapter as ‘SA’ in the following guide.

Client/Server Configuration

The SA is capable to be used as a Client as well as a Server. To setup the SA as client to a SAP system you’ll need to setup a client-side configuration file. This file should be named [SAP-GWHOST].dest and must be placed in the [WSO2_HOME]/repository/conf/sap folder. This folder does not exist per default so make sure you create it and provide enough access rights for the WSO2 user to read the files within it.

To setup the WSO2 as an IDoc server you must create a configuration file named [SAP-GWHOST].server.

Let’s first handle the client configuration file. There might be some differences based on your SAP system but the following settings should cover a lot of installations. The screenshots are based on SAP ECC version 6.0. In the examples below the SAP gateway is known as SAPSYS01. The configuration of the SAPSYS01.dest (remember this is the “using WSO2 ESB as a SAP client” configuration) has the following content:

jco.client.client=900
jco.client.user=spremote
jco.client.passwd=FILL_IN_YOUR_PASSWORD_HERE
jco.client.lang=en
jco.client.ashost=SAPSYS01
jco.client.mshost=SAPSYS01
jco.client.gwhost=SAPSYS01
jco.client.gwserv=3300
jco.client.sysnr=00
jco.client.idle_timeout=300
jco.client.logon=0
jco.client.msserv=3600
jco.client.trace=0
jco.client.getsso2=0
jco.client.r3name=QCR

Ok, lets open up some screens in the SAP system. Assuming an experienced SAP engineer will be doing this you could either go through the SAP Easy Access menu or directly open up the appropriate transaction screen.

Open the System Gateway Monitor (SMGW) and use the top-menu named Goto – Parameters and Display as shown below.

Configuting_the_WSO2_SAP_adapter-part1-img1.png

The following screen will show:

Configuring_the_WSO2_SAP_Adapter-part1-img2.png

Use the highlighted values from the Gateway Monitor Values for the jco.client.gwhost and jco.client.gwserv respectively.

Please be aware that you can substituted the service name (sapgw00 in the screenshot) to its corresponding port number (“sapgw00“ corresponds to portnumber 3300). Please see the last paragraph at Communication Connections of the R/3 System for more information. Now, open transaction /NSMMS which will show the following screen:

Configuring_the_WSO2_SAP_Adapter-part1-img3.png

The highlighted values are to be used for respectively jco.client.msserv and jco.client.mshost

To find the SAP Server you’ll need to open transaction /NSSM51 which shows the following screen:

Configuring_the_WSO2_SAP_Adapter-part1-img4.png

Use this highlighted value as jco.client.ashost. Then you’ll need to open transaction RZ11 and select the parameter name “SAP SYSTEM” and press Display which will show you the following screen:

Configuring_the_WSO2_SAP_Adapter-part1-img5.png

Use the “Current value” as value for jco.client.sysnr

OK So far so good, we have already a bunch of values of our client configuration, but we’re not there yet. Open the System status to get some additional values. Do that through the top menu, select System and then Status which will show the following screen:

Configuring_the_WSO2_SAP_Adapter-part1-img6.png

Use the values shown Client value for jco.client.client, user for jco.client.user, and Language for jco.client.lang

Based on the username shown here make sure to fill in the password for this user account in jco.client.passwd

To find the R/3 name parameter value you’ll need to open transaction /NSMMS and then use the topmenu Goto -> Parameters -> Display which will show the following screen:

Configuring_the_WSO2_SAP_Adapter-part1-img7-1.png

Here you need to use the server service name and strip off the “sapms” part which in the screenshot case will leave you with ERD as jco.client.r3name

There are still some settings left. These are jco.client.getsso2, jco.client.logon and jco.client.idle_timeout and jco.client.trace

The jco.client.getsso2 value can be left as value 0. It indicates whether a Single-Sign On ticket should be requested from SAP. That will not be used in this setup.

The jco.client.logon can also be left 0. It enables or disabled the logon check when a connection is opened to SAP.

The jco.client.idle_timeout can be left default to value 300. This setting allows connections to stay open for a specified amount of time. It is beneficial to leave this rather lengthy as that saves the connection setup overhead upon sending data to SAP.

The last setting is jco.client.trace can be used to switch on SAP JCO tracing. Trace files will be stored in WSO2_HOME and will be called jco_XXXXX.trc where XXXXX is a unique number to indicate the request.

User access

Once all connection settings from the above paragraphs have been found and configured in the server and dest files then you might still run into issues.One of which is a common issue where the following error appears:

Connect to message server host failed
Connection parameters: TYPE=B DEST=SAPSYS01 MSHOST=SAPSYS01 MSSERV=3600 R3NAME=ERD GROUP=PUBLIC PCS=1
ERROR Group PUBLIC not found
TIME Fri Jan 24 15:48:53 2014

This issue indicates that the user (Called “SPREMOTE” in the above configuration steps) is not assigned to the public user-role. To fix this open up transaction /NSMLG where you must select the “PUBLIC” logon group. Then go to the top menu, choose Goto and User list as show here.

Configuring_the_WSO2_SAP_Adapter-part1-img8.png

Configuring_the_WSO2_SAP_Adapter-part1-img9.png

If there is no public logon group then you should create one. This can be done using the Create new assignment button in the CCMS:Maintain Logon Groups screen above. As can be seen in the screenshot below; fill in PUBLIC as logon group name and click Copy to create the group.

Configuring_the_WSO2_SAP_Adapter-part1-img10.png

So now you should have an SAP connection running. Please come back for part 2 and part 3 of this blog serie where the sending and receiving IDocs and BAPI invocations will be described.

If you have any questions about this blogpost contact us via the comments section of this blog. View also our WSO2 Tutorialswebinars or white papers for more technical information. Need support? We do deliver WSO2 Product Support, WSO2 Development SupportWSO2 Operational Support and WSO2 Training Programs.