Skip to Content

-1116 error while creating business partner

hi. i am getting error "-1116" while creating Business Partner. so anybody please give solution.

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

4 Answers

  • Sep 25, 2017 at 12:29 PM

    here is my code to add into business partner

    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()

    Class_initialize_Renamed()

    AddBPF()

    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.Connect

    End Function

    Private Sub Class_initialize_Renamed()

    SetApplication()

    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 AddBPF()

    Dim bp As SAPbobsCOM.BusinessPartners

    Dim ocompany As SAPbobsCOM.Company

    ocompany = SBO_Application.Company.GetDICompany

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

    Try

    bp.CardName = "C014"

    bp.CardCode = "C014"

    bp.CardForeignName = "Mane"

    bp.GroupCode = "100"

    bp.CardType = SAPbobsCOM.BoCardTypes.cCustomer

    bp.Addresses.AddressName = "Address1"

    bp.Addresses.Block = "2"

    bp.Addresses.Street = "Hawelinagar"

    bp.Addresses.City = "kolhapur"

    bp.Addresses.State = "MH"

    bp.Addresses.Country = "ID"

    bp.Addresses.AddressType = SAPbobsCOM.BoAddressType.

    bo_ShipTo

    bp.Addresses.Add()

    bp.Addresses.AddressName = "Address1"

    bp.Addresses.Block = "1"

    bp.Addresses.Street = "street 1"

    bp.Addresses.City = "City 1"

    bp.Addresses.State = "AL"

    bp.Addresses.Country = "US"

    bp.Addresses.AddressType = SAPbobsCOM.BoAddressType.bo_BillTo

    bp.Addresses.Add()

    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 25, 2017 at 12:19 PM

    Hi,

    Please share complete error message here.

    Regards,

    Nagarajan

    Add comment
    10|10000 characters needed characters exceeded

  • Sep 26, 2017 at 06:11 AM

    When i right click on bp.add() and select Quick watch i am now getting -5002 error.can anyone please give solution .

    Add comment
    10|10000 characters needed characters exceeded

  • Sep 26, 2017 at 07:19 AM

    hi Niranjan my complete error is

    "Failed to add business partner. (5) check payment consolidation in the accounting Tab or you are not authorized to perform this action"

    Add comment
    10|10000 characters needed characters exceeded

    • I have solved the Issue. Payment consolidation error was coming because i Didn't add field under payment consolidation in Accounting Tab. So after adding following line of code Business Partner got successfully added.

      bp.BusinessType = SAPbobsCOM.BoBusinessPartnerTypes.garCompany

      bp.FatherType = SAPbobsCOM.BoFatherCardTypes.cPayments_sum

      bp.AccountRecivablePayables.AccountCode = "12107001"

      bp.AccountRecivablePayables.AccountType = SAPbobsCOM.BoBpAccountTypes.bpat_DownPayment

      bp.VatLiable = SAPbobsCOM.BoVatStatus.vLiable