简体   繁体   中英

Integration with SAP

I am creating a system to integrate with SAP.

The client gave me the function and parameters, according to him, this function was usually performed in SAP but in my code when I try to retrieve the parameter, it returns me null.

Here my code

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");

Searching the internet found several examples similar to mine, here , here and here !

Why the method. get_Exports("MATNR"); returns null?

What are the exact parameters that where given to you for the RFC function ?
In the first part you seems to be looping over the column name of a table, and in the second one, you're searching for a parameter (ie not in the table).

regards
Guillaume

PS : ABAP is SAP proprietary language

我想你忘记了实际的函数调用,至少在代码示例中

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM