Girish_AM 0 Newbie Poster

Dear All,

I want to connect to SAP and call RFC from VB.Net 2008.
I have done it with VB 6.0
But not getting success in VB.Net
I used following code in VB 6.0
------------------------------------------------
Set ctlLogon = CreateObject("SAP.LogonControl.1")
Set oConnection = ctlLogon.NewConnection

oConnection.User = "SIILRFC"
oConnection.Client = "777"
oConnection.Password = "infy@1234"
oConnection.ApplicationServer = "10.250.2.49"
oConnection.Language = "EN"
oConnection.SystemNumber = "00"

booReturn = oConnection.Logon(0, True)

If booReturn <> True Then
gSAPConnect = False
Else
gSAPConnect = True
End If

''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Set funcControl = CreateObject("SAP.Functions")
funcControl.Connection = oConnection
Set oRFC = funcControl.Add("ZSIILMM002")
Set oText = oRFC.Exports("TEXT1")
Set oWerks = oRFC.Exports("WERKS1")
Set oProduct = oRFC.Exports("PRODUCT")
oText.Value = Data
oWerks.Value = Works
oProduct.Value = Product
If oRFC.Call = True Then
oStatus = oRFC.Imports("STATUS")
If oStatus = 1 Then ' fail
PostCoil = 1
End If
If oStatus = 0 Then ' success
PostCoil = 2
End If
If oStatus = 2 Then ' DATA ALREADY I SAP
PostCoil = 5
End If
Else
PostCoil = 4 ' RFC not executed
End If
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
------------------------------------------------

Please guide me to do it with VB.NET 2008