cancel
Showing results for 
Search instead for 
Did you mean: 

JCo error after called RFC modified

former_member625844
Participant
0 Kudos

We have a java program which use Jco to call a RFC function. It's deployed on wildfly server and called from web page with DWR. The code is like below:

	JCoFunction function=destination.getRepository().getFunction("ZFMM01");
	try
	{
		function.getImportParameterList().setValue("I_MTART_FROM", MTART);
		function.execute(destination);
	}
	catch (AbapException e)
	{
		System.out.println(e.toString());	
		return codelist;
	}
	JCoTable MATNR1=function.getExportParameterList().getTable("O_ITEM");
	
	for (int i=0;i<MATNR1.getNumRows();i++){
		codeItem=new CompanyRecord();   		    		
		codeItem.setValue(MATNR1.getString("MTART"), "MTART");
		codeItem.setValue(MATNR1.getString("WERKS"), "WERKS");
		}

After I add a field MATKL to the return table o_item,the program didn't work. The error is "com.sap.conn.jco.JCoRuntimeException: (127) JCO_ERROR_FIELD_NOT_FOUND: Field MATKL is not a member of o_item". I debug it in SAP and this bean do call the Rfc function and return the correct result. And after I restart the java server it worked. I wonder what cause this issue? Is there a cache in Jco need to clean? Anyone has similar issue before? Thx.

sergei-u-niq
Active Contributor
0 Kudos

yes, there is a cache. If you deployed the Java Code on an SAP NW Java Server, you can clear the jco metadata cache in /nwa somewhere. There is probably a java method somewhere, but I dont have the JCo docs handy.

Accepted Solutions (1)

Accepted Solutions (1)

HAL9000
Product and Topic Expert
Product and Topic Expert

Usually, function module meta data does not change in productive scenarios. And because querying meta data is a time consuming task this meta data is cached in the JCoRepository instance. After changing tables, structures or function interfaces during development you either have to restart the JCo process or you need to clear the cache or remove the respective meta data, so that this data will be re-fetched again. Please see the APIs of JCoRepository in the contained JavaDoc of the JCo SDK, e.g. JCoRepository.clear().

Answers (0)