I have a simple program ABAP function module making a call to Java. From Java I need to return a table of results. The table is defined in the ABAP dictionary. Esentially it is made up of a simple 3 field structure.
I have tried many ways of packaging the table data in Java but have not been successful. In all cases I get either a class cast exception or cannot marshal tables exception.
In the case I don't get any exceptions the data is all garbled up.
Pls help.
I have posted the java code snippet for both the repository and the data packaging.
*****************************************************
Repository code:
*****************************************************
JCO.MetaData fmeta = new JCO.MetaData("searchForObject");
fmeta.addInfo("OBJLIST", JCO.TYPE_TABLE, 144, 0, 0, 0, "ZBBP_OBJ_LIST");
fmeta.addInfo("QUERYSTRING", JCO.TYPE_CHAR, 255, 0, 0, JCO.EXPORT_PARAMETER, null);
fmeta.addInfo("QUERYNAME", JCO.TYPE_CHAR, 32, 0, 0, JCO.EXPORT_PARAMETER, null);
repository.addFunctionInterfaceToCache(fmeta);
JCO.MetaData tmeta = new JCO.MetaData("ZBBP_OBJ_LIST");
tmeta.addInfo("ZRFX_STRUCT", JCO.TYPE_STRUCTURE, 128);
repository.addStructureDefinitionToCache(tmeta);
JCO.MetaData smeta = new JCO.MetaData("ZOBJ_STRUCT");
smeta.addInfo("NAME", JCO.TYPE_CHAR, 32, 0, 0);
smeta.addInfo("AMOUNT", JCO.TYPE_CHAR, 32, 0, 0);
smeta.addInfo("CURRENCY", JCO.TYPE_CHAR, 3, 0, 0);
repository.addStructureDefinitionToCache(smeta);
*****************************************************
Handle Request Code:
*****************************************************
protected void handleRequest(JCO.Function function)
{
JCO.ParameterList input = function.getImportParameterList();
JCO.ParameterList output = function.getExportParameterList();
JCO.ParameterList tables = function.getTableParameterList();
if (function.getName().equals("searchForObj"))
{
JCO.Table rfx = tables.getTable("OBJLIST");
rfx.appendRows(3);
// set values
JCO.Record struct = (JCO.Record)repository.getStructureDefinition("ZOBJ_STRUCT");
struct.setValue("Name1", "NAME");
struct.setValue("100", "AMOUNT");
struct.setValue("USD", "CURRENCY");
rfx.setValue(struct, 1);
output.setValue("Query Name 11","QUERYNAME");
output.setValue("Select *","QUERYSTRING");
}
}
________________________________________
Pls help.