in the meantime i found a solution ... see below !!!
BUT NOW I HAVE A NEW PROBLEM: we have a "new" client installation for sap-gui 6.5. this is a complete installation. with our old installation everything worked fine. when i want to create the sap.bapi object (first line of code below) i receive following runtime error: "runtime error 7. not enough memory". has anyone a hint ´what the problem is ?!
Set oBAPICtrl = CreateObject("SAP.BAPI.1")
oBAPICtrl.Connection.user = SAP_Buchhalter_KZ
oBAPICtrl.Connection.Password = Range("ImpExp").Cells(35, 1)
oBAPICtrl.Connection.Client = "001"
oBAPICtrl.Connection.Language = "DE"
If Not oBAPICtrl.Connection.Logon(0, False) Then 'True=SilentLogin
Set oBAPICtrl = Nothing
Fehler = 1
Exit Sub
End If
'*********************************************
'"VendorFind"
'*********************************************
Set oBapiService = oBAPICtrl.GetSAPObject("BapiService")
Set bo1 = oBAPICtrl.GetSAPObject("Vendor")
Set oVendor = oBAPICtrl.DimAs(bo1, "Find", "SELOPTTAB")
Set oResult = oBAPICtrl.DimAs(bo1, "Find", "RESULTTAB")
oVendor.Rows.Add
oVendor.Cell(1, "TABNAME") = "LFA1"
oVendor.Cell(1, "FIELDNAME") = "NAME4"
oVendor.Cell(1, "FIELDVALUE") = String(5 - Len(Range("Pers_Nr").Text), "0") + Range("Pers_Nr").Text
'BAPI Ausführen
bo1.Find SELOPTTAB:=oVendor, RESULTTAB:=oResult, RETURN:=oReturn
'Rückgabewerte auswerten
If oResult(1, "TYPE") = "S" Then ' Beleg in Ordnung
SAP_Kreditor = oResult(1, "VENDOR_NO")
Else
n = oResult.RowCount
For i = 1 To n
Meldung = oResult(i, "MESSAGE") ' Fehlerhinweis
If Meldung <> "" Then
MsgBox "Fehler: " & Meldung
Fehler = 1
End If
Next i
End If