Tassimmo
Tassimmo

Reputation: 33

Nested structures in JCo for SAP?


I currently maintain rfc function modules to be called via Java Connector for SAP. My current module returns a table of documents, where each line has some data and another table of items.
When introspecting this module via JCo 3.0, it does only show the top layer table, but not the one inside:

     POSITIONS () (com.sap.conn.jco.JCoTable) 
     introspection errror
     java.lang.IllegalStateException: Trying to access row values in a table
     which does not have any rows yet

The inner table is defined. For performance purposes, I enabled the module to use basXML.
How can I enable JCo to work with nested structures? Or is this not possible?

Upvotes: 1

Views: 633

Answers (1)

Trixx
Trixx

Reputation: 1885

In general this works. JCo is capable of dealing with nested structures and tables.

In this case your nested JCoTable simply seems to be empty, i.e. it has no rows. On an empty table you cannot call any getter- or setter-method for a single field.

Simply check with JCoTable.isEmpty() or with JCoTable.getNumRows()>0 before using any getter-method. And make sure to append at least one row with JCoTable.appendRow() before using any setter-method on a JCoTable object.

Upvotes: 3

Related Questions