‎2010 Dec 31 8:25 AM
Hello experts,
I am attempting to put a vb.net project together to load data for material master via BAPI. I am having some difficulty doing so using my only reference u201CVisual Basic SAP R/3 Programmingu201D by Oleg Ovanesyan. I believe it was released in the late 90u2019s. Do you know of any other references that will walk a person through using the SAP Active X controls that come with SAP GUI for vb.net? I am using Visual Studio 2008 or 2010 by the way.
Is downloading the SAP .Net Connector from the SAP site the only answer? If so, is there a place I can get this without being a Partner or Customer. I am currently renting access to a SAP system for my development.
Thank you all for the help.
‎2010 Dec 31 9:03 AM
Hi Michael,
I have created a Macro in excel to call a BAPI in SAP. You can modify the code where required.
Excel uses VBA so the code should be practically the same
'Connect to a SAP system
'Connection object
Dim sapConnection As Object
'Function Control (Collective object)
Dim objBAPIControl As Object
Set objBAPIControl = CreateObject("SAP.Functions")
Set sapConnection = objBAPIControl.Connection
'Get these details from the SAP GUI
sapConnection.ApplicationServer = "AppServer"
sapConnection.HostName = "HostName"
sapConnection.SystemNumber = "00"
sapConnection.System = "000"
sapConnection.Client = "300"
sapConnection.User = "DSOUZA"
sapConnection.Password = "Password"
sapConnection.Language = "EN"
If sapConnection.logon(0, False) Then
perform check_user(objBAPIControl)
Else
MsgBox "Could not connect to SAP system".
End If
'Call the BAPI from the SAP system
public sub check_user(objBAPIControl As Object)
Dim objUserBapi As Object
Set objUserBapi = objBAPIControl.Add("BAPI_USER_EXISTENCE_CHECK")
'Input parameters of BAPI
objUserBapi.exports("USERNAME").Value = "TestUser"
If objJobList.Call Then
dim return as object
'Export parameters of BAPI
set return = objUserBapi.imports("RETURN")
msgbox return.value("MESSAGE")
else
msgbox "Could not execute BAPI".
end if
‎2010 Dec 31 9:03 AM
Hi Michael,
I have created a Macro in excel to call a BAPI in SAP. You can modify the code where required.
Excel uses VBA so the code should be practically the same
'Connect to a SAP system
'Connection object
Dim sapConnection As Object
'Function Control (Collective object)
Dim objBAPIControl As Object
Set objBAPIControl = CreateObject("SAP.Functions")
Set sapConnection = objBAPIControl.Connection
'Get these details from the SAP GUI
sapConnection.ApplicationServer = "AppServer"
sapConnection.HostName = "HostName"
sapConnection.SystemNumber = "00"
sapConnection.System = "000"
sapConnection.Client = "300"
sapConnection.User = "DSOUZA"
sapConnection.Password = "Password"
sapConnection.Language = "EN"
If sapConnection.logon(0, False) Then
perform check_user(objBAPIControl)
Else
MsgBox "Could not connect to SAP system".
End If
'Call the BAPI from the SAP system
public sub check_user(objBAPIControl As Object)
Dim objUserBapi As Object
Set objUserBapi = objBAPIControl.Add("BAPI_USER_EXISTENCE_CHECK")
'Input parameters of BAPI
objUserBapi.exports("USERNAME").Value = "TestUser"
If objJobList.Call Then
dim return as object
'Export parameters of BAPI
set return = objUserBapi.imports("RETURN")
msgbox return.value("MESSAGE")
else
msgbox "Could not execute BAPI".
end if
‎2011 Jan 03 10:04 PM
I will give this a try in VBA, and attempting to get all that I am working on to work there. Once that is done, I will need to migrate that to .NET.
More to come in the next few days.
‎2011 Jan 23 7:34 AM
‎2011 Jan 26 2:58 AM
I have had some success, and will post my results if you need. I have not logged into SDN for a while, so sorry for such a late reply.
‎2011 May 23 4:21 PM
Hi
I would be very interested in your solution that you used in VB.net if you could please post.
Trevor