cancel
Showing results for 
Search instead for 
Did you mean: 

how to show ITEM CODE in matrix form???

Former Member
0 Kudos

Hi all,

In my addon i have a matrix....in the first column of the matrix i want to display the Item code from the Item master data..when i press tab & also i want to show the CFL for that....can anybody suggest me some ideas for this???

regards,

shangai.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

hi yatsea,

sorry i don't want any link button in the matrix...just i want CFL of displaying items(ORDR,Item No,Item name) in the matrix column....can u please suggest me some coding...iam little bit got connfused by ur C# coding...can u give in vb.net...

regards

shangai.

YatseaLi
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hello Shangai,

Here is a sample code:

1.Add the Grid column with choose from list from in VB.Net

oItem = oItems.Add("My_Grid", SAPbouiCOM.BoFormItemTypes.it_GRID)
            oItem.Top = 40
            oItem.Left = 10
            oItem.Width = 150
            oItem.Height = 100
            Dim oGrid As SAPbouiCOM.Grid = oItem.Specific
            Dim oDataTable As SAPbouiCOM.DataTable = oForm.DataSources.DataTables.Add("My_DT")
            oGrid.DataTable = oDataTable
            oDataTable.ExecuteQuery("SELECT ItemCode, Dscription FROM RDR1 WHERE DocEntry = 0")

            Dim oCFLs As SAPbouiCOM.ChooseFromListCollection = oForm.ChooseFromLists
            Dim oCFLCreationParams As SAPbouiCOM.ChooseFromListCreationParams
            oCFLCreationParams = oApp.CreateObject(SAPbouiCOM.BoCreatableObjectType.cot_ChooseFromListCreationParams)

            'Adding a choosefromlist for the column
            oCFLCreationParams.MultiSelection = False
            oCFLCreationParams.ObjectType = "4"
            oCFLCreationParams.UniqueID = "CFL1"

            Dim oItemCodeCol As SAPbouiCOM.EditTextColumn
            oItemCodeCol = CType(oGrid.Columns.Item(0), SAPbouiCOM.EditTextColumn)
            Dim oCFL As SAPbouiCOM.ChooseFromList = oCFLs.Add(oCFLCreationParams)            
            oItemCodeCol.ChooseFromListUID = "CFL1"

2.Choose From List Event Hanlder

Private Sub SBO_Application_ItemEvent(ByVal FormUID As String, ByRef pVal As SAPbouiCOM.ItemEvent, ByRef BubbleEvent As Boolean) Handles SBO_Application.ItemEvent
If pVal.EventType = SAPbouiCOM.BoEventTypes.et_CHOOSE_FROM_LIST _
           And pVal.FormTypeEx = "CMC_H" Then
            Dim oCFLEvento As SAPbouiCOM.IChooseFromListEvent
            oCFLEvento = pVal
            
            If oCFLEvento.BeforeAction = False Then
                Dim sCFL_ID As String
                sCFL_ID = oCFLEvento.ChooseFromListUID
                Dim oForm As SAPbouiCOM.Form
                oForm = oApp.Forms.Item(FormUID)
                Dim oCFL As SAPbouiCOM.ChooseFromList
                oCFL = oForm.ChooseFromLists.Item(sCFL_ID)
                Dim oDataTable As SAPbouiCOM.DataTable
                oDataTable = oCFLEvento.SelectedObjects
                Dim val As String = String.Empty
                Try
                    val = oDataTable.GetValue(0, 0)
                Catch ex As Exception

                End Try
                If (pVal.ItemUID = "My_Grid") And pVal.ColUID = "ItemCode" Then
                    Dim oGrid As SAPbouiCOM.Grid = oForm.Items.Item(pVal.ItemUID).Specific
                    oGrid.DataTable.SetValue(pVal.ColUID, pVal.Row, val)
                End If

            End If
        End If
End Sub

Please refer to SDK sample for more about matrix/grid/choose from list. Also search in the forum.

<<C:\Program Files\SAP\SAP Business One SDK\Samples\COM UI\VB.NET\17.ChooseFromList>>

Kind Regards, Yatsea

Former Member
0 Kudos

hi yatsea,

Thanks it solved my problem..

regards,

shangai.

Answers (1)

Answers (1)

YatseaLi
Product and Topic Expert
Product and Topic Expert
0 Kudos

Sample code of matrix collumn with link button and choosefromlist:

// Add a column for BP Card Code
            oColumn = oColumns.Add("DSCardCode", SAPbouiCOM.BoFormItemTypes.it_LINKED_BUTTON);
            oColumn.TitleObject.Caption = "Card Code";
            oColumn.Width = 40;
            oColumn.Editable = true;

            // Link the column to the BP master data system form
            oLink = ((SAPbouiCOM.LinkedButton)(oColumn.ExtendedObject));
            oLink.LinkedObject = SAPbouiCOM.BoLinkedObject.lf_BusinessPartner;

            SAPbouiCOM.ChooseFromListCollection oCFLs = oForm.ChooseFromLists;             
            SAPbouiCOM.ChooseFromListCreationParams oCFLCreationParams;
            oCFLCreationParams = (SAPbouiCOM.ChooseFromListCreationParams)SBO_Application.CreateObject(BoCreatableObjectType.cot_ChooseFromListCreationParams);

            //Adding a choosefromlist for the column
            oCFLCreationParams.MultiSelection = false;
            oCFLCreationParams.ObjectType = "2";
            oCFLCreationParams.UniqueID = "CFL1";

            SAPbouiCOM.ChooseFromList oCFL = oCFLs.Add(oCFLCreationParams);
            SAPbouiCOM.UserDataSource udsCardCode = oForm.DataSources.UserDataSources.Add("UdsCardCd", BoDataType.dt_SHORT_TEXT, 10);
            oColumn.DataBind.SetBound(true, "", "UdsCardCd");
            oColumn.ChooseFromListUID = "CFL1";

Regards, Yatsea