Hello guys,
i have been reading several post and trying different methods to use SAP RFC_READ_TABLE. I have two sets of code that are running fine, but always passing fixed values as filters.
I would like to have a variable instead.
Maybe some of you could help me on this.
It is clear I am not an expert, but trying to learn.
This one is to check Sales document flow.
Problem is in below line: i would like to filter with VBELV EQ Variable, instead a fixed value.
This is the complete running code:
Thank you very much for your help,
Brian
i have been reading several post and trying different methods to use SAP RFC_READ_TABLE. I have two sets of code that are running fine, but always passing fixed values as filters.
I would like to have a variable instead.
Maybe some of you could help me on this.
It is clear I am not an expert, but trying to learn.
This one is to check Sales document flow.
Problem is in below line: i would like to filter with VBELV EQ Variable, instead a fixed value.
Code:
tblOptions(1, "TEXT") = "VBELV EQ '0050015909' and VBTYP_N EQ 'I' "
This is the complete running code:
Code:
P
ublic Sub RFC_Read_Table()Dim Functions As Object
Dim RfcCallTransaction As Object
Dim Messages As Object
Dim BdcTable As Object
Dim tblOptions
Dim tblData
Dim tblFields
Dim strExport1
Dim strExport2
Dim filOutput
Dim intRow As Integer
Dim conn As Object
Dim sap As Object
Set Functions = CreateObject("SAP.Functions")
Functions.Connection.System = "RR1"
Functions.Connection.client = "010"
Functions.Connection.user = "confob1"
Functions.Connection.Password = "Conforto1"
Functions.Connection.Language = "EN"
If Functions.Connection.logon(0, True) <> True Then
Exit Sub
End If
Set RfcCallTransaction = Functions.Add("RFC_READ_TABLE")
Set strExport1 = RfcCallTransaction.exports("QUERY_TABLE")
Set strExport2 = RfcCallTransaction.exports("DELIMITER")
Set tblOptions = RfcCallTransaction.Tables("OPTIONS") '
Set tblData = RfcCallTransaction.Tables("DATA") '
Set tblFields = RfcCallTransaction.Tables("FIELDS") '
strExport1.Value = "VBFA"
strExport2.Value = ";"
tblOptions.AppendRow
tblOptions(1, "TEXT") = "VBELV EQ '0050015909' and VBTYP_N EQ 'I' "
tblOptions.AppendRow
tblFields.AppendRow
tblFields(1, "FIELDNAME") = "VBELN"
If RfcCallTransaction.Call = True Then
If tblData.RowCount > 0 Then
For intRow = 1 To tblData.RowCount
OutputTxt1 = tblData(intRow, "WA")
Next
Else
MsgBox "No records returned"
End If
Else
MsgBox "Error"
End If
Set filOutput = Nothing
Functions.Connection.Logoff
End Sub
Thank you very much for your help,
Brian