Skip to Content
0
Former Member
Aug 03, 2008 at 11:58 AM

Java error in UDF: "cannot resolve symbol"

670 Views

Hello everyone,

I've created a UDF in the message mapping that looks up an RFC table in the ERP system.

When I run the test, I get this error:

Source code has syntax error: D:/usr/sap/XID/DVEBMGS02/j2ee/cluster/server0/./temp/classpath_reso

lver/Map1e437c00615011ddb664001cc45e6536/source/com/sap/xi/tf/_LOIPRO_TO_D002FILE_MM_.java:

1165: cannot resolve symbol symbol : class JCoRepository location:

class com.sap.xi.tf._LOIPRO_TO_D002FILE_MM_

JCoRepository mRepository;

^

Here's how my UDF looks like:

public void rfclookup(String[] a,String[] b,String[] c,String[] d,ResultList result,Container container){

//write your code here

String DBTABLE = a[0];

String lookUpField = d[0];

String WHERE_CLAUSE = b[0]" = ""'"c[0]"'" ;

JCoRepository mRepository;

JCoClient mConnection = JCO.createClient(

sapClient,

userName,

password,

language,

hostName,

systemNumber );

// connect to SAP

mConnection.connect();

// create repository

mRepository = new JCoRepository( "GenericRFCMappingLookup", mConnection );

// create function template to select data from any table

JCoFunction function = null;

IFunctionTemplate ft = mRepository.getFunctionTemplate("RFC_READ_TABLE");

function = ft.getFunction();

// Obtain parameter list for function

JCoParameterList input = function.getImportParameterList();

// Pass function parameters

// set import parameters table name and RFC

input.setValue( DBTABLE, "QUERY_TABLE");

input.setValue( "," , "DELIMITER");

//Fill the where clause of the table

JCoParameterList tabInput = function.getTableParameterList();

JCoTable inputTable = tabInput.getTable("OPTIONS");

inputTable.appendRow();

inputTable.setValue(WHERE_CLAUSE,"TEXT");

mConnection.execute( function );

//Find the position of the field that has to be lookedUp

JCoTable lookupFieldPos = function.getTableParameterList().getTable("FIELDS");

int pos = -1;

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

{

lookupFieldPos.setRow(i);

if (lookupFieldPos.getString("FIELDNAME").equals(lookUpField))

pos = i;

}

//Get the exact lookupvalue from the position obtained above

JCoTable valueSet = function.getTableParameterList().getTable("DATA");

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

{

valueSet.setRow(i);

String resultSet [] = valueSet.getString("WA").split(",(?=(?:[\"]*\"[\"]\")(?![^\"]*\"))");

result.addValue(resultSet[pos]);

}

mConnection.disconnect();

I have declared global variables for sapClient, hostName, systemNumber, userName, password, and language fields. I've also downloaded and installed the sapjco3.jar file, and changed the classpath variable.

Is there anything else I might be missing? What could be wrong with the code that causes this error?

Thanks in advance!

Glenn