cancel
Showing results for 
Search instead for 
Did you mean: 

JCO Call

Former Member
0 Kudos

Hi,

What is JCO Call. What are the methods there in the JCO Call. Explaine me with an example.

Thanks

Koteswara Rao

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi Koteswara,

Please go through the below link that has the details related to JCO.

https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/85a483cb-0d01-0010-2990-c5168f01...

For dynamic JCO creation

/people/anilkumar.vippagunta2/blog/2007/02/06/dynamic-jco-creation

Debugging an RFC call using JCO API

/people/tarun.telang2/blog/2005/10/01/debugging-a-rfc-call-using-jco-api

JCO Client Service

http://help.sap.com/saphelp_nw04/helpdata/en/36/5db440c97f3716e10000000a155106/frameset.htm

Hope these help,

Regards

Kiran..

Former Member
0 Kudos

Hi,

JCO stands for JavaConnector and was originally developed by Arasoft.It is really meant for communication between ABAP stack and JAVA stack.When a NW JAVA stack communicates with ABAP stack inturn it does it thru JCO.

It has many methods in its JCO library.To get an idea you can see the following sample code-In which a BAPI is being called from JAVA environment.

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;

String[] SAPInterfaces;

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("ARAsoft", mConnection);

} catch (Exception ex) {

ex.printStackTrace();

System.exit(1);

}

JCO.Function function = null;

JCO.Table codes = null;

// codes.firstRow();

try {

function = this.createFunction("BAPI_MATERIAL_GETLIST");

if (function == null) {

System.out.println(

"BAPI_MATERIAL_GETLIST" + " not found in SAP.");

System.exit(1);

}

codes = function.getTableParameterList().getTable("MATNRSELECTION");

codes.appendRows(2); // Add two rows to internal table

codes.setValue("I", "SIGN");

codes.setValue("EQ", "OPTION");

codes.setValue("P1001087", "MATNR_LOW");

codes.setValue("", "MATNR_HIGH");

codes.nextRow(); // Move onto next row

codes.setValue("I", "SIGN");

codes.setValue("EQ", "OPTION");

codes.setValue("P1001088", "MATNR_LOW");

codes.setValue("", "MATNR_HIGH");

mConnection.execute(function);

// JCO.Table returnTable1 =

// function.getTableParameterList().getTable("MATERIALSHORTDESCSEL");

// System.out.println(returnTable1);

// JCO.Table returnTable2 =

// function.getTableParameterList().getTable("MATNRLIST");

// System.out.println(returnTable2);

// Output result Material list table

System.out.println(

function.getTableParameterList().getValue("MATNRLIST"));

System.out.println(

function.getTableParameterList().getString("MATNRLIST"));

// System.out.println(

// function.getTableParameterList().getValue("MATERIALSHORTDESCSEL"));

//

// System.out.println(

// function.getTableParameterList().getString("MATERIALSHORTDESCSEL"));

// Output Selection table

System.out.println(

function.getTableParameterList().getValue("MATNRSELECTION"));

System.out.println(

function.getTableParameterList().getString("MATNRSELECTION"));

} 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.");

}

}

}

Thanks in advance.

RGds,Vasanth.