gpt4 book ai didi

c# - 使用 RFC_READ_TEXT 从销售订单中检索文本

转载 作者:行者123 更新时间:2023-11-30 17:50:17 25 4
gpt4 key购买 nike

我正在使用 SAP .NET 连接器 3.0 从 SAP(R/3) 读取数据。我需要从销售订单中获取一些标题文本: enter image description here

我找到了很多关于可用于此目的的 READ_TEXT 函数的信息。在这里你可以找到一些 sample 如何使用 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 - 表示 header 对象,3147856016 - 销售订单号,Z019 - EDI 供应商文本字段的 ID,PL - 语言。因此,我正在检索一些数据,但字段 TDLINE 为空:

enter image description here
根据示例,此字段应包含文本。
可能有些参数不正确。 <强> Here 是一篇很好的文章,我在其中找到了如何为每个文本字段获取 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 仍然是空的。结果:
enter image description here

最佳答案

该功能模块需要以下参数:

  TDOBJECT    TDNAME       TDID       TDSPRAS
----------- ------------ ---------- -------
1 VBRK 3147856016 Z019 PL

您正在使用以下参数调用它:

  TDOBJECT    TDNAME       TDID       TDSPRAS
----------- ------------ ---------- -------
1 VBRK
2 3147856016
3 Z019
4 L

这行不通 - 功能模块将采用包含 TDNAME 的行,添加 TDBOJECT = 'DRAD', TDID = 'LTXT'TDSPRAS = SY-LANGU 并尝试阅读该文本。这可能会失败,导致您看到空行。另请注意,您需要提供内部语言指示符,它是一个字符。

此外,您完全忽略了 MESSAGES 参数,该参数可能包含一些消息,这些消息会告诉您很多有关错误的信息。

关于c# - 使用 RFC_READ_TEXT 从销售订单中检索文本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20906107/

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