Skip to Content

SAP RFC_READ_TABLE not reading MS Excel VBA code lines


I am trying VBA RFC call to SAP from MS Excel,
Please help me with the VBA code as it not getting the expected results:


Set sap = CreateObject("SAP.Functions")

Set rfc = sap.Add("rfc_read_table")

rfc.Exports("QUERY_TABLE") = "T001"

[Error 1: The following 2 lines does not stop the code but results include the entire table]
rfc.Tables("OPTIONS").Value(1, "TEXT") = "BUKRS EQ 'US71'"

[Error 2: When I add the following 2 lines it yields 0 results i.e. rfc call fails. ]
rfc.Tables("FIELDS").Value(1, "FIELDNAME") = "BUKRS"

If rfc.Call() = True Then
total_rec = rfc.Tables("DATA").RowCount
MsgBox total_rec
End If


So to sum it up:
1) If I add ROWS to OPTIONS: these lines are not processed
2) If I add ROWS to FIELDS: RFC call fails.

Can you please help me resolve this

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

0 Answers