on 12-10-2010 3:23 PM
Hi All,
I want to connect SAP and send some values and get some results from BAPI with Visual Basic 6.0
I connected SAP successfull But I didn't send value to BAPI.
I want to connect SAP with BAPI_MATERIAL_GET_ALL BAPI and I want to send u2018000000000000980010u2019 parameter. So I want get the result from BAPI.
Could anyone help me about send and get value BAPI with VB 6.0?
Thanks in advanced
captivator
Edited by: captivator on Dec 10, 2010 4:24 PM
Hi,
Please find the below code:
Set bapi = CreateObject("SAP.BAPI.1")
Set conn = bapi.Connection
If conn.logon(0, false) <> True Then
MsgBox "Cannot logon!."
Else
MsgBox "logon succeed!."
End If
Set obj = bapi.GetSAPObject("BAPI_MATERIAL_GET_ALL BAPI")
Set return = bapi.DimAs(obj, "ZTest", "RETURN")
Regards,
Dinesh
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Dinesh,
My full code is below.
I'm getting error when "Set obj = ctlLogon.GetSAPObject("BAPI_MATERIAL_GET_ALL")" code line is working.
Error : Script error in module line 30:(10091) ActiveX Automation:no such property or method
Have you got any idea?
Thanks in advanced.
Esat
Set ctlLogon = CreateObject("SAP.LogonControl.1")
Set sapConnection = ctlLogon.NewConnection
sapConnection.User = "user"
sapConnection.Client = "120"
sapConnection.Password = "1q2w3e4r"
sapConnection.ApplicationServer = "xxxxxx"
sapConnection.Language = "EN"
sapConnection.SystemNumber = "00"
booReturn = sapConnection.Logon(0, True)
If booReturn <> True Then
gSAPConnect = False
Else
gSAPConnect = True
End If
If booReturn Then
'MsgBox "Logged On successfullyu2026"
Debug.Print"Logged On successfullyu2026"
End If
Dim obj As Object
Dim return As Object
Set obj = ctlLogon.GetSAPObject("BAPI_MATERIAL_GET_ALL")
Set return = ctlLogon.DimAs(obj, "000000000000980010", "RETURN")
Hi,
Please check the following link:
<< http://help.sap.com/saphelp_bw/helpdata/en/59/ae455e488f11d189490000e829fbbd/content.htm >>
Hope this helps.
Regards,
Dinesh
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.