cancel
Showing results for 
Search instead for 
Did you mean: 

Can I use JCo to call a java program in another server?

Former Member
0 Kudos

Hi, experts.

In XI, can I use JCo to call a java program in another server?

If yes, how to do this?

Does anybody have a example?

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Paulo !

By definition:

SAP’s new Java middleware, the SAP Java Connector (JCO) allows customers and partners to easily build SAP-enabled components in Java. JCO supports both inbound (Java calls ABAP) and outbound (ABAP calls Java) calls in desktop and server applications.

I have some ideas:

  • create a JCO Server program that is called from an ABAP program (could be abap mapping or just an RFC called from XI)

http://help.sap.com/saphelp_nw04/helpdata/en/09/c88442a07b0e53e10000000a155106/content.htm

  • expose your java functionality as webservice and then call it using SOAP from XI.

Also check SAP Java Resource Adapter

http://help.sap.com/saphelp_nw04/helpdata/en/6f/1bd5caa85b11d6b28500508b5d5211/content.htm

Regards,

Matias

ps: please award points if helpful.

Former Member
0 Kudos

Hi

ECC6.0 (RFC) --> XI -> JCO Server Async

How to cofigure receiver adapter in XI ?

I could not use java server proxy accorrding to customer's policy

Does anyone has done RFC to JCO Server?

thanks & regards;

venjamin

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi Paulo,

Below is the example for JCo lookup from XI server.

In the below example i am having a Internal table with name "MATNR" in the function Module.

V_Matnr and VStorage_Location are the fields in the Internal TBALE "MATNR".

where ---> tabMatnrUsed.setValue(Matnr, "V_MATNR");

matnr is the value passed as input to function module

JCO.Repository mRepository;

JCO.Client mConnection = JCO.createClient("<Client>", // SAP client

"<USERID>", // userid

"<PASSWORD>", // password

"<LNG>", // language

"<HOSTNAME>", // host name

"<SYSNO>"); // system number

try {

mConnection.connect();

} catch (Exception e) {

// e.printStackTrace();

}

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

IFunctionTemplate ft =

mRepository.getFunctionTemplate("<FM NAME>");

JCO.Function function = ft.getFunction();

JCO.ParameterList allTables = function.getTableParameterList();

JCO.Table tabMatnrUsed = allTables.getTable("MATNR");

tabMatnrUsed.setValue(Matnr, "V_MATNR");

mConnection.execute(function);

allTables = function.getTableParameterList();

tabBnkUsed = allTables.getTable("tabMatnrUsed");

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

tabBnkUsed.setRow(i);

String storageLocation =

(String) tabBnkUsed.getValue("VStorage_Location");

}

mConnection.disconnect();

In this case i used the Internal Table "MATNR" for both input and output and

"MATNR" and "Storage_Location" are the fields

appreciate if helpful