📚 SAP Business One SDK Help

Application Property
See Also  Example
RHS
A UI API Application objection.

Description

To connect with SAP Business One, you can set this property to a SAPbouiCOM.Application object, and then call the Connect method without specifying any other connection properties -- the properties are taken from the UI API Application object.

Property type

Write-only property

Syntax

Visual Basic
Public Property Application( _
   ByVal RHS As Object _
) As Object

Parameters

RHS
A UI API Application objection.

Remarks

Creating a connection with this property is only relevant when an instance of the SAP Business One application on the same machine is open and connected to a company.

Example

Connecting using a UI API connection (Visual Basic)Copy Code
Private WithEvents SBO_Application As SAPbouiCOM.Application
Dim oSboGuiApi As SAPbouiCOM.SboGuiApi
Dim sConnectionString As String
Dim oApplication As SAPbouiCOM.Application
Dim oCompany As SAPbobsCOM.Company
Dim nResult As Long

oSboGuiApi = New SAPbouiCOM.SboGuiApi

' The connection string is passed to the add-on as a command line argument
sConnectionString = Environment.GetCommandLineArgs.GetValue(1)

' Set an add-on identifier (this identifier is for development license)
oSboGuiApi.AddonIdentifier = "4CC5B8A4E0213A68489E38CB4052855EE8678CD237F64D1C11C22707A54DBD2D5D5F6E4050A09B9F9FB80FAC44F6"

' Connect to a running SBO Application
oSboGuiApi.Connect(sConnectionString)

' Get an initialized application object
oApplication = oSboGuiApi.GetApplication()

oCompany = New SAPbobsCOM.Company

' Set UI Application object to Company object
oCompany.Application = oApplication

' Connect to current B1 company
nResult = oCompany.Connect

See Also