我正在使用 SAP .NET 连接器 3.0 从 SAP(R/3) 读取数据。我需要从销售订单中获取一些标题文本:
我发现了很多关于 READ_TEXT 函数的信息,可以用于此目的。在这里,您可以找到一些使用 ERPConnect 的示例。我正在尝试做同样的事情,并且我有以下返回 IRfcTable 的函数:
static IRfcTable ReadFunction(string destName, int rowCount)
{
// get the destination
RfcDestination dest = RfcDestinationManager.GetDestination(destName);
IRfcFunction func = dest.Repository.CreateFunction("RFC_READ_TEXT");
IRfcTable table = func.GetTable("TEXT_LINES");
table.Insert();
table.Insert();
table.Insert();
table.Insert();
table[0].SetValue("TDOBJECT", "VBBK");
table[1].SetValue("TDNAME", "3147856016");
table[2].SetValue("TDID", "Z019");
table[3].SetValue("TDSPRAS", "PL");
func.Invoke(dest);
return table;
}
VBBK
- 表示标题对象,3147856016
- 销售订单号,Z019
- EDI 供应商文本字段的 ID,PL
- 语言。结果,我正在检索一些数据,但字段 TDLINE 为空白:
根据示例,该字段应包含文本。
可能有些参数不正确。这是一篇很好的帖子,我在其中找到了如何获取每个文本字段的 TDID 参数。
我做错了什么?
更新:根据vwegert
下面的答案,代码已更改为:
IRfcTable table = func.GetTable("TEXT_LINES");
table.Insert();
table[0].SetValue("TDOBJECT", "VBBK");
table[0].SetValue("TDNAME", "3147856016");
table[0].SetValue("TDID", "Z019");
table[0].SetValue("TDSPRAS", "PL");
func.Invoke(dest);
return table;
现在参数是正确的。但TDLINE
仍然是空的。结果: