c# - 与 SAP 集成

标签 c# parameters null integration sap

我正在创建一个与 SAP 集成的系统。

客户给了我函数和参数,据他说,这个函数通常在 SAP 中执行,但在我的代码中,当我尝试检索参数时,它返回 null。

这是我的代码

SAPFunctionsOCX.SAPFunctionsClass func = new SAPFunctionsOCX.SAPFunctionsClass();
func.Connection = connection;
SAPFunctionsOCX.IFunction ifunc = (SAPFunctionsOCX.IFunction)func.Add(functionName);
SAPTableFactoryCtrl.Tables tables = (SAPTableFactoryCtrl.Tables)ifunc.Tables;
SAPTableFactoryCtrl.Table objTable = (SAPTableFactoryCtrl.Table)tables[tableName];

//Paramters (Find one column "MATNR"
SAPTableFactoryCtrl.Columns cols2 = (SAPTableFactoryCtrl.Columns)objTable.Columns;
for (int i = 1; i <= cols2.Count; i++)
{
    SAPTableFactoryCtrl.Column col = (SAPTableFactoryCtrl.Column)cols2[i];
    Console.WriteLine(col.Name);
}

//Error here!  matnr == null
SAPFunctionsOCX.IParameter matnr = (SAPFunctionsOCX.IParameter)ifunc.get_Exports("MATNR");

在网上搜索了几个和我的类似的例子, here , herehere !

为什么方法。 get_Exports("MATNR");返回空值?

最佳答案

为 RFC 函数提供给您的确切参数是什么?
在第一部分中,您似乎在遍历表的列名,而在第二部分中,您正在搜索一个参数(即不在表中)。

问候
纪尧姆

PS:ABAP 是 SAP 专有语言

关于c# - 与 SAP 集成,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5155258/

相关文章:

c# - ReSharper 有没有一种方法可以抑制一个文件中的所有错误/警告?

c# - 字典将为空键

MySQl navicat::添加参数出错

postgresql - 修改 COALESCE 函数以考虑结果的两个相邻值

Java数组变量显示为空?

c# - 使用 LuaInterface - ERROR_DLL_INIT_FAILED

java - 如何使用超链接将表中的索引作为 struts 中的参数发送

C# Lambda WhereIf 或语句

ios - Swift WKWebView 未初始化并导致意外的 nil 错误

c# - 类既扩展了抽象类又实现了接口(interface)