Skip to Content
0
Former Member
Feb 24, 2013 at 07:43 AM

Query a table using RFC_READ_TABLE using .net connector 3.0

1845 Views

Community,

I have been using RFC Dot net connector 3.0 to fetch data from a function for now and there was no need to change the code for a while, but now a new requirement forces us to fetch data from a table.

So i'm trying to use RFC_READ_TABLE to read from VBAK table.

I'm able to connect and able to see the Import/Table parameters for function RFC_READ_TABLE, Though when i try to set the value for Table parameters (adding where clause to filter records), this throws an exception. Here is the code,

RfcSessionManager.BeginContext(rfcDest);

IRfcFunction function = rfcDest.Repository.CreateFunction("RFC_READ_TABLE");

RfcRepository repo = rfcDest.Repository;

function.SetValue("QUERY_TABLE", "VBAK" );

function.SetValue("ROWCOUNT", "2" );

function.SetValue("NO_DATA", "FALSE" );

function.Invoke(rfcDest);

IRfcTable inputTableFields = function.GetTable("FIELDS");

inputTableFields[0].SetValue("FIELDNAME", "ERDAT");

inputTableFields[1].SetValue("FIELDNAME", "VBELN");

IRfcTable inputTableOptions = function.GetTable("OPTIONS");

inputTableOptions[0].SetValue("TEXT", "ERDAT EQ 20130223"); // Exception Message is triggered here saying that the table is null.

Where am i going wrong? Any help on this would be appreciated.

Thanks