Skip to Content
author's profile photo Former Member
Former Member

SAPJCo RFC Socket

We are using the SAPJCo classes to connect from an independent Java application in the internal network to WAS6.20 residing in the DMZ.

Ports 32XX & 33XX are open where XX is the WAS System number.

I still encounter

com.sap.mw.jco.JCO$Exception: (102) RFC_ERROR_COMMUNICATION: Connect to SAP gateway failed.

A point ot be noted is that the same Java application works when I call a R/3 System from the internal network.

Any tips?

Thnx

Meesum

Add a comment
10|10000 characters needed characters exceeded

Related questions

3 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Dec 13, 2004 at 11:51 AM

    It was indeed a port problem.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Dec 14, 2004 at 12:56 PM

    Hi Meesum,

    I like connect an independent java application in the was6.20. How you have make?, know you some example for this problem?.

    Thank's.

    Vicente Zaragoza

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member

      Hi,

      Here is a skeletal source code for an independent java application and it uses Java Connector, u need to modify it although. Read the documentation for Jco before u modify and run this program.

      Best of Luck

      import com.sap.mw.jco.*;

      public class JcoTest extends Object {

      JCO.Client mConnection;

      JCO.Repository mRepository;

      public JcoTest() {

      try {

      // Change the logon information to your own system/user

      mConnection =

      JCO.createClient("", // SAP client

      "", // userid

      "", // password

      "en", // language

      "", // application server host name

      ""); // system number

      mConnection.connect();

      mRepository = new JCO.Repository("ARAsoft", mConnection);

      }

      catch (Exception ex) {

      ex.printStackTrace();

      System.exit(1);

      }

      JCO.Function function = null;

      JCO.Table codes = null;

      try {

      function = this.createFunction("BAPI_CONTACT_GETLIST");

      if (function == null) {

      System.out.println("BAPI_CONTACT_GETLIST" +

      " not found in SAP.");

      System.exit(1);

      }

      mConnection.execute(function);

      JCO.Structure returnStructure =

      function.getExportParameterList().getStructure("RETURN");

      /* if (! (returnStructure.getString("TYPE").equals("") ||

      returnStructure.getString("TYPE").equals("S")) ) {

      System.out.println(returnStructure.getString("MESSAGE"));

      System.exit(1);

      }

      */

      codes =

      function.getTableParameterList().getTable("PERSON");

      for (int i = 0; i < codes.getNumRows(); i++) {

      codes.setRow(i);

      System.out.println(codes.getString("FIRST_NAME") + '\t' +

      codes.getString("LAST_NAME") + '\t' +

      codes.getString("BIRTHDAY"));

      }

      }

      catch (Exception ex) {

      ex.printStackTrace();

      System.exit(1);

      }

      /* try {

      codes.firstRow();

      for (int i = 0; i < codes.getNumRows(); i++, codes.nextRow()) {

      function = this.createFunction("BAPI_COMPANYCODE_GETDETAIL");

      if (function == null) {

      System.out.println("BAPI_COMPANYCODE_GETDETAIL" +

      " not found in SAP.");

      System.exit(1);

      }

      function.getImportParameterList().

      setValue(codes.getString("COMP_CODE"), "COMPANYCODEID");

      mConnection.execute(function);

      JCO.Structure returnStructure =

      function.getExportParameterList().getStructure("RETURN");

      JCO.Structure detail =

      function.getExportParameterList().

      getStructure("COMPANYCODE_DETAIL");

      System.out.println(detail.getString("COMP_CODE") + '\t' +

      detail.getString("COUNTRY") + '\t'

      + detail.getString("CITY")

      );

      }

      }

      catch (Exception ex) {

      ex.printStackTrace();

      System.exit(1);

      }

      */

      mConnection.disconnect();

      }

      public JCO.Function createFunction(String name) throws Exception {

      try {

      IFunctionTemplate ft =

      mRepository.getFunctionTemplate(name.toUpperCase());

      if (ft == null)

      return null;

      return ft.getFunction();

      }

      catch (Exception ex) {

      throw new Exception("Problem retrieving JCO.Function object.");

      }

      }

      public static void main (String args[]) {

      JcoTest app = new JcoTest();

      }

      }

  • author's profile photo Former Member
    Former Member
    Posted on Feb 25, 2009 at 09:41 AM

    Edit your system Host file C:\WINDOWS\system32\drivers\etc

    and put your Local server ip

    as follows

    IP(127.0.0.1) localhost

    124.153.68.161 nmsapdev // sap server ip add

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.