Skip to Content
0
Former Member
May 06, 2012 at 07:24 AM

obusinesspartners,ccustomer is not declared , it may be inaccessible due to protection level.

19 Views

Hi

Public Class Form1

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

Dim oCompany As SAPbobsCOM.Company

Dim lRetCode, lErrCode As Long

Dim sErrMsg As String

'Instantiate a Company object

oCompany = New SAPbobsCOM.Company

oCompany.Server = "(local)"

oCompany.CompanyDB = "ABC"

oCompany.UserName = "manager"

oCompany.Password = "manager"

'Set AddOn identifier – a long string with numbers; identifies

'your Add-On against License Service … optional!

'oCompany.AddOnIdentifier = “fill in your Add-On Identifier here”

lRetCode = oCompany.Connect()

'Check Return Code

If lRetCode <> 0 Then

'oCompany.GetLastError(lErrCode, sErrMsg)

End If

Dim oBP As SAPbobsCOM.BusinessPartners

'Dim lRetCode, lErrCode As Integer

'Dim sErrMsg As String

'Prepare empty oBP Object:

oBP = oCompany.GetBusinessObject(oBusinessPartners)

oBP.CardCode = "C08154711"

oBP.CardName = "James Tiberius Kirk"

oBP.CardType = cCustomer

'…

'Add the new BP to the database

lRetCode = oBP.Add()

If lRetCode <> 0 Then

oCompany.GetLastError(lErrCode, sErrMsg)

  1. MessageBox.Show("Error: " sErrMsg + “; Code: “ + lErrCode)

End If

End Sub

End Class

Thanks