I successfully got the Table entries from a SAP system via RFC_GET_TABLE_ENTRIES. It works all fine and lists me all the rows of the table.
My problem right now is that I have no idea how to get a single value out. Usually I would go like codes [x][y] but that doesn't work because it is not a normal two-dimensional-array table but a JCOtable and I have no idea how that works.
The code is a little longer but this is the call itself.
JCoDestination destination = JCoDestinationManager.getDestination("mySAPSystem");
JCoFunction function = destination.getRepository().getFunction("RFC_GET_TABLE_ENTRIES");
if (function==null)
throw new RuntimeException("Function not found in SAP.");
function.getImportParameterList().setValue( "MAX_ENTRIES", 30);
function.getImportParameterList().setValue( "TABLE_NAME", "ZTEST_TABLE ");
JCoTable codes = function.getTableParameterList().getTable("ENTRIES");
codes.appendRow();
and this is the console output
System.out.println("RFC_GET_TABLE_ENTRIES");
for (int i = 0; i < 30; i++) {
codes.setRow(i);
System.out.println(codes.getString("WA"));
}
getStringactually accepts indexes as well. If you want to retrieve values according to x and y you can do the followingIt works similarly to
codes[x][y]as if it's an array, but this is not commonly used.In other cases, you may want to iterate through each single value in the row with
JCoRecordFieldIterator.