Welcome Notes

Welcome Viewers

13 March 2018

Add Linked Button through SAP Business One SDK- VB.NET

Add Linked Button through SAP Business One SDK- VB.NET

Introduction:

SAP Business One is a powerful enterprise resource planning (ERP) solution that allows businesses to streamline their operations. One of the key strengths of SAP Business One is its extensibility, which enables developers to enhance the user interface (UI) and functionality according to specific business needs.In this blog post, we will focus on a common customization - adding a linked button to a form using the SAP Business One SDK in VB.NET. Linked buttons are a convenient way to integrate custom functionality into the SAP Business One UI, providing users with quick access to specific actions.

Public Sub AddLinkedButton(ByVal objForm As SAPbouiCOM.Form, ByVal ItemUID As String, ByVal SourceID As String, ByVal iLeft As Integer, ByVal iWidth As Integer, ByVal iHeight As Integer, ByVal LinkTo As String, ByVal strLinkedObjectType As String, ByVal strLinkedObject As String)
        Dim oItem As SAPbouiCOM.Item = Nothing
        Try
            If objForm IsNot Nothing Then
                oItem = objForm.Items.Add(ItemUID, SAPbouiCOM.BoFormItemTypes.it_LINKED_BUTTON)
                oItem.Top = objForm.Items.Item(SourceID).Top
                oItem.Left = iLeft + (objForm.Items.Item(SourceID).Left + objForm.Items.Item(SourceID).Width)
                oItem.Width = iWidth
                oItem.Height = iHeight
                oItem.LinkTo = LinkTo
                Dim btn As SAPbouiCOM.LinkedButton = objForm.Items.Item(ItemUID).Specific '' To Assign New Button
                btn.LinkedObjectType = strLinkedObjectType
                btn.LinkedObject = strLinkedObject
            End If
        Catch ex As Exception
        Finally
            If objForm IsNot Nothing Then
                objForm = Nothing
            End If
            If oItem IsNot Nothing Then
                oItem = Nothing
            End If
        End Try
    End Sub

To summarize, adding a linked button in SAP Business One SDK in VB.NET requires specific steps for successful implementation. This enhances functionality and customization in the platform.