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.I开发者_开发问答Parameter 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
I think you forgot the actual function call, at least in the code sample
精彩评论