on 02-24-2013 7:43 AM
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
Hi, I completely agree with Markus. Avoid using RFC_READ_TABLE. Why don't you use BAPISDORDER_GETDETAILEDLIST?
Apparently also your program flow is wrong. You shall call Invoke() once you set all the input parameters. OPTIONS and FIELDS are input parameters.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
In this wer you are getting the value from table?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
RfcDestinationManager.RegisterDestinationConfiguration(ECCDestination);
RfcDestination rfcDest = null;
rfcDest = RfcDestinationManager.GetDestination(a);
//SAPReader.TableReader tabReader = new TableReader(dest);
RfcRepository repo = rfcDest.Repository;
IRfcFunction customerList = repo.CreateFunction("RFC_READ_TABLE");
customerList.Invoke(rfcDest);
It says TABLE_NOT AVAILABLE
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
the overall approach should be thought over. Instead of accessing the table via RFC_READ_TABLE and thus bypassing all potential authority checks, you should either use an existing remote enabled function module or if there is none that fits your needs, then implement a specific remote enabled function module that invokes does those authority checks and prevents unauthorized access to the data. Such a function module could also be extended more easily than via RFC_READ_TABLE as there are more possibilities in ABAP directly.
Best regards,
Markus
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Two main issues that I can see.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
85 | |
10 | |
10 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.