on 11-30-2016 9:12 AM - last edited on 02-03-2024 7:50 PM by postmig_api_4
Dear All,
How To use "Multiple CFL" in Matrix . I tried below code .but it does not work.
The Following Columns are in the Matrix
BP Code,BP Name,Contact Person,Resource Group, Resource Code, Resource Name,Remarks
The Following CFL Columns are
BP Code,BP Name,Contact Person,Resource Group, Resource Code, Resource Name
Fill CFL Selected Record into Matrix - Code for BP Code ,BP Name
Friend Sub DisplayBPDetails(ByVal oForm As SAPbouiCOM.Form, ByVal oMatrixUId As Object, ByVal oDataSource As Object, ByRef pVal As SAPbouiCOM.ItemEvent, ByVal oempId As Object, ByVal oempName As Object, ByVal oempContact As Object, ByVal oColUid As Integer)
Dim oCFLEvento As SAPbouiCOM.IChooseFromListEvent = Nothing
Dim oCFL As SAPbouiCOM.ChooseFromList = Nothing
Dim sCHFL_ID As String = String.Empty
Dim oDataTable As SAPbouiCOM.DataTable = Nothing
Dim oMatrix As SAPbouiCOM.Matrix = Nothing
Dim oDBDataSource As SAPbouiCOM.DBDataSource = Nothing
Dim strCardCode As String = String.Empty
Dim strCardName As String = String.Empty
Dim strContact As String = String.Empty
Try
oCFLEvento = pVal
sCHFL_ID = oCFLEvento.ChooseFromListUID
oCFL = oForm.ChooseFromLists.Item(sCHFL_ID)
'// Get the DBdatasource we base the matrix on
oDBDataSource = oForm.DataSources.DBDataSources.Item(oDataSource)
If pVal.ActionSuccess Then
oDataTable = oCFLEvento.SelectedObjects
If oDataTable Is Nothing Then Exit Sub
If Not oDataTable Is Nothing And pVal.BeforeAction = False Then
oMatrix = oForm.Items.Item(oMatrixUId).Specific
For i As Integer = 0 To oDataTable.Rows.Count - 1
If oDataTable.Rows.Count > 1 Then
strCardCode = Convert.ToString(oDataTable.GetValue("CardCode", i))
strCardName = Convert.ToString(oDataTable.GetValue("CardName", i))
strContact = Convert.ToString(oDataTable.GetValue("CntctPrsn", i))
With oDBDataSource
.InsertRecord(oDBDataSource.Size - 1)
.SetValue(oempId, i, strCardCode)
.SetValue(oempName, i, strCardName)
.SetValue(oempContact, i, strContact)
oMatrix.SetLineData(pVal.Row)
oMatrix.LoadFromDataSource()
'If Not i = oDataTable.Rows.Count - 1 Then
' oMatrix.AddRow()
'End If
End With
ElseIf oDataTable.Rows.Count = 1 Then
strCardCode = oDataTable.GetValue("CardCode", i)
strCardName = Convert.ToString(oDataTable.GetValue("CardName", i))
strContact = Convert.ToString(oDataTable.GetValue("CntctPrsn", i))
With oDBDataSource
.InsertRecord(i)
.SetValue(oempId, oDBDataSource.Offset, strCardCode)
.SetValue(oempName, oDBDataSource.Offset, strCardName)
.SetValue(oempContact, oDBDataSource.Offset, strContact)
oMatrix.SetLineData(pVal.Row)
oMatrix.FlushToDataSource()
Call AddMatrixRow(oForm, oMatrixUId)
End With
End If
oMatrix.Columns.Item(oColUid).Cells.Item(pVal.Row).Click(SAPbouiCOM.BoCellClickType.ct_Regular, 0)
Next
End If
End If
Catch ex As Exception
Finally
oDataTable = Nothing
oDBDataSource = Nothing
End Try
End Sub
Fill CFL Selected Record into Matrix - Code for Resource Group Name
Friend Sub DisplayResGroup(ByVal oForm As SAPbouiCOM.Form, ByVal oMatrixUId As Object, ByVal oDataSource As Object, ByRef pVal As SAPbouiCOM.ItemEvent, ByVal oResType As Object, ByVal oColUid As Integer)
Dim oCFLEvento As SAPbouiCOM.IChooseFromListEvent = Nothing
Dim oCFL As SAPbouiCOM.ChooseFromList = Nothing
Dim sCHFL_ID As String = String.Empty
Dim oDataTable As SAPbouiCOM.DataTable = Nothing
Dim oMatrix As SAPbouiCOM.Matrix = Nothing
Dim oDBDataSource As SAPbouiCOM.DBDataSource = Nothing
Dim strResGroup As String = String.Empty
Try
oCFLEvento = pVal
sCHFL_ID = oCFLEvento.ChooseFromListUID
oCFL = oForm.ChooseFromLists.Item(sCHFL_ID)
'// Get the DBdatasource we base the matrix on
oDBDataSource = oForm.DataSources.DBDataSources.Item(oDataSource)
If pVal.ActionSuccess Then
oDataTable = oCFLEvento.SelectedObjects
If oDataTable Is Nothing Then Exit Sub
If Not oDataTable Is Nothing And pVal.BeforeAction = False Then
oMatrix = oForm.Items.Item(oMatrixUId).Specific
For i As Integer = 0 To oDataTable.Rows.Count - 1
If oDataTable.Rows.Count > 1 Then
With oDBDataSource
strResGroup = Convert.ToString(oDataTable.GetValue("ResGrpNam", i))
.InsertRecord(oDBDataSource.Size - 1)
.SetValue(oResType, i, strResGroup)
oMatrix.SetLineData(pVal.Row)
oMatrix.LoadFromDataSource()
End With
ElseIf oDataTable.Rows.Count = 1 Then
strResGroup = oDataTable.GetValue("ResGrpNam", i)
With oDBDataSource
.InsertRecord(i)
.SetValue(oResType, .Offset, strResGroup)
'oMatrix.LoadFromDataSource()
oMatrix.SetLineData(pVal.Row)
oMatrix.FlushToDataSource()
'Call AddMatrixRow(oForm, oMatrixUId)
End With
End If
oMatrix.Columns.Item(oColUid).Cells.Item(pVal.Row).Click(SAPbouiCOM.BoCellClickType.ct_Regular, 0)
Next
End If
End If
Catch ex As Exception
Finally
End Try
End Sub
Scenarios are given below
Scenario 1 -- Select Multiple BP Code CFL
Scenario 2 -- Select Single BP Code CFL
So please let me know ,How to handle this issue and any common solution ,Please share it.
SetLineData is not required.
Use oMatrix.FlushToDataSource after referencing your matrix in your code.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
105 | |
8 | |
6 | |
6 | |
5 | |
5 | |
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.