Additional Blogs by SAP
cancel
Showing results for 
Search instead for 
Did you mean: 
Former Member
0 Kudos

In this blog we will describe what the SAP Business One License API is and how you can use it in your Add-on. 

With SAP Business One 2005, the License Service moved from DCOM to CORBA to avoid security issues as CORBA is not tied to Windows authentication. Due to this a License bridge to the License Service API was developed. In essence it wraps the CORBA interface which is exposed by the SAP Business One License Service with a COM wrapper.

How to install the License Bridge to access the API

Run the Setup.Exe from the COM License Bridge Setup package provided for download in the following link:

http://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/508623e3-425c-2910-38be-cbe56e659...

It's important to Note that it will only work on the system where the License Service is running. Once it's installed you can register it as a COM Server by Start -> All Programs -> SAP Business One -> Server Tools -> COM License Bridge -> Register COM License Bridge. You can also unregister it selecting Unregister COM License Bridge

How to use the COM License Bridge

1. Add a reference “SBOLicense COM Bridge 1.0 Type Library” in your Microsoft Visual Studio project

2.Declare a variable for the LicenseInfo interface

Dim lc As SBOLICENSELib.ILicenseInfo - VB

SBOLICENSELib.LicenseInfo lc = null; - C#

3.Instantiate the LicenseInfo interface:

lc = NewSBOLICENSELib.LicenseInfo - VB

lc = SBOLICENSELib.LicenseInfo(); - C#

Once this is done you can then access all the methods of the License API. You can find the full list of methods exposed in the SDK Help File.

Some examples of how to use the License Bridge

1. Retrieve the Hardware Key and Installation Number from your License Service.

Dim hk, ins as String 

lc.GetHardwareKey(hk)

lc.GetInstallationNumber(ins)

MsgBox("Hardware key is " & hk & " and installation number is " & ins)

 

2. Check if a particular user is assigned a Professional User License.

Please note bstrModule expects the SWPRODUCTNAME from the license file.

result = lc.IsUserLicensed("manager", "PROFESSIONAL_MSS")

If result <> 0 Then

MsgBox("User is licensed")

Else

MsgBox("User is not Licensed")

End If

 

3. GetLicenseInfo allows you retrieve specific information from the license file.

Dim num, avail, start, dend as Integer

lc.GetLicenseInfo("PROFESSIONAL_MSS", num, avail, start, dend)

MsgBox("For Addon SDK TEST you have " & num & " in your license file and " & avail & " available. License started on start " & start & " and expires on " & dend)

 

4. GetLoggedinUsers returns a list of users currently logged into Business One - note this is via an XML file.

Dim xmlDoc As New Xml.XmlDocument

Dim productNodes As Xml.XmlNodeList

Dim ProductNode As Xml.XmlNode

Dim baseDataNodes Xml.XmlNodeList

Dim bFirstInRow As Boolean

lc.GetLoggedInUsers(users)

xmlDoc.LoadXml(users)

productNodes = xmlDoc.GetElementsByTagName("users")

For Each productNode In productNodes

baseDataNodes = productNode.ChildNodesbFirstInRow = True

For Each baseDataNode As Xml.XmlNode In baseDataNodes

If (bFirstInRow) Then bFirstInRow = False

Else

Console.Write(", ")

End If

Console.Write(baseDataNode.Name & ": " & baseDataNode.InnerText)

Next

Next

 

Planned changes in Version 8.8:

You can download the COM License Bridge for SAP Business One 8.8 from the link:

http://www.sdn.sap.com/irj/sdn/index?rid=/library/uuid/007a9ef5-9a9c-2d10-f3bc-94f765f235ce

 

Other information on the License Bridge in 8.8 can be found at:

http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/webcontent/uuid/702bc48d-8c53-2d10-3697-c8e7cd...

 

The planned changes in the license API are as follows:

  • GetInstallationNumberList method replaces the GetInstallationNumber method. The new method returns a list of installation numbers for the loaded license file, instead of a single number.
  • GetSystemNumber method's arguments have changed. The installation Number is passed to get the related system number.
  • IsLicenseFileExist is no longer supported.

In two weeks time, our blog will cover the topic of the SBO_SP_TransactionNotification stored procedure. So catch you then 🙂

29 Comments