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

sap connection problem

hi everyone,

my system is in LAN

is application server is essential to connect to sap ?

thanks,

tony

Add a comment
10|10000 characters needed characters exceeded

Related questions

1 Answer

  • author's profile photo Former Member
    Former Member
    Posted on Feb 02, 2007 at 05:31 AM

    Hai Tony,

    Use JCO to Connect with SAP R/3.

    http://help.sap.com/saphelp_nw2004s/helpdata/en/6f/1bd5c6a85b11d6b28500508b5d5211/frameset.htm

    Sample Code:

    import com.sap.mw.jco.*;
    
    public class CallFunction extends Object {
    
    public static void main(String args[]) {
    CallFunction app = new CallFunction();
    }
    int count;
    JCO.Client mConnection;
    JCO.Repository mRepository;
    public CallFunction() {
    try {
    // Logon info
    mConnection = JCO.createClient("500", // SAP client
    "username", // userid
    "password", // password
    null, // language
    "server name", // application server host name
    "00"); // system number
    mConnection.connect();
    mRepository = new JCO.Repository("MY_connection", mConnection);
    } catch (Exception ex) {
    ex.printStackTrace();
    System.exit(1);
    }
    
    JCO.Function function = null;
    
    
    try {
    function = this.createFunction("ABAP_FM");
    
    mConnection.execute(function);
    
    System.out.println(
    function.getTableParameterList().getValue("Exporting_Message"));
    
    } catch (Exception ex) {
    ex.printStackTrace();
    System.exit(1);
    }
    }
    
    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.");
    }
    }
    }

    JCo Call RFC

    a-problem-about-bapi

    some-problems-about-jco-

    Regards,

    Naga Raju

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member

      hi Nagaraju,

      Here u given program ,,, in that application server host name i cant understand

      which host name that is sap server host name or i installed

      server in my local machine that host name ?

      our administator creating Sap user for me......there i get this totol

      information ? or any thing else...........

      just post it......................with details

      mConnection = JCO.createClient("500", // SAP client

      "username", // userid

      "password", // password

      null, // language

      "server name", // application server host name

      "00"); // system number

      thanks,

      tony

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.