cancel
Showing results for 
Search instead for 
Did you mean: 

Having trouble reading an RFC Error table

former_member343317
Discoverer
0 Kudos

Hello all,

I am working on 2 separate RFC function calls using the .NET Connector 3.0 and I'm running into some problems. 

During the first call, I send a table with 1 or multiple records and get back the same number of records in a table along with any error codes in a separate table called E_ERROR_MSG.  This E_ERROR_MSG table will also have the same number of records as what I sent in to the function.  This all works fine.

During the second call, I am again sending a table with 1 or multiple records, but this time I'm only receiving back the E_ERROR_MSG table to notify me that data was updated successfully on the SAP side.  Now the E_ERROR_MSG table will only return 1 row.

My problem is, I'm using the same code in the second call to read the E_ERROR_MSG table that I am in the first call, but I'm not getting any rows in the table.  This would seem to me to be a problem on their side and not mine, but they are saying that everything is being done the same for both RFC's and when they run the same function in the SAP GUI it works fine. 

Does anyone have any ideas what could be wrong?  Below is the code I'm using for the first and second RFC call.  If you need any further details let me know.  Oh and both RFC calls are in separate functions inside of Visual Studio so variable names shouldn't affect anything.

Thanks!

' first RFC code which works

Dim p_return_error1 As IRfcTable = p_func1.GetTable("E_ERROR_MSG")

                           

For Each p_x As IRfcStructure In p_return_error1

    If p_x.GetString(0) = "01" Then p_error1 &= IIf(p_error1 <> "", ", ", "") & p_x.GetString(1)

    If p_x.GetString(0) = "02" Then p_error2 = True

    If p_x.GetString(0) = "03" Then p_error3 &= IIf(p_error3 <> "", ", ", "") & p_x.GetString(1)

Next

' second RFC code which doesn't find any IRfcStructures in p_return_error1

Dim p_return_error1 As IRfcTable = p_func1.GetTable("E_ERROR_MSG")

For Each p_x As IRfcStructure In p_return_error1 

    If p_x.GetString(0) = "Su" Then Return "SUCCESS"

Next

Accepted Solutions (1)

Accepted Solutions (1)

former_member197445
Contributor
0 Kudos

Please confirm:  During debug, is p_return_error1 nothing or is it a table with zero rows?  If it is a table with zero rows, then it is definitely a problem on the ABAP side where the developer is not appending rows to the table.  Also, check to make sure that the second function module isn't perhaps returning a structure instead of a table.  In this case, I would think your p_return_error1 object would be NOTHING.

former_member343317
Discoverer
0 Kudos

I can't actually debug without message boxes because I'm developing outside of the network this will be run on so bear with me here...

When I call the 2 following lines of code I get "No Rows" and 0 for the Row Count.  

Call MsgBox(IIf(p_return_error1 Is Nothing, "Nothing", "No Rows"), MsgBoxStyle.Critical)

Call MsgBox(p_return_error1.RowCount, MsgBoxStyle.Critical)

When I call the following code it says "E_ERROR_MSG : Table"

Call MsgBox(p_func1.GetElementMetadata(9).Name & " : " & p_func1.GetElementMetadata(9).DataType.ToString, MsgBoxStyle.Critical)

... is this enough to confirm it's a table or could it still be a structure?  My understanding was that I'm getting back a table with each row being a structure even though a structure would be fine in this case since I'm just looking for 1 result.

Thanks a lot for your help.  From the few posts I've read here that you responded to you seem very knowledgeable.

former_member197445
Contributor
0 Kudos

OK, well that definitely confirms that the error table has no rows.  I think you're still going to have to dig into the ABAP side to see why this is being caused.  I don't think you're doing anything wrong on your side.

In your example, you seem to be expecting "Su" to be returned.

If p_x.GetString(0) = "Su" Then Return "SUCCESS"

Are you able to confirm that the function module is set up to send a row with "Su" in the first column of the row for success?  Perhaps the ABAPer simply forgot to append a row on success and is only appending a row for errors.  In this case, zero rows would mean "SUCCESS."

In any case, the answer most likely resides in the ABAP.  I'd be very surprised looking at the results of your test if the problem was in the .NET code.

If you have access to SE37 on the ABAP side, see if you can find the code that appends the row to the E_ERROR_MSG table.

Answers (0)