Code: Alles auswählen.
Set Func = FunctionCtrl.Add("RFC_READ_TABLE")
Func.Exports("QUERY_TABLE") = "VBAP"
Func.Exports("DELIMITER") = "|"
Dim oRowOPTIONS As Object
Dim ORowFields As Object
Set oRowOPTIONS = Func.Tables("OPTIONS").Rows.Add
oRowOPTIONS("TEXT") = "VBELN = '00" & KontrNr & "'"
Set ORowFields = Func.Tables("FIELDS").Rows.Add
ORowFields("FIELDNAME") = "VBELN"
Set ORowFields = Func.Tables("FIELDS").Rows.Add
ORowFields("FIELDNAME") = "PS_PSP_PNR"
Set ORowFields = Func.Tables("FIELDS").Rows.Add
ORowFields("FIELDNAME") = "ABGRU"
ret = Func.Call
If Func.Exception = "" And ret Then
Dim Spaltenname As String
Dim Datazeile As Object
Dim Offset As Long
Dim Length As Long
Dim PS_PSP_PNR As String
Dim ps As String
Dim absa As String
Dim vbeln As String
Dim ABGRU As String
For Each oData In Func.Tables("DATA").Rows
Datazeile = oData("WA")
For Each ORowFields In Func.Tables("FIELDS").Rows
Offset = ORowFields("OFFSET")
Length = ORowFields("LENGTH")
Spaltenname = ORowFields("FIELDNAME")
If Spaltenname = "PS_PSP_PNR" Then
ps = Mid(Datazeile, Offset + 1, Length)
ElseIf Spaltenname = "ABGRU" Then
absa = Mid(Datazeile, Offset + 1, Length)
ElseIf Spaltenname = "VBELN" Then
vbeln = Mid(Datazeile, Offset + 1, Length)
End If
If ps = pspelement And absa = newvalue Then
MsgBox "Verarbeitung"
ElseIf ps = pspelement And absa <> newvalue Then
MsgBox "Vorsicht, Kontraktänderung wurde nicht nachgezogen!!"
End If
Next ORowFields
Next oData
Else
MsgBox Func.Exception
End If