【问题标题】:how to add multiple rows to IRfcTable如何将多行添加到 IRfcTable
【发布时间】:2011-11-15 16:57:51
【问题描述】:

我正在尝试将 2 行传递给 BAPI 表,但我的代码始终只占用第 2 行。

我将数据传递为:

6 7 8
6 7 8

代替:

1 2 3
6 7 8

这是我尝试过的:

IRfcFunction bapiTEST = _rfcDest.Repository.CreateFunction(strBapi);

IRfcStructure structImport = _rfcDest.Repository.GetStructureMetadata("ZBAPI_A_STRU_ORDER_CLICK").CreateStructure();

structImport.SetValue("NUM1", "000001");
structImport.SetValue("NUM2", "000002");
structImport.SetValue("NUM3", "000003");

IRfcTable tblImport = bapiTEST.GetTable("IMPORT");
tblImport.Insert(structImport);

structImport.SetValue("NUM1", "000006");
structImport.SetValue("NUM2", "000007");
structImport.SetValue("NUM3", "000008");

tblImport.Insert(structImport);
bapiTEST.SetValue("IMPORT", tblImport);

RfcSessionManager.BeginContext(_rfcDest);
bapiTEST.Invoke(_rfcDest);

【问题讨论】:

  • 不要以为你可以访问自定义bapi的源代码?我的第一个猜测是它需要一个带有隐式工作区域的表,而您的远程调用没有正确处理它。但我对 C# 没有任何经验。

标签: c# sap sap-dotnet-connector


【解决方案1】:

我认为您正在重用structImport,因此您第二次调用SetValue 也会影响您插入的第一个structImport。尝试在两者之间调用另一个CreateStructure()

【讨论】:

  • 是的。谢谢你勒内。那确实解决了我的问题。非常感谢。
猜你喜欢
  • 2011-06-14
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2019-09-13
  • 1970-01-01
  • 2020-09-05
  • 2019-01-25
  • 1970-01-01
相关资源
最近更新 更多