Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

JCo connection


I want to build a web application which should call RFC Function modules from SAP system. I use SAP Netweaver Developer Studio which provides functionality to generate code for function modules (SAP enterprise connector). To call this function module I need to connect to SAP system first. I decided for JCo (version 2.18 u2013 downloaded from SAP service marketplace). And here is a problem. I use identical configuration like SAP logon and SAP enterprise connector (both works perfectly).

Configuration in SAP Logon and SAP Enterprose Connector:

Application Server:

System Number: 00

System ID: MT2

SAP Router String: /H/

So I chose one of them and let NW developer to generate code. Now I want to connect to SAP system. Here is my source code:

package com.ibs.web.ibsos;

import com.ibs.web.ibsos.rfc.Connector_PortType;
import com.ibs.web.ibsos.rfc.__Ibs__Os_Db_Meldung_Rfc_Input;
import com.ibs.web.ibsos.rfc.__Ibs__Os_Db_Meldung_Rfc_Output;

public class ConnectionTest {

	public static void main(String[] args) {

		String[][] loginParams = {
			{ "client", "100" }, 				          // SAP client
			{ "userid", "userid" }, 			                          // user id
			{ "passwd", "******" }, 			                          // password
			{ "language", "DE" }, 				          // language
			{ "ashost", "" }, 		                          // host name
			{ "sysnr", "00" }, 				          // system number
			{ "gwhost", "/H/" },                                     // gateway host
			{ "gwserv", "sapdp99" } 			          // gateway service | sapdp99 = 3299
		try {
			// create client
			JCO.Client client = JCO.createClient(loginParams);
			// connect to SAP system
			// create connector instance
			Connector_PortType connector_PortType = new Connector_PortType();
			// set cliet
			// create input instance
			__Ibs__Os_Db_Meldung_Rfc_Input input = new __Ibs__Os_Db_Meldung_Rfc_Input(); 
			// get output
			__Ibs__Os_Db_Meldung_Rfc_Output output = connector_PortType.__Ibs__Os_Db_Meldung_Rfc(input);
			// disconnect
		} catch (SystemFaultException e) {
		} catch (ApplicationFaultException e) {
		} catch (JCO.Exception e) {



And I get this error:$Exception: (102) RFC_ERROR_COMMUNICATION: Connect to SAP gateway failed
Connect_PM  GWHOST=/H/, GWSERV=sapdp99, ASHOST=, SYSNR=00

LOCATION    SAProuter 39.1 (SP3) on 'cscappwie178'
ERROR       cscappwie178: route permission denied ( to ,

TIME        Thu Oct 02 14:48:42 2008
RELEASE     710
COMPONENT   NI (network interface)
VERSION     39
RC          -94
COUNTER     31686

	at$Client.nativeConnect(Native Method)
	at com.ibs.web.ibsos.ConnectionTest.main(

Note: is IP of my computer.

I have no Idea why I can get connected to SAP system via SAP Logon and SAP Enterprise Connector, but via JCo not. With the same configuration!!! How can I get Permision denied???

Thanks for your help!


Edited by: Jozef Kubov on Oct 2, 2008 3:20 PM

Not what you were looking for? View more on this topic or Ask a question