Skip to Content
0
May 26, 2020 at 11:07 AM

Call function with C # and transfer table as parameter

632 Views

I want to call a function in SAP using the C # SAP connector. Before that, I have to fill out a table that serves as a transfer parameter. I can fill the table IRFTable Append () and SetValue () and read it out again. Unfortunately the function is not called and I don't get any tables back as a return. I have already tried it with a structure as a handover, unfortunately without success. However, the data types are correct, otherwise I will get an error message from SAP. I've also called other functions using string parameters, which always worked. The Connection to SAP is fine. What's happen? What i have to do?

My Code

<code>RfcDestination destination =RfcDestinationManager.GetDestination(cfg.GetParameters("PARAMTEST"));
        destination.Ping();IRfcFunction function = destination.Repository.CreateFunction("ZRFCMADDRT");IRfcTable table = function.GetTable("I_ZRFCMADDRTS");
        table.Append(1);
        table.SetValue("AUFNR","3000064439");
        table.SetValue("VEMNG_INP",33.44);
        table.SetValue("BRGEW",44.88);
        table.SetValue("EXIDV",string.Empty);
        table.SetValue("ZMODULE","MODULE0001");
        function.SetValue("I_ZRFCMADDRTS", table);//RfcStructureMetadata meta = destination.Repository.GetStructureMetadata("ZRFCMADDRTS");//IRfcStructure data = meta.CreateStructure();//data.SetValue("ZMODULE", Modul);//data.SetValue("AUFNR", AuftragsNr);//data.SetValue("EXIDV", string.Empty);//data.SetValue("VEMNG_INP", "22,44");//data.SetValue("BRGEW", "55,11");//table.Append(data);

        function.SetValue("I_ZRFCMADDRTS", table);[enter image description here][1]function.Invoke(destination);IRfcTable rfcTableLogs = function.GetTable("E_ZRFCLOGS");IRfcTable rfcTableReturns = function.GetTable("E_ZRFCRETURNS");Console.WriteLine(rfcTableLogs.RowCount.ToString());// Return is allways 0Console.WriteLine(rfcTableReturns.RowCount.ToString());// return is allways 0

Attachments