cancel
Showing results for 
Search instead for 
Did you mean: 

CFL for matrix

Former Member
0 Kudos

I have loaded data in the matrix.The cells in the matrix are editable.I want to set cfl for the column item in the matrix.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

try it as

oItem = oForm.Items.Add("EditTxt", SAPbouiCOM.BoFormItemTypes.it_EDIT)

oItem.Left = 120

oItem.Top = 10

oItem.LinkTo = "StaticTxt"

oEdit = oItem.Specific

oEdit.DataBind.SetBound(True, "", "EditDS")

oEdit.ChooseFromListUID = "CFL1"

oEdit.ChooseFromListAlias = "CardCode"

and before create CFL as

Dim oCFLs As SAPbouiCOM.ChooseFromListCollection

Dim oCons As SAPbouiCOM.Conditions

Dim oCon As SAPbouiCOM.Condition

oCFLs = oForm.ChooseFromLists

Dim oCFL As SAPbouiCOM.ChooseFromList

Dim oCFLCreationParams As SAPbouiCOM.ChooseFromListCreationParams

oCFLCreationParams = SBO_Application.CreateObject(SAPbouiCOM.BoCreatableObjectType.cot_ChooseFromListCreationParams)

oCFLCreationParams.MultiSelection = False

oCFLCreationParams.ObjectType = "2"

oCFLCreationParams.UniqueID = "CFL1"

oCFL = oCFLs.Add(oCFLCreationParams)

oCons = oCFL.GetConditions()

oCon = oCons.Add()

oCon.Alias = "CardType"

oCon.Operation = SAPbouiCOM.BoConditionOperation.co_EQUAL

oCon.CondVal = "S"

oCFL.SetConditions(oCons)

hope it helps

Petr

Former Member
0 Kudos

The above code that u have given is for textbox.I have created a matrix and I want cfl for the column itemcode in the matrix.

Nussi
Active Contributor
0 Kudos

well - i think that you only need to change the perfect code from petr a bit

don't create a edittext, just try something like this

oEdit = oForm.Items.item("mtxUID").Specific.Columns.item("ColUID").specific

oEdit.DataBind.SetBound(True, "", "EditDS")

oEdit.ChooseFromListUID = "CFL1"

oEdit.ChooseFromListAlias = "CardCode"

petr? what do you think ?

David

Former Member
0 Kudos

David is true, this is working for textbox and columns in matrix as well. You only need to change the oEdit for properly item. The code was example for idea how to do it Change it as David wrote and it should work.

Petr

Former Member
0 Kudos

Petr and David,

The above code did not worked.

oForm.Items.item("mtxUID").Specific.Columns.item("ColUID").specific

The object could not be accessed after the word Specfic which is in bold.It gives me as,

oForm.Items.item("mtxUID").Specific.GetType()

In the above code, u have set cfl for each and every column.The columns in my matrix are as ,

objColumn = objColumns.Add("U_Entry_No", SAPbouiCOM.BoFormItemTypes.it_EDIT)

objColumn.TitleObject.Caption = "U_Entry_No"

objColumn.Width = 30

objColumn.Editable = True

I need to create object as per the columns.

Former Member
0 Kudos

For the above code I have tried a alternative code as,

Dim matQA As SAPbouiCOM.Matrix

Dim objColumns As SAPbouiCOM.Columns

Dim objColumn As SAPbouiCOM.Column

matQA = SBO_Application.Forms.ActiveForm.Items.Item("matQA").Specific

objColumns = matQA.Columns

objColumn = objColumns.Item(3)

SBO_Application.Forms.ActiveForm.DataSources.UserDataSources.Add("DSMatrix", SAPbouiCOM.BoDataType.dt_SHORT_TEXT)

objColumn.DataBind.SetBound(True, "", "DSMatrix")

For this code it gave error as

Matrix Line exits

Former Member
0 Kudos

Before databind try matQA.Clear().

Petr

Former Member
0 Kudos

Petr,

I am able to load the list of items.But the selected item is not getting set to the cell of matrix.I have used the code as,

oForm.DataSources.UserDataSources.Item("DSMatrix").ValueEx = val

This code is used in the choose from list and is similiar to the textboxes.

Former Member
0 Kudos

If I undestand correctly, you have CFL already but after select some record from cfl the value is`nt filled to matrix cell?

Provide code you have, I`ll look at it.

Former Member
0 Kudos

Private Sub AddChooseFromListForMatrix()

Try

Dim oCFLs As SAPbouiCOM.ChooseFromListCollection

Dim oCons As SAPbouiCOM.Conditions

Dim oCon As SAPbouiCOM.Condition

oCFLs = SBO_Application.Forms.ActiveForm.ChooseFromLists

Dim oCFL As SAPbouiCOM.ChooseFromList

Dim oCFLCreationParams As SAPbouiCOM.ChooseFromListCreationParams

oCFLCreationParams = SBO_Application.CreateObject(SAPbouiCOM.BoCreatableObjectType.cot_ChooseFromListCreationParams)

' Adding 2 CFL, one for the button and one for the edit text.

oCFLCreationParams.MultiSelection = False

oCFLCreationParams.ObjectType = "4"

oCFLCreationParams.UniqueID = "CFL7"

oCFL = oCFLs.Add(oCFLCreationParams)

Catch ex As Exception

' app.MessageBox(ex.Message)

End Try

End Sub

After calling the function AddChooseFromListForMatrix() I have executed the following code-

Dim matQA As SAPbouiCOM.Matrix

Dim objCol As SAPbouiCOM.Columns

matQA = SBO_Application.Forms.Item("Quality Analysis").Items.Item("matQA").Specific

Dim objColumns As SAPbouiCOM.Columns

Dim objColumn As SAPbouiCOM.Column

Dim strCol As String

objColumns = matQA.Columns

objColumn = objColumns.Item(3)

objColumn.Editable = True

SBO_Application.Forms.ActiveForm.DataSources.UserDataSources.Add("DSMatrix", SAPbouiCOM.BoDataType.dt_SHORT_TEXT)

objColumn.DataBind.SetBound(True, "", "DSMatrix")

objColumn.ChooseFromListUID = "CFL7"

objColumn.ChooseFromListAlias = "ItemCode"

In the SBO_Application_ItemEvent for et_CHOOSE_FROM_LIST event I have used the following code-

If (pVal.ItemUID = "matQA") And pVal.FormUID = "Quality Analysis" Then

oForm.DataSources.UserDataSources.Item("DSMatrix").ValueEx = val

End If

In this code,I have first created matrix then I have created cfl and then loaded data in the matrix.

Former Member
0 Kudos

Into the event for choose from list add

Dim edt As SAPbouiCOM.EditText

edt = matQA.Columns.Item(3).Cells.Item(pVal.Row).Specific

edt.String = val

you set the value to datatable but not to matrix cell.

Former Member
0 Kudos

Petr,

I have solved the problem.I modified the datasource from which the matrix is loaded.Then I reloaded the matrix.The code is as,

SBO_Application.Forms.Item("Quality Analysis").DataSources.DataTables.Item("MyDataTable").SetValue("U_Item_Code", pVal.Row - 1, val)

LoadMatrix()

Thanks for spending u r valuable time in solving the problem.

Regards,

Dilip Kumbhar

Answers (0)