简体   繁体   English

SAP JCo 中的嵌套结构?

[英]Nested structures in JCo for SAP?


I currently maintain rfc function modules to be called via Java Connector for SAP.我目前维护要通过 SAP 的 Java 连接器调用的 rfc 功能模块。 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:当通过 JCo 3.0 反省这个模块时,它只显示顶层表,而不是内部的:

     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.出于性能考虑,我启用了模块以使用 basXML。
How can I enable JCo to work with nested structures?如何使 JCo 能够使用嵌套结构? Or is this not possible?或者这是不可能的?

In general this works.一般来说,这是有效的。 JCo is capable of dealing with nested structures and tables. JCo 能够处理嵌套结构和表。

In this case your nested JCoTable simply seems to be empty, ie it has no rows.在这种情况下,您嵌套的 JCoTable 似乎只是空的,即它没有行。 On an empty table you cannot call any getter- or setter-method for a single field.在空表上,您不能为单个字段调用任何 getter 或 setter 方法。

Simply check with JCoTable.isEmpty() or with JCoTable.getNumRows()>0 before using any getter-method.在使用任何 getter 方法之前,只需检查JCoTable.isEmpty()JCoTable.getNumRows()>0 And make sure to append at least one row with JCoTable.appendRow() before using any setter-method on a JCoTable object.并确保在 JCoTable 对象上使用任何 setter 方法之前至少使用JCoTable.appendRow()追加一行。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM