Skip to Content

Hello Guys,

Greetings !!!

Kindly Find the Attached Procedure Step By Step to Attach User Defined Choose From List in SAP Business One System Forms e.g Item Master Data Screen.

 

1. Attaching Choose From List on System Field : e.g Mgf Catalog No (Purchasing Data Tab)
.For This I have Created No Object Type Table as GOD_OMGF

2. Attaching Choose From List on User Defined Field : e.g QC Group Code
.For This I have Created No Object Type Table as GOD_OQCG

 

Reference Material will be as following

  1. Main Class Code will be as Follows
Imports System.Reflection
Imports System.Diagnostics
Imports System.Net.Mail
Imports System.Net
Imports System.Text
Imports SAPbobsCOM

Public Class clsMain

#Region "Declaration"
    Dim objChooseForm As SAPbouiCOM.Form

    Public WithEvents GOD_Application As SAPbouiCOM.Application
    Public strGetManifestResourceStreamName As String = "GOD_QC_Addon"
    Public GOD_Company As SAPbobsCOM.Company
    Public SourceRowNo1 As Integer
    'Creating Instances For Each Class

    Public objUtilities As clsUtilities
    Public objItemMaster As clsItemMaster
    Public LastErrorDescription As String
    Public LastErrorCode As Integer

    'System Forms
    Public QueryXML As New Xml.XmlDocument
    Public objChoose As clsChooseFromList
    Public strVariant As String = ""
    Public strMenuClicked As String = ""
    Public strTmp As String = ""
    Public GOD_SourceForm As SAPbouiCOM.Form
    Public GOD_Static As SAPbouiCOM.StaticText
    Public GOD_Rec As SAPbobsCOM.Recordset
    'For UI
    Public GOD_Matrix As SAPbouiCOM.Matrix
    Public GOD_Edit As SAPbouiCOM.EditText
    Public GOD_Item As SAPbouiCOM.Item
    Public GOD_Combo As SAPbouiCOM.ComboBox
    Private referencedFormUID As String
    'For DI
    Public oDBs_Head As SAPbouiCOM.DBDataSource
    Public oDBs_Detail As SAPbouiCOM.DBDataSource
    'Objects
    Public GOD_ChkBox As SAPbouiCOM.CheckBox
    Public GOD_Column1 As SAPbouiCOM.ColumnTitle
    Public isAddConnected As Boolean = False
    Public GOD_RS As SAPbobsCOM.Recordset
    Public oRec As SAPbobsCOM.Recordset
    Public str As String = ""
    Public strTemp As String = ""
    'For Updating Sub User Details in SAP Activity Master
    Dim sCode As String = ""
    'For Sending Internal Messages in SAP Business one
    Public oCmpSrv As SAPbobsCOM.CompanyService
    Public oMessageService As MessagesService
#End Region

#Region "New"
    Public Sub New()
        'Object Initialization 19042017 - Mahendrakumar
        objUtilities = New clsUtilities
        objItemMaster = New clsItemMaster
    End Sub
#End Region

#Region "Initialise"
    Public Function Initialise() As Boolean
        GOD_Application = objUtilities.GetApplication()
        objUtilities.ShowSuccessMessage("Please wait for the System Form Manipulation Addon Icon to appear in menu. It may take few minutes based on Server and Network speed.")
        GOD_Company = objUtilities.GetCompany(GOD_Application)
        Dim strHardWareKey As String
        strHardWareKey = GOD_Main.objUtilities.GetHardWareKey
        Call CreateTables()
        objUtilities.LoadFromXML("Menus.xml", ResourceType.Embeded)
        Call createObjects()
        objUtilities.ShowSuccessMessage("System Form Manipulation Add-on Connected. You may now proceed to use addon.")
        Return True
    End Function
#End Region

#Region "Create Objects"
    Private Sub createObjects()
        objChoose = New clsChooseFromList
    End Sub
#End Region

    Public Sub CLFHeader(ByVal ItemUID As String, ByVal FormUID As String, ByVal CFLName As String, ByVal FormTypeEx As String)
        clsChooseFromList.ItemUID = ItemUID
        clsChooseFromList.SourceFormUID = FormUID
        clsChooseFromList.CFLChoice = CFLName
        Dim objChooseForm As SAPbouiCOM.Form
        If objUtilities.FormExist(FormTypeEx) = True Then
            'Do Nothing
        Else
            GOD_Main.objUtilities.LoadForm("GOD_CFLHeader.xml", "GOD_CFLHeader", "GOD_CFLHeader", ResourceType.Embeded)
            objChooseForm = GOD_Main.GOD_Application.Forms.ActiveForm
            objChoose.databound(objChooseForm, GOD_SourceForm, oDBs_Detail, oDBs_Detail, "", SourceRowNo1)
        End If
    End Sub

#Region "Create Table"
    Public Sub CreateTables()
        Try
            objUtilities.CreateTable("GOD_OMGF", "GOD Mgf Catalog No", SAPbobsCOM.BoUTBTableType.bott_NoObject)
            objUtilities.AddAlphaField("OITM", "Instrmnt", "Instrument", 1)
            objUtilities.AddAlphaField("OITM", "QCCode", "QC Group Code", 100)
            objUtilities.AddAlphaField("OITM", "QCName", "QC Group Name", 254)
            objUtilities.CreateTable("GOD_OQCG", "GOD QC Group", SAPbobsCOM.BoUTBTableType.bott_NoObject)
        Catch ex As Exception
            GOD_Main.GOD_Application.StatusBar.SetText(ex.Message, SAPbouiCOM.BoMessageTime.bmt_Short, SAPbouiCOM.BoStatusBarMessageType.smt_Warning)
        Finally
        End Try
    End Sub
#End Region

#Region "Item Event"
    Public Sub ItemEvent(ByVal FormUID As String, ByRef pVal As SAPbouiCOM.ItemEvent, ByRef BubbleEvent As Boolean) Handles GOD_Application.ItemEvent
        Try
            Select Case pVal.FormTypeEx
                Case "GOD_CFLHeader" 'For Choose From List at Header Level
                    objChoose.ItemEvent(FormUID, pVal, BubbleEvent)
                Case "GOD_CFLDetail" 'For Choose From List At Detail Level
                    objChoose.ItemEvent(FormUID, pVal, BubbleEvent)
                Case "150" 'For Item Master Item Event Calling
                    objItemMaster.ItemEvent(FormUID, pVal, BubbleEvent)
            End Select
        Catch ex As Exception
            GOD_Application.MessageBox(ex.Message)
        End Try
    End Sub
#End Region

#Region "Application Event"
    Private Sub ApplicationEvent(ByVal EventType As SAPbouiCOM.BoAppEventTypes) Handles GOD_Application.AppEvent
        If (EventType = SAPbouiCOM.BoAppEventTypes.aet_CompanyChanged Or EventType = SAPbouiCOM.BoAppEventTypes.aet_ServerTerminition Or EventType = SAPbouiCOM.BoAppEventTypes.aet_ShutDown) Then
            CloseApp()
        End If
    End Sub
#End Region

End Class



 

2. Utilities Class Code Will be

 

Imports System.Reflection
Public Class clsUtilities
    Public strLastErrorCode As String
    Public strLastError As String
    Public GOD_Form As SAPbouiCOM.Form
    Public objEdit As SAPbouiCOM.EditText
    Public strAddMenu As String = ""
    Private strThousSep As String = ","
    Private strDecSep As String = "."
    Private intQtyDec As Integer = 3
    Private objForm As SAPbouiCOM.Form
    Dim GOD_RecSet As SAPbobsCOM.Recordset
    Dim Crores, Lakhs, Rupees, Paise, Temp
    Dim DecimalPlace As Long, Count As Long
    Dim myLakhs, myCrores As String
    Dim Place(9) As String

#Region "To Get Hardware Key"
    Public Function GetHardWareKey() As String
        GOD_Main.GOD_Application.ActivateMenuItem("257")
        GOD_Form = GOD_Main.GOD_Application.Forms.GetForm("999999", 1)
        Dim strHardWareKey As String = GOD_Form.Items.Item("79").Specific.value
        GOD_Form.Close()
        Return strHardWareKey
    End Function
#End Region

#Region "Field Creations"
    Public Sub AddAlphaField(ByVal TableName As String, ByVal ColumnName As String, ByVal ColDescription As String, ByVal Size As Integer, Optional ByVal DefaultValue As String = "")
        Try
            addField(TableName, ColumnName, ColDescription, SAPbobsCOM.BoFieldTypes.db_Alpha, Size, SAPbobsCOM.BoFldSubTypes.st_None, "", "", DefaultValue)
        Catch ex As Exception
            GOD_Main.GOD_Application.StatusBar.SetText(ex.Message & " Field Name is " & ColDescription, SAPbouiCOM.BoMessageTime.bmt_Short, SAPbouiCOM.BoStatusBarMessageType.smt_Warning)
        End Try
    End Sub
#End Region

#Region "Create Table"
    Public Function CreateTable(ByVal TableName As String, ByVal TableDescription As String, ByVal TableType As SAPbobsCOM.BoUTBTableType) As Boolean
        Dim intRetCode As Integer
        Dim objUserTableMD As SAPbobsCOM.UserTablesMD
        objUserTableMD = GOD_Main.GOD_Company.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oUserTables)
        Try
            If (Not objUserTableMD.GetByKey(TableName)) Then
                objUserTableMD.TableName = TableName
                objUserTableMD.TableDescription = TableDescription
                objUserTableMD.TableType = TableType
                intRetCode = objUserTableMD.Add()
                If intRetCode = 0 Then
                    GOD_Main.objUtilities.ShowSuccessMessage(TableName & " Table Created Successfully.")
                    Return True
                Else
                    GOD_Main.objUtilities.ShowSuccessMessage(TableName & " Table Not Created Successfully.")
                    Return False
                End If
            Else
                Return False
            End If
        Catch ex As Exception
            GOD_Main.GOD_Application.StatusBar.SetText(TableName & " Table is not Created Successfully." & ex.Message)
        Finally
            System.Runtime.InteropServices.Marshal.ReleaseComObject(objUserTableMD)
            GC.Collect()
        End Try
    End Function
#End Region

    Public Function FormExistTypeEx(ByVal FormUID As String) As Boolean
        Dim intLoop As Integer
        For intLoop = GOD_Main.GOD_Application.Forms.Count - 1 To 0 Step -1
            If Trim(FormUID) = Trim(GOD_Main.GOD_Application.Forms.Item(intLoop).TypeEx) Then
                Return True
            End If
        Next
        Return False
    End Function


#Region "CREATE PROCEDURE"
    Sub View_CFL_OITM_QCGrpCode_ItemMaster()
        Dim RS As SAPbobsCOM.Recordset
        Dim SQL As String = String.Empty
        Dim ErrorCode As Integer = 0
        Try
            Dim xmldoc As New Xml.XmlDocument
            Dim Streaming As System.IO.Stream = Assembly.GetExecutingAssembly().GetManifestResourceStream("GOD_System_Addon.Database.xml")
            Dim StreamRead As New System.IO.StreamReader(Streaming, True)
            xmldoc.LoadXml(StreamRead.ReadToEnd)
            StreamRead.Close()
            RS = GOD_Main.GOD_Company.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset)
            SQL = "select count(*) from sysobjects where id = object_id(N'[CFL_OITM_QCGrpCode_ItemMaster]') and OBJECTPROPERTY(id, N'IsView') = 1"
            RS.DoQuery(SQL)
            If RS.Fields.Item(0).Value = 0 Then
                SQL = xmldoc.SelectSingleNode("//GOD/VIEW/CFL_OITM_QCGrpCode_ItemMaster").InnerText
                RS.DoQuery(SQL)
            End If
            System.Runtime.InteropServices.Marshal.ReleaseComObject(RS)
        Catch ex As Exception
            MessageBox.Show(ex.ToString())
        End Try
    End Sub

#End Region


#Region "GetApplication"
    'To Get SAP Business One Application
    Public Function GetApplication() As SAPbouiCOM.Application
        Dim objApp As SAPbouiCOM.Application
        Dim objSboGuiApi As New SAPbouiCOM.SboGuiApi
        Dim strConnectionString As String = Environment.GetCommandLineArgs.GetValue(1)
        objSboGuiApi = New SAPbouiCOM.SboGuiApi
        objSboGuiApi.Connect(strConnectionString)
        objApp = objSboGuiApi.GetApplication()
        Return objApp
    End Function
#End Region

#Region "GET COMPANY"
    'To Connect to SAP SAP Business One Company
    Public Function GetCompany(ByVal SBOApplication As SAPbouiCOM.Application) As SAPbobsCOM.Company
        Dim GOD_Company As SAPbobsCOM.Company
        Dim strCookie As String
        Dim strCookieContext As String
        Try
            GOD_Company = New SAPbobsCOM.Company
            strCookie = GOD_Company.GetContextCookie
            strCookieContext = SBOApplication.Company.GetConnectionContext(strCookie)
            GOD_Company.SetSboLoginContext(strCookieContext)
            If GOD_Company.Connect <> 0 Then
                strLastError = "Connection Error"
                SBOApplication.StatusBar.SetText("GOD Quality Control Addon Connection Error. Error is " & GOD_Main.GOD_Company.GetLastErrorDescription, SAPbouiCOM.BoMessageTime.bmt_Short, SAPbouiCOM.BoStatusBarMessageType.smt_Error)
                Return Nothing
            End If
            Return GOD_Company
        Catch ex As Exception
            SBOApplication.MessageBox(ex.Message)
            Return Nothing
        End Try
    End Function
#End Region

#Region "Register UDO"
    '*****************************************************************
    'Type               : Function    
    'Name               : registerUDO
    'Parameter          : UDOCode,UDOName,UDOType,findAliasNDescription,parentTableName,childTable1,childTable2,childTable3,childTable4,LogOption,DefFormOption,MenuItem,MenuCaption,FatherMenuId,Position
    'Return Value       : Boolean
    'Author             : Mahendrakumar 
    'Created Date       : 21042017
    'Last Modified By   : 
    'Modified Date      : 
    'Purpose            : To Register Use Defined Object in SAP Business One
    '*****************************************************************
    Function registerUDO(ByVal UDOCode As String, ByVal UDOName As String, ByVal UDOType As SAPbobsCOM.BoUDOObjType, ByVal findAliasNDescription As String(,), ByVal parentTableName As String, Optional ByVal childTable1 As String = "", Optional ByVal childTable2 As String = "", Optional ByVal childTable3 As String = "", Optional ByVal childTable4 As String = "", Optional ByVal childTable5 As String = "", Optional ByVal childTable6 As String = "", Optional ByVal childTable7 As String = "", Optional ByVal childTable8 As String = "", Optional ByVal LogOption As SAPbobsCOM.BoYesNoEnum = SAPbobsCOM.BoYesNoEnum.tNO, Optional ByVal DefFormOption As SAPbobsCOM.BoYesNoEnum = SAPbobsCOM.BoYesNoEnum.tNO, Optional ByVal MenuItem As SAPbobsCOM.BoYesNoEnum = SAPbobsCOM.BoYesNoEnum.tNO, Optional ByVal MenuCaption As String = "", Optional ByVal FatherMenuId As String = "", Optional ByVal Position As Integer = 0) As Boolean
        Dim actionSuccess As Boolean = False
        Try
            registerUDO = False
            Dim v_udoMD As SAPbobsCOM.UserObjectsMD
            v_udoMD = GOD_Main.objUtilities.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oUserObjectsMD)
            v_udoMD.CanCancel = SAPbobsCOM.BoYesNoEnum.tNO
            v_udoMD.CanClose = SAPbobsCOM.BoYesNoEnum.tNO
            v_udoMD.CanCreateDefaultForm = SAPbobsCOM.BoYesNoEnum.tNO
            v_udoMD.CanDelete = SAPbobsCOM.BoYesNoEnum.tYES
            v_udoMD.CanFind = SAPbobsCOM.BoYesNoEnum.tYES
            v_udoMD.CanLog = LogOption
            v_udoMD.CanYearTransfer = SAPbobsCOM.BoYesNoEnum.tYES
            v_udoMD.ManageSeries = SAPbobsCOM.BoYesNoEnum.tYES
            v_udoMD.Code = UDOCode
            v_udoMD.Name = UDOName
            v_udoMD.TableName = parentTableName
            If LogOption = SAPbobsCOM.BoYesNoEnum.tYES Then
                v_udoMD.LogTableName = "A" & parentTableName
            End If
            If DefFormOption = SAPbobsCOM.BoYesNoEnum.tYES Then
                v_udoMD.CanCreateDefaultForm = SAPbobsCOM.BoYesNoEnum.tYES
                v_udoMD.MenuItem = SAPbobsCOM.BoYesNoEnum.tYES
                v_udoMD.MenuCaption = MenuCaption
                v_udoMD.FatherMenuID = FatherMenuId
                v_udoMD.Position = Position
            End If
            v_udoMD.ObjectType = UDOType
            For i As Int16 = 0 To findAliasNDescription.GetLength(0) - 1
                If i > 0 Then v_udoMD.FindColumns.Add()
                v_udoMD.FindColumns.ColumnAlias = findAliasNDescription(i, 0)
                v_udoMD.FindColumns.ColumnDescription = findAliasNDescription(i, 1)
            Next
            If childTable1 <> "" Then
                v_udoMD.ChildTables.TableName = childTable1
                v_udoMD.ChildTables.Add()
            End If
            If childTable2 <> "" Then
                v_udoMD.ChildTables.TableName = childTable2
                v_udoMD.ChildTables.Add()
            End If
            If childTable3 <> "" Then
                v_udoMD.ChildTables.TableName = childTable3
                v_udoMD.ChildTables.Add()
            End If
            If childTable4 <> "" Then
                v_udoMD.ChildTables.TableName = childTable4
                v_udoMD.ChildTables.Add()
            End If
            If v_udoMD.Add() = 0 Then
                registerUDO = True
                GOD_Main.GOD_Application.StatusBar.SetText("Successfully Registered UDO >" & UDOCode & ">" & UDOName & ".", SAPbouiCOM.BoMessageTime.bmt_Short, SAPbouiCOM.BoStatusBarMessageType.smt_Success)
            Else
                GOD_Main.GOD_Application.StatusBar.SetText("Failed to Register UDO >" & UDOCode & ">" & UDOName & " >" & GOD_Main.GOD_Company.GetLastErrorDescription, SAPbouiCOM.BoMessageTime.bmt_Short, SAPbouiCOM.BoStatusBarMessageType.smt_Error)
                registerUDO = False
            End If
            System.Runtime.InteropServices.Marshal.ReleaseComObject(v_udoMD)
            v_udoMD = Nothing
            GC.Collect()
        Catch ex As Exception
            GOD_Main.GOD_Application.MessageBox(ex.Message)
        End Try
    End Function
#End Region

#Region "Check for UDO Exists"
    'Purpose            : To Check If User Defined Object already exists or not
    Public Function UDOExists(ByVal code As String) As Boolean
        GC.Collect()
        Dim v_UDOMD As SAPbobsCOM.UserObjectsMD
        Dim v_ReturnCode As Boolean
        v_UDOMD = GOD_Main.objUtilities.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oUserObjectsMD)
        v_ReturnCode = v_UDOMD.GetByKey(code)
        System.Runtime.InteropServices.Marshal.ReleaseComObject(v_UDOMD)
        v_UDOMD = Nothing
        Return v_ReturnCode
    End Function
#End Region

#Region "Load Form"
    'Purpose            : To Load Form in SAP Business One
    Sub LoadForm(ByVal XMLFile As String, ByVal FormType As String, ByVal FormUID As String, Optional ByVal FileType As ResourceType = ResourceType.Content)
        Try
            Dim xmldoc As New Xml.XmlDocument
            Dim Streaming As System.IO.Stream = Assembly.GetExecutingAssembly().GetManifestResourceStream("GOD_QC_Addon." + XMLFile)
            Dim StreamRead As New System.IO.StreamReader(Streaming, True)
            xmldoc.LoadXml(StreamRead.ReadToEnd)
            StreamRead.Close()
            Dim r As New Random
            r.Next(1000)
            If Not xmldoc.SelectSingleNode("//form") Is Nothing Then
                xmldoc.SelectSingleNode("//form").Attributes.GetNamedItem("uid").Value = xmldoc.SelectSingleNode("//form").Attributes.GetNamedItem("uid").Value & "_" & r.Next
                GOD_Main.GOD_Application.LoadBatchActions(xmldoc.InnerXml)
            End If
        Catch ex As Exception
            GOD_Main.GOD_Application.MessageBox(ex.Message)
        End Try
    End Sub
#End Region

#Region "LOAD FROM XML"
    'Purpose            : To Load SBO Form in SAP Business One Using XML Operations
    Public Sub LoadFromXML(ByVal FileName As String, Optional ByVal FileType As ResourceType = ResourceType.Content)
        Dim oXmlDoc As Xml.XmlDocument
        Dim oXmlStream As System.IO.Stream
        oXmlDoc = New Xml.XmlDocument
        Try
            If FileType = ResourceType.Content Then
                oXmlDoc.Load(FileName)
            Else
                oXmlStream = System.Reflection.Assembly.LoadFrom(System.Windows.Forms.Application.ExecutablePath).GetManifestResourceStream(GetType(modStartUp).Namespace & "." & FileName)
                oXmlDoc.Load(oXmlStream)
            End If
            GOD_Main.GOD_Application.LoadBatchActions(oXmlDoc.InnerXml)
        Catch ex As Exception
            GOD_Main.GOD_Application.StatusBar.SetText(ex.Message, SAPbouiCOM.BoMessageTime.bmt_Short, SAPbouiCOM.BoStatusBarMessageType.smt_Warning)
        End Try
    End Sub
#End Region

#Region "Add Column"
    'Purpose            : Add User Defined Field to Table
    Private Sub addCol(ByVal strTab As String, ByVal strCol As String, ByVal strDesc As String, ByVal nType As Integer, Optional ByVal nEditSize As Integer = 10, Optional ByVal nSubType As Integer = 0)
        Dim oUFields As SAPbobsCOM.UserFieldsMD
        Dim nError As Integer
        oUFields = GOD_Main.GOD_Company.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oUserFields)
        oUFields.TableName = strTab
        oUFields.Name = strCol
        oUFields.Type = nType
        oUFields.SubType = nSubType
        oUFields.Description = strDesc
        oUFields.EditSize = nEditSize
        nError = oUFields.Add()
        System.Runtime.InteropServices.Marshal.ReleaseComObject(oUFields)
        GC.Collect()
        GC.WaitForPendingFinalizers()
        If nError <> 0 Then
            'MsgBox(strCol & " table could not be added")
        End If
    End Sub
#End Region

#Region "Field Creations"
    'Purpose            : Add Alphabet Field to Table
    Public Sub AddAlphaField(ByVal TableName As String, ByVal ColumnName As String, ByVal ColDescription As String, ByVal Size As Integer, ByVal SubType As SAPbobsCOM.BoFldSubTypes, Optional ByVal DefaultValue As String = "")
        Try
            addField(TableName, ColumnName, ColDescription, SAPbobsCOM.BoFieldTypes.db_Alpha, Size, SAPbobsCOM.BoFldSubTypes.st_None, "", "", DefaultValue)
        Catch ex As Exception
            GOD_Main.GOD_Application.StatusBar.SetText(ex.Message, SAPbouiCOM.BoMessageTime.bmt_Short, SAPbouiCOM.BoStatusBarMessageType.smt_Warning)
        End Try
    End Sub

    'Purpose            : Add Field to Table 
    Public Sub addField(ByVal TableName As String, ByVal ColumnName As String, ByVal ColDescription As String, ByVal FieldType As SAPbobsCOM.BoFieldTypes, ByVal Size As Integer, ByVal SubType As SAPbobsCOM.BoFldSubTypes, ByVal ValidValues As String, ByVal ValidDescriptions As String, ByVal SetValidValue As String)
        Dim intLoop As Integer
        Dim strValue, strDesc As Array
        Dim objUserFieldMD As SAPbobsCOM.UserFieldsMD
        objUserFieldMD = GOD_Main.GOD_Company.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oUserFields)
        Try
            strValue = ValidValues.Split(Convert.ToChar(","))
            strDesc = ValidDescriptions.Split(Convert.ToChar(","))
            If (strValue.GetLength(0) <> strDesc.GetLength(0)) Then
                Throw New Exception("Invalid Valid Values")
            End If
            If (Not isColumnExist(TableName, ColumnName)) Then
                objUserFieldMD.TableName = TableName
                objUserFieldMD.Name = ColumnName
                objUserFieldMD.Description = ColDescription
                objUserFieldMD.Type = FieldType
                If (FieldType <> SAPbobsCOM.BoFieldTypes.db_Numeric) Then
                    objUserFieldMD.Size = Size
                Else
                    objUserFieldMD.EditSize = Size
                End If
                objUserFieldMD.SubType = SubType
                If strValue.Length > 1 Then
                    For intLoop = 0 To strValue.GetLength(0) - 1
                        objUserFieldMD.ValidValues.Value = strValue(intLoop)
                        objUserFieldMD.ValidValues.Description = strDesc(intLoop)
                        objUserFieldMD.ValidValues.Add()
                    Next
                    objUserFieldMD.DefaultValue = SetValidValue
                Else
                    If SetValidValue.Length > 0 Then
                        objUserFieldMD.DefaultValue = SetValidValue
                    End If
                End If
                If (objUserFieldMD.Add() <> 0) Then
                    GOD_Main.GOD_Application.StatusBar.SetText(GOD_Main.GOD_Company.GetLastErrorDescription)
                Else
                    GOD_Main.GOD_Application.StatusBar.SetText(objUserFieldMD.Name + " Created Successfully.", SAPbouiCOM.BoMessageTime.bmt_Short, SAPbouiCOM.BoStatusBarMessageType.smt_None)
                End If
            End If
        Catch ex As Exception
            GOD_Main.GOD_Application.StatusBar.SetText(ex.Message, SAPbouiCOM.BoMessageTime.bmt_Short, SAPbouiCOM.BoStatusBarMessageType.smt_Warning)
        Finally
            System.Runtime.InteropServices.Marshal.ReleaseComObject(objUserFieldMD)
            GC.Collect()
        End Try
    End Sub
#End Region

    '*****************************************************************
    'Type               : Function   
    'Name               : isColumnExist
    'Parameter          : Tablename,FieldName
    'Return Value       : Boolean
    'Author             : Mahendrakumar 
    'Created Date       : 21042017
    'Last Modified By   : 
    'Modified Date      : 
    'Purpose            : To Verify the Given Field already Exists or not
    '*****************************************************************
#Region " Column Exist or Not "
    Private Function isColumnExist(ByVal TableName As String, ByVal ColumnName As String) As Boolean
        Dim objRecordSet As SAPbobsCOM.Recordset
        Dim strTemp As String = ""
        objRecordSet = GOD_Main.GOD_Company.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset)
        Try
            strTemp = "SELECT COUNT(*) FROM CUFD WHERE TableID = '" & TableName & "' AND AliasID = '" & ColumnName & "'"
            objRecordSet.DoQuery(strTemp)
            If (Convert.ToInt16(objRecordSet.Fields.Item(0).Value) = 0) Then
                Return False
            Else
                Return True
            End If
            'Return (Convert.ToInt16(objRecordSet.Fields.Item(0).Value) <> 0)
        Catch ex As Exception
            Throw ex
        Finally
            System.Runtime.InteropServices.Marshal.ReleaseComObject(objRecordSet)
            GC.Collect()
        End Try
    End Function
#End Region

#Region "LOAD MENU"
    '*****************************************************************
    'Type               : Procedure   
    'Name               : LoadMenu
    'Parameter          : XmlFile
    'Return Value       : 
    'Author             : Mahendrakumar 
    'Created Date       : 21042017
    'Last Modified By   : 
    'Modified Date      : 
    'Purpose            : To Load Menu Item 
    '*****************************************************************
    Public Sub LoadMenu(ByVal XMLFile As String)
        Dim oXML As System.Xml.XmlDocument
        Dim strXML As String
        Try
            oXML = New System.Xml.XmlDocument
            oXML.Load(XMLFile)
            strXML = oXML.InnerXml()
            GOD_Main.GOD_Application.LoadBatchActions(strXML)
        Catch ex As Exception
            GOD_Main.GOD_Application.StatusBar.SetText(ex.Message, SAPbouiCOM.BoMessageTime.bmt_Short, SAPbouiCOM.BoStatusBarMessageType.smt_Warning)
        End Try
    End Sub
#End Region
    '-------------------------------------------------------------------------------------------
#Region "DI /UI Methods"

#Region "GetDateTime"
    '*****************************************************************
    'Type               : Function   
    'Name               : GetDateTimeValue
    'Parameter          : DateString
    'Return Value       : DateFormate
    'Author             : Mahendrakumar 
    'Created Date       : 21042017
    'Last Modified By   : 
    'Modified Date      : 
    'Purpose            : To Convert given string into dateTime Format
    '****************************************************************
    Public Function GetDateTimeValue(ByVal DateString As String) As DateTime
        Dim objBridge As SAPbobsCOM.SBObob
        objBridge = GOD_Main.GOD_Company.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoBridge)
        Return objBridge.Format_StringToDate(DateString).Fields.Item(0).Value
    End Function
    Public Function GetDateToString(ByVal DateString As String) As DateTime
        Dim objBridge As SAPbobsCOM.SBObob
        objBridge = GOD_Main.GOD_Company.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoBridge)
        Return objBridge.Format_DateToString(DateString).Fields.Item(0).Value
    End Function
    '*****************************************************************
    'Type               : Function   
    'Name               : GetSBODateString
    'Parameter          : DateTime
    'Return Value       : String
    'Author             : Mahendrakumar 
    'Created Date       : 21042017
    'Last Modified By   : 
    'Modified Date      : 
    'Purpose            : To Convert given  dateTime Format into string format
    '*****************************************************************
    Public Function GetSBODateString(ByVal DateVal As DateTime) As String
        Dim objBridge As SAPbobsCOM.SBObob
        objBridge = GOD_Main.GOD_Company.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoBridge)
        Return objBridge.Format_DateToString(DateVal).Fields.Item(0).Value
    End Function
#End Region

#Region "Number Conversions"
    '*****************************************************************
    'Type               : Function   
    'Name               : GetQtyValue
    'Parameter          : QtyString
    'Return Value       : Double
    'Author             : Mahendrakumar
    'Created Date       : 21042017
    'Last Modified By   : 
    'Modified Date      : 
    'Purpose            : To Convert given string into Number Format
    '*****************************************************************

    Public Function GetQtyValue(ByVal QtyString As String) As Double
        Dim dblValue As Double
        QtyString = QtyString.Replace(strThousSep, "")
        QtyString = QtyString.Replace(strDecSep, System.Globalization.NumberFormatInfo.CurrentInfo.NumberDecimalSeparator)
        dblValue = Convert.ToDouble(QtyString)
        Return dblValue
    End Function

    '*****************************************************************
    'Type               : Function   
    'Name               : GetQtyString
    'Parameter          : Double
    'Return Value       : String
    'Author             : Mahendrakumar
    'Created Date       : 21042017
    'Last Modified By   : 
    'Modified Date      : 
    'Purpose            : To Convert given  Double in QTY Format into String Format
    '*****************************************************************
    Public Function GetQtyString(ByVal QtyVal As Double) As String
        GetQtyString = QtyVal.ToString()
        GetQtyString.Replace(",", strDecSep)
    End Function
#End Region

#Region "Business Objects"

    '*****************************************************************
    'Type               : Function
    'Name               : GetBusinessObject
    'Parameter          : BOobjectTypes
    'Return Value       : Object
    'Author             : Mahendrakumar
    'Created Date       : 21042017
    'Last Modified By   : 
    'Modified Date      : 
    'Purpose            : To Create instance to the given object
    '*****************************************************************
    Public Function GetBusinessObject(ByVal ObjectType As SAPbobsCOM.BoObjectTypes) As Object
        Return GOD_Main.GOD_Company.GetBusinessObject(ObjectType)
    End Function

#Region "Filling the values in the Combo"
    '******************************************************************
    'Type               : Procedure
    'Name               : Fill Combo Values
    'Parameter          : GOD_Form,comboid
    'Return Value       : 
    'Author             : Mahendrakumar
    'Created Date       : 21042017
    'Last Modified By   : 
    'Modified Date      : 
    'Purpose            : To fill the values in the combo.
    '******************************************************************
    Public Sub FillDocvalues(ByVal GOD_Form As SAPbouiCOM.Form, ByVal comboid As String)
        Dim oRS As SAPbobsCOM.Recordset = GOD_Main.objUtilities.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset)
        Dim objCombo As SAPbouiCOM.ComboBox
        oRS.DoQuery("Select Code, Name from [@FCA_DOC]")
        objCombo = GOD_Form.Items.Item(comboid).Specific
        If (objCombo.ValidValues.Count <= 0) Then
            For i As Integer = 0 To oRS.RecordCount - 1
                objCombo.ValidValues.Add(oRS.Fields.Item(0).Value, oRS.Fields.Item(1).Value)
                oRS.MoveNext()
            Next
        End If
        Dim objItem As SAPbouiCOM.Item = GOD_Form.Items.Item(comboid)
        objItem.DisplayDesc = True
    End Sub
#End Region

    '*****************************************************************
    'Type               : Function   
    'Name               : CreateUIObject
    'Parameter          : BOCreatableobjectType
    'Return Value       : Object
    'Author             : Mahendrakumar 
    'Created Date       : 21042017
    'Last Modified By   : 
    'Modified Date      : 
    'Purpose            : To Create instance to the give UIObject
    '*****************************************************************
    Public Function CreateUIObject(ByVal Type As SAPbouiCOM.BoCreatableObjectType) As Object
        Return GOD_Main.GOD_Application.CreateObject(Type)
    End Function

#End Region

#Region "Form Objects"
    '*****************************************************************
    'Type               : Function   
    'Name               : GetForm
    'Parameter          : FormUID
    'Return Value       : Form
    'Author             : Mahendrakumar 
    'Created Date       : 21042017
    'Last Modified By   : 
    'Modified Date      : 
    'Purpose            : To Get SBOForm object for given FormUID
    '*****************************************************************
    Public Function GetForm(ByVal FormUID As String) As SAPbouiCOM.Form
        Return GOD_Main.GOD_Application.Forms.Item(FormUID)
    End Function

    '************************************************************************
    'Type               : Function   
    'Name               : GetForm
    'Parameter          : FormType,Count
    'Return Value       : Form
    'Author             : Mahendrakumar 
    'Created Date       : 21042017
    'Last Modified By   : 
    'Modified Date      : 
    'Purpose            : To Get SBOForm object for given FormType,FormTypecount
    '****************************************************************************
    Public Function GetForm(ByVal Type As String, ByVal Count As Integer) As SAPbouiCOM.Form
        Return GOD_Main.GOD_Application.Forms.GetForm(Type, Count)
    End Function
#End Region

#Region "GetEditTextValue"
    '*****************************************************************
    'Type               : Function   
    'Name               : GetEditText
    'Parameter          : SBOForm,ItemUID / FormUID,ItemUID
    'Return Value       : String
    'Author             : Mahendrakumar 
    'Created Date       : 
    'Last Modified By   : 
    'Modified Date      : 
    'Purpose            : Return Edit Text Value
    '*****************************************************************
    Public Function GetEditText(ByVal aForm As SAPbouiCOM.Form, ByVal aUID As String) As String
        objEdit = aForm.Items.Item(aUID).Specific
        Return Convert.ToString(objEdit.Value)
    End Function
    Public Function GetEditText(ByVal aFormUID As String, ByVal aUID As String) As String
        GOD_Form = GOD_Main.GOD_Application.Forms.Item(aFormUID)
        objEdit = GOD_Form.Items.Item(aUID).Specific
        Return Convert.ToString(objEdit.Value)
    End Function
#End Region

#Region "SetEditTextValue"
    '*****************************************************************
    'Type               : Procedure
    'Name               : SetEditText
    'Parameter          : SBOForm,ItemUID,Value / SBOFormUID,ItemUID,value
    'Return Value       : 
    'Author             : Mahendrakumar 
    'Created Date       : 21042017
    'Last Modified By   : 
    'Modified Date      : 
    'Purpose            : To set Value to Edit Text Box
    '*****************************************************************

    Public Sub SetEditText(ByVal aForm As SAPbouiCOM.Form, ByVal aUID As String, ByVal aVal As String)
        objEdit = aForm.Items.Item(aUID).Specific
        objEdit.Value = aVal
    End Sub
    Public Sub SetEditText(ByVal aFormUID As String, ByVal aUID As String, ByVal aVal As String)
        GOD_Form = GOD_Main.GOD_Application.Forms.Item(aFormUID)
        objEdit = GOD_Form.Items.Item(aUID).Specific
        objEdit.Value = aVal
    End Sub
#End Region
#End Region
    '*****************************************************************
    'Type               : Procedure
    'Name               : GetCode
    'Parameter          : sTableName
    'Return Value       : 
    'Author             : Mahendrakumar 
    'Created Date       : 21042017
    'Last Modified By   : 
    'Modified Date      : 
    'Purpose            : To Get Max Code From Table
    '*****************************************************************
    Public Function GetCode(ByVal sTableName As String) As String
        Dim oRecSet As SAPbobsCOM.Recordset
        Dim sQuery As String
        oRecSet = GOD_Main.GOD_Company.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset)
        'sQuery = "Select MaxValue = IsNull(Max(Convert(int,Code)),0) + 1 from " & sTableName
        sQuery = "SELECT Top 1 Code  FROM " & sTableName + " ORDER BY Convert(Int,Code) desc"
        oRecSet.DoQuery(sQuery)
        If Not oRecSet.EoF Then
            GetCode = Convert.ToInt32(oRecSet.Fields.Item(0).Value.ToString()) + 1
        Else
            GetCode = "1"
        End If
    End Function
    Public Function ShowSuccessMessage(ByVal Message As String)
        GOD_Main.GOD_Application.StatusBar.SetText(Message, SAPbouiCOM.BoMessageTime.bmt_Short, SAPbouiCOM.BoStatusBarMessageType.smt_Success)
        Return Nothing
    End Function
    Public Function FormExist(ByVal FormUID As String) As Boolean
        Dim intLoop As Integer
        For intLoop = GOD_Main.GOD_Application.Forms.Count - 1 To 0 Step -1
            If Trim(FormUID) = Trim(GOD_Main.GOD_Application.Forms.Item(intLoop).UniqueID) Then
                Return True
            End If
        Next
        Return False
    End Function

End Class

Public Enum ResourceType
    Embeded
    Content
End Enum


3. Choose From List Class Will be asĀ  Follows

 

Imports System.Reflection

Public Class clsChooseFromList
#Region "Declarations"
    Public Shared ItemUID As String
    Public Shared SourceFormUID As String
    Public Shared CFLChoice As String
    Private Ouserdatasource As SAPbouiCOM.UserDataSource
    Private oedit As SAPbouiCOM.EditText
    Private oForm As SAPbouiCOM.Form
    Private GOD_Matrix As SAPbouiCOM.Grid
    Private oItem As SAPbouiCOM.Item
    Private objGrid As SAPbouiCOM.Grid
    Private dtTemp As SAPbouiCOM.DataTable
    Private strSelectedItem1 As String = String.Empty
    Private strSelectedItem2 As String = String.Empty
    Private strSelectedItem3 As String = String.Empty
    Private strSelectedItem4 As String = String.Empty
    Private strSelectedItem5 As String = String.Empty
    Private strSelectedItem6 As String = String.Empty
    Private strSelectedItem7 As String = String.Empty
    Private strSelectedItem8 As String = String.Empty
    Private strSelectedItem9 As String = String.Empty

    Public Shared oDBs_DetailCont As SAPbouiCOM.DBDataSource
    Public Shared oDBs_DetailChrg As SAPbouiCOM.DBDataSource
    Public SourceMatrixRow As String
    Private referencedFormUID As String
    Public oUDS As SAPbouiCOM.UserDataSource
    Dim oformidTxt As SAPbouiCOM.EditText
#End Region

#Region "Bind Data"
    Public Sub databound(ByVal GOD_Form As SAPbouiCOM.Form, ByVal SourceForm As SAPbouiCOM.Form, ByVal oDBs_Detail1 As SAPbouiCOM.DBDataSource, ByVal oDBs_Detail2 As SAPbouiCOM.DBDataSource, ByVal Row As String, SourceRowNo1 As Integer)
        Try
            Dim strSQL As String = ""
            oDBs_DetailCont = oDBs_Detail1
            oDBs_DetailChrg = oDBs_Detail2
            SourceMatrixRow = Row

            oUDS = GOD_Form.DataSources.UserDataSources.Add("UDS1", SAPbouiCOM.BoDataType.dt_LONG_TEXT, 20)
            oformidTxt = GOD_Form.Items.Item("6").Specific
            oformidTxt.DataBind.SetBound(True, "", "UDS1")
            oformidTxt.Value = SourceForm.UniqueID
            referencedFormUID = SourceForm.UniqueID

            GOD_Form.Freeze(True)
            GOD_Form.DataSources.DataTables.Add("dtLevel3")
            Ouserdatasource = GOD_Form.DataSources.UserDataSources.Add("dbFind", SAPbouiCOM.BoDataType.dt_LONG_TEXT, 250)
            oedit = GOD_Form.Items.Item("etFind").Specific
            oedit.DataBind.SetBound(True, "", "dbFind")
            objGrid = GOD_Form.Items.Item("mtchoose").Specific
            dtTemp = GOD_Form.DataSources.DataTables.Item("dtLevel3")
            If CFLChoice = "CFL_ManufacturingCatalogNo" Then
                strSQL = "SELECT Code 'SAP Code',Code 'Mgf Catalog No',Name 'Mgf Catalog Name' FROM [@GOD_OMGF] Order By [SAP Code] Asc"
                If CFLChoice = "CFL_OITM_QC_Master" Then
                    GOD_Form.Title = "List Of Mgf.Catalog Nos"
                End If
                dtTemp.ExecuteQuery(strSQL)
                If dtTemp.IsEmpty = True Then
                    GOD_Main.GOD_Application.SetStatusBarMessage("No Matching Mgf Catalog Record Found.", SAPbouiCOM.BoMessageTime.bmt_Short, True)
                    GOD_Form.Close()
                    Exit Sub
                End If
                objGrid.DataTable = dtTemp
                objGrid.Columns.Item(0).TitleObject.Caption = "SAP Code"
                objGrid.Columns.Item(1).TitleObject.Caption = "Mgf Catalog No"
                objGrid.Columns.Item(2).TitleObject.Caption = "Mgf Catalog Name"
            End If
            If CFLChoice = "CFL_QCGroup" Then
                strSQL = "SELECT Code 'SAP Code',Code 'QC Group Code',Name 'QC Group Name' FROM [@GOD_OQCG] Order By [SAP Code] Asc"
                If CFLChoice = "CFL_OITM_QC_Master" Then
                    GOD_Form.Title = "List Of Mgf.Catalog Nos"
                End If
                dtTemp.ExecuteQuery(strSQL)
                If dtTemp.IsEmpty = True Then
                    GOD_Main.GOD_Application.SetStatusBarMessage("No Matching QC Group Record Found.", SAPbouiCOM.BoMessageTime.bmt_Short, True)
                    GOD_Form.Close()
                    Exit Sub
                End If
                objGrid.DataTable = dtTemp
                objGrid.Columns.Item(0).TitleObject.Caption = "SAP Code"
                objGrid.Columns.Item(1).TitleObject.Caption = "QC Group Code"
                objGrid.Columns.Item(2).TitleObject.Caption = "QC Group Name"
            End If
            objGrid.Columns.Item(0).Visible = False
            objGrid.AutoResizeColumns()
            objGrid.SelectionMode = SAPbouiCOM.BoMatrixSelect.ms_Single
            If objGrid.Rows.Count > 0 Then
                objGrid.Rows.SelectedRows.Add(0)
            End If
            GOD_Matrix = GOD_Form.Items.Item("mtchoose").Specific
            GOD_Form.Freeze(False)
            GOD_Form.Update()
        Catch ex As Exception
            GOD_Main.GOD_Application.MessageBox(ex.Message)
        Finally
        End Try
    End Sub
#End Region

    Public Sub CFLForm(ByVal strSQL As String, ByVal dtTemp As SAPbouiCOM.DataTable, ByVal objGrid As SAPbouiCOM.Grid, ByVal strTitle As String, ByVal GOD_Form As SAPbouiCOM.Form)
        GOD_Form.Title = strTitle
        dtTemp.ExecuteQuery(strSQL)
        objGrid.DataTable = dtTemp
        objGrid.Columns.Item(0).TitleObject.Caption = "SAP No."
        objGrid.Columns.Item(1).TitleObject.Caption = "Code"
        objGrid.Columns.Item(2).TitleObject.Caption = "Name"
        objGrid.Columns.Item(3).TitleObject.Caption = "Test Name"
    End Sub

#Region "Get Form"
    Public Function GetForm(ByVal FormUID As String) As SAPbouiCOM.Form
        Return GOD_Main.GOD_Application.Forms.Item(FormUID)
    End Function
#End Region

#Region "Item Event"
    Public Sub ItemEvent(ByVal FormUID As String, ByRef pVal As SAPbouiCOM.ItemEvent, ByRef BubbleEvent As Boolean)
        BubbleEvent = True
        If (pVal.FormTypeEx = "GOD_CFLHeader") Then
            If pVal.Before_Action = True Then
                If pVal.ItemUID = "mtchoose" Then
                    If pVal.EventType = SAPbouiCOM.BoEventTypes.et_CLICK Then
                        oForm = GetForm(pVal.FormUID)
                        oItem = CType(oForm.Items.Item(pVal.ItemUID), SAPbouiCOM.Item)
                        GOD_Matrix = CType(oItem.Specific, SAPbouiCOM.Grid)
                        GOD_Matrix.Rows.SelectedRows.Add(pVal.Row)
                    End If
                    If pVal.EventType = SAPbouiCOM.BoEventTypes.et_DOUBLE_CLICK Then
                        oForm = GetForm(pVal.FormUID)
                        referencedFormUID = oForm.Items.Item("6").Specific.value
                        LoadCFLvalues(pVal)
                    End If
                End If
            End If
        End If

        If pVal.ItemUID = "btnChoose" AndAlso pVal.EventType = SAPbouiCOM.BoEventTypes.et_ITEM_PRESSED Then
            oForm = GetForm(pVal.FormUID)
            referencedFormUID = oForm.Items.Item("6").Specific.value
            LoadCFLvalues(pVal)
        End If

        If pVal.BeforeAction = False Then
            If pVal.EventType = SAPbouiCOM.BoEventTypes.et_KEY_DOWN Then
                'For selecting the specific row according to search
                Try
                    oForm = GetForm(pVal.FormUID)
                    Dim objGrid As SAPbouiCOM.Grid
                    Dim oedit As SAPbouiCOM.EditText
                    If pVal.ItemUID = "etFind" And pVal.CharPressed <> "13" Then
                        Dim i, j As Integer
                        Dim strItem As String
                        objGrid = oForm.Items.Item("mtchoose").Specific
                        oedit = oForm.Items.Item("etFind").Specific
                        For i = 0 To objGrid.DataTable.Rows.Count - 1
                            strItem = ""
                            strItem = objGrid.DataTable.GetValue(1, i)
                            If (oedit.String.Length = 0) Then
                                Exit For
                            End If
                            For j = 1 To oedit.String.Length
                                If oedit.String.Length <= strItem.Length Then
                                    If strItem.Substring(0, j).ToUpper = oedit.String.ToUpper Then
                                        objGrid.Rows.SelectedRows.Add(i)
                                        Exit Try
                                    End If
                                End If
                            Next
                        Next
                    End If
                Catch ex As Exception
                    MessageBox.Show(ex.Message)
                End Try
                Try
                    oForm = GetForm(pVal.FormUID)
                    oItem = oForm.Items.Item("mtchoose")
                    GOD_Matrix = oForm.Items.Item("mtchoose").Specific
                    If (pVal.CharPressed = 40) Then
                        Dim currentRow As Integer
                        For intLoop As Integer = 0 To GOD_Matrix.DataTable.Rows.Count - 1
                            If (GOD_Matrix.Rows.IsSelected(intLoop)) Then
                                currentRow = intLoop
                                Exit For
                            End If
                        Next

                        Dim iRowcount As Integer = GOD_Matrix.Rows.Count
                        If currentRow < iRowcount - 1 Then
                            GOD_Matrix.Columns.Item("RowsHeader").Click(currentRow + 1, False)
                        End If
                    End If
                    If (pVal.CharPressed = 38) Then
                        Dim currentRow As Integer
                        For intLoop As Integer = 0 To GOD_Matrix.DataTable.Rows.Count - 1
                            If (GOD_Matrix.Rows.IsSelected(intLoop)) Then
                                currentRow = intLoop
                                Exit For
                            End If
                        Next
                        Dim iRowcount As Integer = GOD_Matrix.Rows.Count
                        If currentRow > 0 Then
                            GOD_Matrix.Columns.Item("RowsHeader").Click(currentRow - 1, False)
                        End If
                    End If
                Catch ex As Exception
                    MessageBox.Show(ex.Message)
                End Try
            End If
        End If
    End Sub
#End Region

#Region "LOAD CFL"
    Public Sub LoadCFLvalues(ByRef pVal As SAPbouiCOM.ItemEvent)
        oForm = GetForm(pVal.FormUID)
        oItem = oForm.Items.Item("mtchoose")
        GOD_Matrix = CType(oItem.Specific, SAPbouiCOM.Grid)
        Dim inti As Integer
        inti = 0
        Dim sandy As SAPbouiCOM.SelectedRows = GOD_Matrix.Rows.SelectedRows()
        Dim intRowId As Integer = sandy.Item(0, SAPbouiCOM.BoOrderType.ot_SelectionOrder)
        'Manufacturing Catalog No - CFL (Here We are Capturing Selected Values into Variable)
        If CFLChoice = "CFL_ManufacturingCatalogNo" Then
            strSelectedItem1 = Convert.ToString(GOD_Matrix.DataTable.GetValue(1, intRowId))
        ElseIf CFLChoice = "CFL_QCGroup" Then
            strSelectedItem1 = Convert.ToString(GOD_Matrix.DataTable.GetValue(1, intRowId))
            strSelectedItem2 = Convert.ToString(GOD_Matrix.DataTable.GetValue(2, intRowId))
        End If
        oForm.Close()
        oForm = GetForm(SourceFormUID)
        oForm = GOD_Main.objUtilities.GetForm(referencedFormUID)
        'Placing Selected Values From Choose From List to System/User Defined Fields
        If CFLChoice = "CFL_ManufacturingCatalogNo" Then
            oForm.Items.Item("18").Specific.value = strSelectedItem1
            oForm.Items.Item("18").Click(SAPbouiCOM.BoCellClickType.ct_Regular)
        ElseIf CFLChoice = "CFL_QCGroup" Then
            oForm.Items.Item("edQCGrp").Specific.value = strSelectedItem1
            oForm.Items.Item("edQCGrpNm").Specific.value = strSelectedItem2
            oForm.Items.Item("edQCGrp").Click(SAPbouiCOM.BoCellClickType.ct_Regular)
        End If
        strSelectedItem1 = ""
        strSelectedItem2 = ""
        strSelectedItem3 = ""
        strSelectedItem4 = ""
        strSelectedItem5 = ""
    End Sub
#End Region
End Class

 

Thanks and Regards,

Mahendrakumar

To report this post you need to login first.

2 Comments

You must be Logged on to comment or reply to a post.

  1. Former Member

    People like to read information that can serve simultaneous functions. This blog motivates and give information. So, it is a well attempt to fulfill the queries about SAP.

    (0) 

Leave a Reply