【发布时间】:2018-11-30 06:36:14
【问题描述】:
这是我的示例代码。在此示例中,只有基本类型,无需设置结构类型。但在输出中,表中不存在数据。
当我检查 SAP 中的记录时,它包含该特定 ID 的多条记录。有人可以向我解释一下吗?
public void invokeRFC(JCoDestination destination) {
JCoFunction function=null;
try
{
JCoFunctionTemplate functionTemplate = destination.getRepository().getFunctionTemplate("RFC_METHOD");
if (functionTemplate != null) {
function = functionTemplate.getFunction();
}
if (function == null)
throw new RuntimeException("Not found in SAP.");
//to fill elementary types and structures
configureImportParameters(function,"xxx", "abc");
//to fill table type parameters
configureTableParameters(function, "tblName",1,"100");
function.execute(destination);
} catch (JCoException e)
{
e.printStackTrace();
}
}
public void configureTableParameters(JCoFunction function, String table_name, int index, String id) {
JCoTable table = function.getTableParameterList().getTable("table_name");
table.appendRow();
table.setRow(index);
table.setValue("Partner", "100");
}
private void exportTable(JCoFunction jCoFunction, String tblName) {
JCoTable resultTable = jCoFunction.getTableParameterList().getTable(tblName);
int value = resultTable.getNumRows();
System.out.println(value);
}
private void configureImportParameters(JCoFunction function, String param1, String param2) {
JCoParameterList parameterList =
function.getImportParameterList();
parameterList.setValue("field1", param1);
parameterList.setValue("field2", param2);
}
更新了代码。
【问题讨论】:
-
您遇到任何错误,或者只是行数为 0?如果后面是这种情况,请在 SAP 端执行 RFC 并检查计数,并确保参数相同
-
我在导出 RETTEXT 值中收到合作伙伴 100 不存在消息。
标签: java spring-boot sap jco