11-05-2018 10:47 AM
First of all, I am not sure if I posted my question under the correct tag. So, if it should be wrong please advise me.
I created an RFC server in C# .net with the .NET connector. This works great for simple functions that return a string value. Now I have the following requirement for a function:
IMPORTING
VALUE(FI_T_VAL) TYPE YSSTRING_TT
EXPORTING
VALUE(FE_T_VAL) TYPE YSSTRING_TT
VALUE(FE_ERROR) TYPE INT4
So, I have to provide a table as a return value but I have noe idea how to construct this in code. What I have is an IRfcFunction object on which I would like to call the following method:
SetValue(string name, IRfcTable table);
Can someone give a sample how to table a C# List<string> and ceate an object of type IRfcTable that contains the elements of that List<string>?
Any help is very much appreciated.
Regards,
Dirk.
11-08-2018 10:19 AM
Hi Dirk,
did you already have a look at the tutorial, which is available from https://support.sap.com/nco? You simply fetch the table from the function and append all rows to it that should reflect the response
Best regards,
Markus
11-08-2018 10:19 AM
Hi Dirk,
did you already have a look at the tutorial, which is available from https://support.sap.com/nco? You simply fetch the table from the function and append all rows to it that should reflect the response
Best regards,
Markus
11-08-2018 1:12 PM
Hi Markus,
thank you very much for your answer. I really appreciate it. Yes, I am aware of this tutorial. My program throws an RfcInvalidParameterException when executing the following line:
var rfcTable = function.GetTable(Consts.ResultTableName, true);
Const.ResultTableName is the string "RFCRESULT".
What I don't understand is: isn't it necessary to create the table beforehand (if yes, how?) or can I just call GetTable and give it an arbitrary name and SAP will create it?
My task is just to create a table with a single string column, populate some rows and pass the table as a return value.
Any ideas what I am doing wrong?
Regards,
Dirk.
11-08-2018 1:18 PM
The details of the RfcInvalidParameterException are:
Message: Element RFCRESULT of container metadata Y_S_PAN_ENCRYPT_LIST unknown
Error Code: 8
Y_S_PAN_ENCRYPT_LIST is my server function name.
11-12-2018 6:28 AM
Ah, now I understand. The table for the return value already exists and I don't have to create it myself. I can just get it by calling GetTable(FE_T_VALUE) and the populate it. I tried it and it worked.
So, thank you Markus for your support.
Regards,
Dirk.