Welcome Notes

Welcome Viewers

06 March 2018

Add button through SDK

Dear All,
   Today , We will see, How to Add button through SDK



Friend Sub AddButton(ByVal objForm As SAPbouiCOM.Form, ByVal SourceID As String, ByVal ItemUID As String, ByVal iLeft As Integer, ByVal iWidth As Integer, ByVal LinkTo As String, ByVal Caption As String, ByVal iHeight As Integer)
        Try
            Dim oItem As SAPbouiCOM.Item
            If objForm IsNot Nothing Then
                oItem = objForm.Items.Add(ItemUID, SAPbouiCOM.BoFormItemTypes.it_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.Button = objForm.Items.Item(ItemUID).Specific '' To Assign New Button
                btn.Caption = Caption
            End If
        Catch ex As Exception

        Finally
          
        End Try
    End Sub

Cursor focus on Grid Row

Dear All,
   Today , We will see, How to set Cursor focus on Grid Row through SDK.



C#.Net
_Grid.Columns.Item("Colunique").Click(0, false, 0);

VB.net
_Grid.Columns.Item("Colunique").Click(0, false, 0)

Get Matrix Combo Box Selected Value through SDK

Dear All,
   Today , We will see, How to Get Matrix Combo Box Selected Value through SDK.


Public Function GetComboBoxSelectedValue(ByVal oMatrix As SAPbouiCOM.Matrix, ByVal intRowIndex As Integer, ByVal intColIndex As Integer) As Integer
        Dim oComBo As SAPbouiCOM.ComboBox = oMatrix.Columns.Item(intColIndex).Cells.Item(intRowIndex).Specific
        Return oComBo.Value.Trim()
    End Function

05 March 2018

Get Date Separator SAP B1

Dear All,
   Today , We will see, Get Date Separator SAP B1 through SDK.



  Friend Function GetDateSep() As String
        Dim oCompanyService As SAPbobsCOM.CompanyService = Nothing
        Dim oCompanyAdminInfo As AdminInfo = Nothing
        Dim strReturn As String = String.Empty
        'get company service
        oCompanyService = oApp.SAPCompany.GetCompanyService
        'get admin info
        oCompanyAdminInfo = oCompanyService.GetAdminInfo
        Try
            strReturn = oCompanyAdminInfo.DateSeparator
        Catch ex As Exception
            strReturn = String.Empty
        Finally
            If oCompanyService IsNot Nothing Then
                oCompanyService = Nothing
            End If
            If oCompanyAdminInfo IsNot Nothing Then
                oCompanyAdminInfo = Nothing
            End If
        End Try


        Return strReturn
    End Function

Display Define New and Display last value from UDT in SAP B1

Dear All,
   Today , We will see, How to Display Define New and Display last value from UDT through SDK.


Private Sub ComboBox0_ComboSelectAfter(ByVal sboObject As Object, ByVal pVal As SAPbouiCOM.SBOItemEventArg) Handles ComboBox0.ComboSelectAfter
            Try
                If Me.ComboBox0.Selected.Value = "-9" Then
                    SBO_Application.ActivateMenuItem("51202")
                Else
                    Me.ComboBox0.ExpandType = SAPbouiCOM.BoExpandType.et_ValueDescription
                End If
            Catch ex As Exception

            End Try
        End Sub
 Private Sub SBO_Application_ItemEvent(ByVal FormUID As String, ByRef pVal As SAPbouiCOM.ItemEvent, ByRef BubbleEvent As Boolean) Handles SBO_Application.ItemEvent

            If pVal.FormTypeEx = "SetColorComboBox.Form1" Then
                Select Case pVal.EventType
                    Case SAPbouiCOM.BoEventTypes.et_FORM_ACTIVATE
                        If pVal.ActionSuccess And pVal.BeforeAction = False Then
                            objForm = SBO_Application.Forms.Item(pVal.FormUID)
                            If objForm IsNot Nothing Then
                                blnForm = False
                                If blnForm = False Then
                                    ComboBoxLoadValues(Me.ComboBox0, "SELECT Code,Name FROM ""@TESTDEFINENEW""  Order by Code")
                                    Me.ComboBox0.Item.DisplayDesc = True
                                End If
                            End If

                        End If
                End Select
            End If
        End Sub

        Private Sub SBO_Application_MenuEvent(ByRef pVal As SAPbouiCOM.MenuEvent, ByRef BubbleEvent As Boolean) Handles SBO_Application.MenuEvent
            If pVal.BeforeAction And pVal.MenuUID = "51202" Then
                ComboBox0.ValidValues.Remove(ComboBox0.ValidValues.Count - 1, SAPbouiCOM.BoSearchKey.psk_Index)
                ComboBox0.Item.Description = String.Empty
                blnForm = True
            End If

        End Sub