The ActiveX, DCOM, and Java technologies all allow you to pass a table of values to any Remote enabled SAP Function that accepts TABLE type parameters.
If you don't have access to the ABAP developer websites, the ActiveX (COM) objects you will most likely use from VBA are also part of the Visual Studio 6.0 installation. Check your PC for an object named "SAP.Functions". If it's there you most likely have the .dll files you will need.
My standard reference on this subject is "Professional Visual Basic SAP R/3 Programming" (ISBN# 1-861002-7-85), though I understand several others have come out in the past year or so.
These are older technologies, since replaced by the more robust DCOM and Java connectors.
SWAT76 did you get a solution to your problem? I was having the same problem and was able to work it out. I would be interested in exchanging information with about calling SAP RFC's and writting BAPI's from VB.
The simple answer to you problem (please forgive typo's as I am typing this off the top of my head)
Set varSAPfunc1 = SAPFunctions.add("RFC_NAME"
set vartable1 = varSAPFunc1.tables("SAP_TABLE"
vartable1.appendrecord
vartable1. -- set the data here
varSAPFunc1.call
The set vartable1 line creates a pointer to the table as defined in the RFC_NAME which allows you to read and write data to it.
In addition I downloaded a PDF file from the web site that was mentioned earlier in the post. It provides additional information if you would like me to e-mail it to you.
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
Set oBapiService = oBAPICtrl.GetSAPObject("BapiService")
Set bo1 = oBAPICtrl.GetSAPObject("Vendor")
Set oVendor = oBAPICtrl.DimAs(bo1, "Find", "SELOPTTAB")
Set oResult = oBAPICtrl.DimAs(bo1, "Find", "RESULTTAB")
'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
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.