06-28-2005 5:29 PM
Hello all,
Can anyone pls let me know how to connect VB from SAP.
I have following installed on my machine.
1) VB 6.0 enterprise edition
2) connectivity to SAP.
With the above installations can we connect to SAP from VB.
Is it mandatory to install VC++.
I have followed the steps gievn in help.sap.com.
http://help.sap.com/saphelp_me21sp2/helpdata/en/09/6b320f419311d2952000a0c94260a5/content.htm
but couldnt succeed. I guess i am missing some installations? i dont know.
Pls rush me ur ideas.
Have a nice time.
Martin.
06-28-2005 8:07 PM
Hi Martin,
I dont know exactly what point you are missing while connecting but you can follow the example given in the following pdf and map your application its basis.
www.simba.com/Knowledge_Center/docs/ Connecting_to_SAP_BW_Using_Visual_Basic_and_ADO_MD.pdf
Hope it helps,
Regards,
Gaurav
06-29-2005 10:52 PM
Hi,
You should install SAPgui in order to have SAP ActiveX controlls which you can use in VB.
To connect to SAP an execute one of RFC functions you can use following sample code:
Dim Funct, MyFunc As Object
Dim oTable, oRow As Object
Dim Result As Boolean
Set Funct = CreateObject("SAP.Functions")
Funct.Connection.System = "Your system"
Funct.Connection.client = "001"
Funct.Connection.user = "USERNAME"
Funct.Connection.Password = "PASS"
Funct.Connection.Language = "EN"
If Funct.Connection.logon(0, True) <> True Then
MsgBox "Login error"
Exit Sub
End If
Set MyFunc = Funct.Add("Z_TEST")
Set oTable = MyFunc.Tables("DATA")
Result = MyFunc.Call
If Result <> True Then
MsgBox MyFunc.Exception
Funct.Connection.Logoff
Exit Sub
End If
<...>
Funct.Connection.Logoff
Krzys
04-24-2007 6:26 AM
hi Krzys / Garuv / Martin
i tried to connect sap from vb as you reply but it not connect.
gave login error.
can you gave me any more solution or tel where i'm wrong.
what should be in
Funct.Connection.System =
system name / it ip / or something else
my vb code is ( i write this vb code on form load event)
Dim Funct, MyFunc As Object
Dim oTable, oRow As Object
Dim Result As Boolean
Set Funct = CreateObject("SAP.Functions")
Funct.Connection.System = "BSSLDEV"
Funct.Connection.client = "500"
Funct.Connection.user = "username"
Funct.Connection.Password = "pwd"
Funct.Connection.Language = "EN"
If Funct.Connection.logon(0, True) <> True Then
MsgBox "Login error"
Exit Sub
End If
Set MyFunc = Funct.Add("Z_TEST")
Set oTable = MyFunc.Tables("DATA")
Result = MyFunc.Call
04-24-2007 6:40 AM
04-24-2007 6:40 AM