Skip to Content

How to Add business partener through coding

hi. can anyone give sample code for adding data in business partner using vb.net .I am using SAP business one 9.0. .

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • Sep 23, 2017 at 12:36 PM

    Public Class AddBP_cls Private WithEvents SBO_Application As SAPbouiCOM.Application

    Private ocompany As SAPbobsCOM.Company

    Private Sub SetApplication()

    Dim SboGuiApi As SAPbouiCOM.SboGuiApi

    Dim sConnectionString As String

    SboGuiApi = New SAPbouiCOM.SboGuiApi

    sConnectionString = Environment.GetCommandLineArgs.GetValue(1)

    SboGuiApi.Connect(sConnectionString)

    SBO_Application = SboGuiApi.GetApplication()

    End Sub

    Public Sub New()

    MyBase.New()

    SetApplication()

    AddBP()

    End

    Sub Private Function SetConnectioncontext() As Integer

    Dim scookies As String

    Dim sconnectioncontext As String

    ocompany = New SAPbobsCOM.Company

    scookies = ocompany.GetContextCookie

    sconnectioncontext = SBO_Application.Company.GetConnectionContext(scookies)

    If ocompany.Connected = True

    Then ocompany.Disconnect() End If

    SetConnectioncontext = ocompany.SetSboLoginContext(sconnectioncontext)

    End Function

    Private Function ConnectToCompany() As Integer

    ConnectToCompany = ocompany.Connected

    End Function

    Private Sub Class_initialize_Renamed()

    If Not ConnectToCompany() = 0 Then

    SBO_Application.MessageBox("failed to connect to company's DB")

    End If

    If Not SetConnectioncontext() = 0 Then

    SBO_Application.MessageBox("Failed to connect to DI API")

    End If

    End Sub

    Private Sub AddBP()

    Dim bp As SAPbobsCOM.BusinessPartners

    Dim ocompany As SAPbobsCOM.Company

    ocompany = SBO_Application.Company.GetDICompany

    bp = ocompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oBusinessPartners)

    Try

    bp.CardCode = "C016"

    bp.CardName = "C016"

    bp.CardForeignName = "mark"

    bp.GroupCode = "100"

    bp.CardType = SAPbobsCOM.BoCardTypes.cCustomer

    bp.Addresses.AddressName = "N.P"

    bp.Addresses.City = "Mumbai" bp.Addresses.Country = "India"

    'bp.Addresses.Nationality = "Indian"

    ' bp.Addresses.State = "Maharashtra"

    ' bp.Addresses.ZipCode = "0231"

    bp.Add()

    Catch ex As Exception

    MessageBox.Show(ex.Message)

    End Try

    End Sub

    End Class

    Add comment
    10|10000 characters needed characters exceeded

  • Sep 23, 2017 at 12:37 PM

    this is my program

    Add comment
    10|10000 characters needed characters exceeded