gpt4 book ai didi

java - 为什么 SAP JCo 会引发错误 "Field ... not a member of ...",即使该字段存在?

转载 作者:塔克拉玛干 更新时间:2023-11-02 19:13:49 28 4
gpt4 key购买 nike

我想从我的 Servlet 应用程序向 SAP RFC 表发送数据。

我正在尝试通过以下方式执行此操作。

JCO.Function function = null;
Connection conn = new Connection();
JCO.Client mConnection = conn.open();
JCO.Repository mRepository;
mConnection.connect();

mRepository = new JCO.Repository("KEYWORD",mConnection);

try{
function = this.createFunction("MY RFC NAME");
if(function != null){
function.getImportParameterList.setValue("ID1","USERID");
function.getImportParameterList.setValue("Test Name","UNAME");
function.getImportParameterList.setValue("CLASSA","UCLASS");

mConnection.execute(function);
}
}catch(Exception ex){
// Exception handling goes here.
}
conn.disconnected();

但是我得到以下错误

com.sap.mw.jco.JCO$Exception:<127> JCO_ERROR_FIELD_NOT_FOUND: Field USERID not a member of INPUT

但是我查了一下,SAP里面有exist列。

这里缺少什么?我还应该传递 RFC 表名吗?那怎么办?

最佳答案

我通过以下代码解决了这个问题。

JCO.Function function = null;
Connection conn = new Connection();
JCO.Client mConnection = conn.open();
JCO.Table GET_DATA = null;
JCO.Repository mRepository;
mConnection.connect();

mRepository = new JCO.Repository("KEYWORD",mConnection);

try{
function = this.createFunction("MY RFC NAME");
if(function != null){

GET_DATA = function.getTableParameterList.getTable(TABLE_NAME);
GET_DATA.appendRow();

function.getImportParameterList.setValue("ID1","USERID");
function.getImportParameterList.setValue("Test Name","UNAME");
function.getImportParameterList.setValue("CLASSA","UCLASS");

GET_DATA.nextRow();
mConnection.execute(function);
}
}catch(Exception ex){
// Exception handling goes here.
}
conn.disconnected();

关于java - 为什么 SAP JCo 会引发错误 "Field ... not a member of ...",即使该字段存在?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39639546/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com