cancel
Showing results for 
Search instead for 
Did you mean: 

JCO on Windows XP OS

Former Member
0 Kudos

HI all gurus,

I m little new to JCO in SAP. Actually i have installed JCO on my windows 2003 server OS and it is working fine. now i want to install JCO on my other system which has windows XP OS.

for server 2003 i used jCO 2.1.8 and for XP i m using JCO 3.0.4. I see difference between these 2 version is librfc32.dll file which is there for server2003 and not there for XP.

in server 2003 i use following code to connect to SAP thru JCO from my JSP page and it is working absolutely fine

try {

JCO.Client jcoclient =

JCO.createClient(

"800",

"USER1",

"abc123",

"EN",

"123.238.40.134",

"11");

jcoclient.connect();

} catch (Exception afe) {

data = (new StringBuilder()).append("#").append(afe.getMessage()).toString();

out.append(data);

out.close();

} finally {

out.close();

}

and in windows XP i m trying to connect to SAP thru JCO from JSP page using following code

CODE is in first reply to this forum

but this code is not working. i debug this code and found that as it comes to statement "JCoDestination ABAP_AS = JCoDestinationManager.getDestination("ABAP_AS");" it gets some problem in connection and it comes to finally block and interesting thing is it even doesn't throw any Exception. So i m not getting what exactly is the problem.

one Difference is that my SAP is installed on the same system which has windows 2003 server OS but this windows XP machine is the system which is connected to this SAP system in LAN. Can tis be a problem cause i feel this should be problem, As any system which can ping to sever on with SAP is installed should be able to connect to SAP thru JCO..

I tried to set trace for JCO using -Djco.trace_level=10 but since my r/3 has only ABAP stack do i m not able to J2EE Engine config tool.

SO experts what could be the problem. Is it that as my SAP installation is on same system as windows 2003 system and my JSP file is also hosted on this same server. ?? while in case of windows XP the JSP file is hosted on that XP system and trying to access this SAP thru LAN.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

It looks like your JCo3 version defines connection properties, but doesn't use them. For JCo3 the connection properties are provided via factories implementing the interface DestinationDataProvider; such providers can then be registered via the static method Environment.registerDestinationDataProvider().

However, you don't have to code this, because by default JCo3 is shipped with a DestinationDataProvider that basically takes the string you passed to JCoDestinationManager.getDestination() as a filename and adds extension "jcoDestination". You can see this in the example StepByStepClient.java that is shipped with JCo3. So this provider expects a file with the connection properties.

So from the coding you've pasted it seems to me as if you're simply missing the small step of creating a file with the connection properties. I'm assuming your ABAP_AS is a static string, so your file name with the properties should be <i>ABAP_AS + ".jcoDestination"</i>.

By the way, when setting the trace level as you've indicated you sometimes also want to set the directory where the trace files are generated via -Djco.trace_path=<PATH>.

Cheers, harald

Former Member
0 Kudos

super.... harald...bingOO... its done....

Former Member
0 Kudos

hi Herald,

Just little question for sake of my knowledge.As i have EP installed on my server where ECC 6.0 is also installed. I have only ABAP stack in my ECC 6.0, No JAVA stack..Also when i do the connection using JCO it get connected to my ECC system and fetch me required data.Also at the same time my Portal instance is also not started. Can i ask how this JCO connection is being made as i dont have JAVA stack as well my EP is also not started?? Also will this work on non ECC version like 4.7,4.6C etc..

Former Member
0 Kudos

Hi Michell,

For communication SAP traditionally uses the [CPI-C protocol|http://help.sap.com/saphelp_nw04/Helpdata/EN/bb/9f029e4b9b11d189750000e8322d00/frameset.htm] (<b>C</b>ommon <b>P</b>rogramming <b>I</b>nterface - <b>C</b>ommunications), which is basically an IBM standard. To simplify the programmer's life they built a layer around it, called [RFC|http://help.sap.com/saphelp_nw04/Helpdata/EN/bb/9f029e4b9b11d189750000e8322d00/frameset.htm] (<b>R</b>emote <b>F</b>unction <b>C</b>all).

For making remote function calls to SAP (RFC client) or calling remote functions from SAP on an external server (RFC server) traditionally you'd utilize the [RFCSDK|https://service.sap.com/sap/support/notes/27517|See previous links for documentation; this link refers to OSS note 27517 on installation of RFCSDK], which basically contained some libraries for writing C-programs to connect from/to SAP (documented [here|http://help.sap.com/saphelp_nw70ehp1/helpdata/en/b4/3f9e64bff38c4f9a19635f57eb4248/frameset.htm], also applicable to older SAP versions). Later the Java Connector (JCo) was introduced, but the main task was still to connect the non-SAP world to the SAP ABAP application server (just utilizing another program language/API).

JCo 3.x supports SAP R/3 systems from 3.1H onwards. Since the goal is to connect to/from the SAP ABAP stack, there is no need for SAP J2EE server or portal. So roughly the layers for JCo 3.x look like this:

Java Application u2194 JCo Java API u2194 JNI Layer u2194 CPI-C/RFC u2194 SAP System

Since SAP "web-enabled" also the ABAP stack (application server 6.x and higher) we have also the option to utilize http(s) protocol for connections including webservices using SOAP protocol.

Cheers, harald

Answers (1)

Answers (1)

Former Member
0 Kudos

code for Windows XP

try {

Properties connectProperties = new Properties();

connectProperties.setProperty(DestinationDataProvider.JCO_ASHOST, "123.238.40.134");

connectProperties.setProperty(DestinationDataProvider.JCO_SYSNR, "11");

connectProperties.setProperty(DestinationDataProvider.JCO_CLIENT, "800");

connectProperties.setProperty(DestinationDataProvider.JCO_USER, "USER1");

connectProperties.setProperty(DestinationDataProvider.JCO_PASSWD, "abc123");

connectProperties.setProperty(DestinationDataProvider.JCO_LANG, "en");

JCoDestination ABAP_AS = JCoDestinationManager.getDestination("ABAP_AS");

ABAP_AS.ping();

System.out.println("ABAP_AS destination is ok");

} catch (JCoException afe) {

data = (new StringBuilder()).append("#").append(afe.getMessage()).toString();

out.append(data);

out.close();

} catch (Exception afe)

{

data = (new StringBuilder()).append("#").append(afe.getMessage()).toString();

out.append(data);

out.close();

}

finally {

out.close();

}