cancel
Showing results for 
Search instead for 
Did you mean: 

JCo Parameters missing, nothing passed from ABAP to Java

Former Member
0 Kudos

Hello all,

We're having the request to make a ABAP to Java call.

I did all the stuff to call the RFC Program:

sm59 jco destination with program id

a java program connecting to the sap system with program id

a rfc with two int4 importing parameters and a char10 parameter.

when running the java program and executing the function on the rfc destination the java program reacts obviously, telling me that it is invoked, but all parameters are empty. the ints are 0 and the text is empty string "".

Even when I print the function as html all parameters are empty, initial...

Anybody seen this before?

cheers

Stefan

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hello Stefan

some erros i can think of:

- restart Java application (to get new repository)

- Problems with client connection for repository

- RFM not activated (old version active)

could you please post some source code for further details

regards

Franz

reward points if useful

Former Member
0 Kudos

Hi,

thanks for paying attention

Can you tell me what RFM is? never heard

Some source:

Here are my two classes involved:

First Example

is instantiating the connection and contains the main method. it creates three instances of a JCO.Server instance, all sap parameters are in properties file

public class FirstExample {

static RfcService rfcServices[] = new RfcService[3];

static String POOLNAME = "pool";

public static void startServers() throws FileNotFoundException, IOException {

Properties props = new Properties();
props.load(new FileInputStream("rsc/jco.properties"));

JCO.addClientPool(POOLNAME, 3, props);

IRepository repository = JCO.createRepository("rep", POOLNAME);

for(int i = 0; i < rfcServices.length; i++) {
rfcServices[í] = new RfcService(props, repository);
rfcServices[í].start();
}
}

public static void stopServers() {
for(int i = 0; i < rfcServices.length; i++) {
rfcServices[í].stop();
}
}

public static void main(String[] args) throws InterruptedException, FileNotFoundException, IOException {
startServers() ;

for (int i = 0; i < 30; i++) {
System.out.println("waiting...");
Thread.sleep(1000);

}
stopServers();
}
}


RfcService

is the JCO.Server instance. it gets the call of the function, but as I mentioned parameters are empty...

public class RfcService extends JCO.Server implements JCO.ServerExceptionListener, JCO.ServerErrorListener{

public RfcService(String gwhost, String gwserv, String progid, IRepository repository) {
super(gwhost, gwserv, progid, repository);
JCO.addServerExceptionListener(this);
JCO.addServerErrorListener(this);
}

public RfcService(Properties props, IRepository repository) {
super(props, repository);
JCO.addServerExceptionListener(this);
JCO.addServerErrorListener(this);
}


protected void handleRequest(JCO.Function function) {
System.err.println("handling request");
JCO.ParameterList input = function.getImportParameterList();
JCO.ParameterList output = function.getExportParameterList();
JCO.ParameterList tables = function.getTableParameterList();

function.writeHTML("c:/jcoTest.html");

System.out.println("handleRequest(" + function.getName() + ")");
if (function.getName().equals("STFC_CONNECTION")) {
System.out.println(">>> request STFC_CONNECTION: " + input.getString("REQUTEXT"));

output.setValue(input.getString("REQUTEXT"),"ECHOTEXT");

output.setValue("This is a response from MyFirstServer","RESPTEXT");

}

}

public void serverExceptionOccurred(Server arg0, Exception e) {

e.printStackTrace();

}

public void serverErrorOccurred(Server arg0, Error e) {

e.printStackTrace();

}

}

properties:

jco.client.ashost=morgan

jco.client.client=400

jco.client.sysnr=00

jco.client.user=x000000054

jco.client.passwd=sbu

jco.client.lang=de

1. Daten der Inbound-Connection (ashost/gwhost und sysnr/gwserv korrespondieren ...)

jco.server.gwhost=morgan

jco.server.gwserv=sapgw00

jco.server.progid=MARES_AE

thats all,

thanks

Stefan

Former Member
0 Kudos

Hello

RFM means Remote Function Module (Remotefähiger Funktionsbaustein)

Java coding looks ok, maybe there is a problem with the client connectin for getting the function metadata

try something like this inside class FirstExample aufter you the line where you create the repository, to see if client connection is ok

IFunctionTemplate ftemplate = repository.getFunctionTemplate("RFC_SYSTEM_INFO");
JCO.Function function = ftemplate.getFunction();
JCO.Client client = JCO.getClient(POOLNAME);
client.execute(function);
function.writeHTML("c:jcoTest2.html");

regards franz

reward points if useful

Former Member
0 Kudos

Hi,

well What is the issue with RFM? is there anything I have to set to use the modern way?

I printed out the result of the RFC_SYSTEM_INFO as xml, probably you can see something bad, don't bother the different names, I tried on another server with the same result

<?xml version="1.0" encoding="UTF-8"?>

<RFC_SYSTEM_INFO>

<OUTPUT>

<CURRENT_RESOURCES>12</CURRENT_RESOURCES>

<MAXIMAL_RESOURCES>15</MAXIMAL_RESOURCES>

<RECOMMENDED_DELAY>0</RECOMMENDED_DELAY>

<RFCSI_EXPORT>

<RFCPROTO>011</RFCPROTO>

<RFCCHARTYP>4103</RFCCHARTYP>

<RFCINTTYP>LIT</RFCINTTYP>

<RFCFLOTYP>IE3</RFCFLOTYP>

<RFCDEST>muccocnetecs_ECS_04</RFCDEST>

<RFCHOST>muccocne</RFCHOST>

<RFCSYSID>ECS</RFCSYSID>

<RFCDATABS>ECS</RFCDATABS>

<RFCDBHOST>muccocnetecs</RFCDBHOST>

<RFCDBSYS>ORACLE</RFCDBSYS>

<RFCSAPRL>700</RFCSAPRL>

<RFCMACH> 390</RFCMACH>

<RFCOPSYS>Linux</RFCOPSYS>

<RFCTZONE> 3600</RFCTZONE>

<RFCDAYST>X</RFCDAYST>

<RFCIPADDR>10.40.192.74</RFCIPADDR>

<RFCKERNRL>700</RFCKERNRL>

<RFCHOST2>muccocnetecs</RFCHOST2>

<RFCSI_RESV></RFCSI_RESV>

<RFCIPV6ADDR>10.40.192.74</RFCIPV6ADDR>

</RFCSI_EXPORT>

</OUTPUT>

</RFC_SYSTEM_INFO>

Yesterday I configured the jco rfc service so that a ejb is called for inbound rfc request, and using that, all parameters were passed correctly

thanks so far

Stefan