on 06-18-2008 10:27 AM
Hi ,
I was trying to use CFL for Matrix but was not able to find how to link a Matrix in a User Defined Form to :
1. I need some examples/code which could help me in linking a Matrix item on a User Defined Form to a CFL (Choose From List)
2. I would also like to know if it is possible to use the Multiselection property of the CFL and choose more than one option from the Choos from List and then Map them to the Matrix.
Hopefully someone can help me out on this one.
Regards
Arshdeep
Hi Arshdeep,
This is an example i'm use to link a CFL to a column of matrix :
oColumn = oColumns.Add("V_10", SAPbouiCOM.BoFormItemTypes.it_EDIT);
oColumn.TitleObject.Caption = "Nom";
oColumn.Width = 60;
oColumn.DataBind.Bind("@IFC_BR", "U_IFC_NOM");
oColumn.ChooseFromListUID = "CFL_2";
oColumn.ChooseFromListAlias = "CardName";
I define before the CFL "CFL_2".
Hope i help you
Michael
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
From System CFL you can receive just one value. For multiple selection of values you have to create user defined cfl.
lg Mahendra
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
ArshDeep,
It is certainly possible to pull multiple values from CFL and map it into matrix of user defined form. A lot of code on your part but am posting what was available with me. hope I have understood the scenario correct.
'This will come with the initialization of form
oMatrix = oform.Items.Item("mt").Specific
oform.DataSources.UserDataSources.Add("Item", SAPbouiCOM.BoDataType.dt_SHORT_TEXT)
oMatrix.Columns.Item("V_1").DataBind.SetBound(True, "", "Item")
AddChooseFromList()
oMatrix.Columns.Item("V_1").ChooseFromListUID = "MyCFL"
oMatrix.Columns.Item("V_1").ChooseFromListAlias = "Itemcode"
oMatrix.AddRow()
now, the AddChooseFromList() procedure. a CFL to pull item from OITM.
Private Sub AddChooseFromList()
Try
Dim oCFLs As SAPbouiCOM.ChooseFromListCollection
Dim oCons As SAPbouiCOM.Conditions
Dim oCon As SAPbouiCOM.Condition
oform = sbo_Application.Forms.Item("cfl")
oCFLs = oform.ChooseFromLists
Dim oCFL As SAPbouiCOM.ChooseFromList
Dim oCFLCreationParams As SAPbouiCOM.ChooseFromListCreationParams
oCFLCreationParams = sbo_Application.CreateObject(SAPbouiCOM.BoCreatableObjectType.cot_ChooseFromListCreationParams)
oCFLCreationParams.MultiSelection = True
oCFLCreationParams.UniqueID = "MyCFL"
oCFLCreationParams.ObjectType = "4"
oCFL = oCFLs.Add(oCFLCreationParams)
oCons = oCFL.GetConditions()
oCon = oCons.Add()
oCon.Alias = "sellitem"
oCon.Operation = SAPbouiCOM.BoConditionOperation.co_EQUAL
oCon.CondVal = "Y"
oCFL.SetConditions(oCons)
oCFLCreationParams.UniqueID = "CFL2"
oCFL = oCFLs.Add(oCFLCreationParams)
Catch
MsgBox(Err.Description)
End Try
End Sub
and the ChooseFromList event:
If pVal.EventType = SAPbouiCOM.BoEventTypes.et_CHOOSE_FROM_LIST Then
If pVal.FormUID = "cfl" And pVal.ItemUID = "mt" Then
Try
Dim i As Integer
Dim oCFLEvento As SAPbouiCOM.IChooseFromListEvent
oCFLEvento = pVal
Dim sCFL_ID As String
sCFL_ID = oCFLEvento.ChooseFromListUID
Dim oForm As SAPbouiCOM.Form
oForm = sbo_Application.Forms.Item(FormUID)
Dim oCFL As SAPbouiCOM.ChooseFromList
oCFL = oForm.ChooseFromLists.Item(sCFL_ID)
If oCFLEvento.BeforeAction = False Then
Dim oDataTable As SAPbouiCOM.DataTable
oDataTable = oCFLEvento.SelectedObjects
If oDataTable Is Nothing Then
Exit Sub
End If
oMatrix = oform.Items.Item("mt").Specific
If pVal.ItemUID = "mt" And pVal.ColUID = "V_1" Then
For i = 0 To oDataTable.Rows.Count - 1
oForm.DataSources.UserDataSources.Item("Item").ValueEx = oDataTable.GetValue(0, i)
oMatrix.SetLineData(pVal.Row)
If Not i = oDataTable.Rows.Count - 1 Then
oMatrix.AddRow()
End If
Next
End If
End If
Catch ex As Exception
MsgBox(ex.Message)
End Try
End If
End If
hope it is what you want.
Binita
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
95 | |
11 | |
11 | |
6 | |
6 | |
4 | |
3 | |
3 | |
3 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.