Hi Experts,
I created a distribution rule udf in the UDO header.
The field name is 'Distribution Rule'.
The UDO form is created using screen painter. I am using SAP B1 9.1
I used this following code but the value from distirbution rule can't be loaded into the field.
Here is my code:
If pVal.ItemUID = "txtDistRule" Then
If pVal.EventType = SAPbouiCOM.BoEventTypes.et_CHOOSE_FROM_LIST Then
Dim oForm As SAPbouiCOM.Form
oForm = oSBOApplication.Forms.Item(FormUID)
Dim oCFLEvento As SAPbouiCOM.IChooseFromListEvent
oCFLEvento = CType(pVal, SAPbouiCOM.ChooseFromListEvent)
Dim sCFL_ID As String
sCFL_ID = oCFLEvento.ChooseFromListUID
Dim oCFL As SAPbouiCOM.ChooseFromList
oCFL = oSBOApplication.Forms.Item(FormUID).ChooseFromLists.Item(sCFL_ID)
Dim distrule As String = ""
Dim disrulename As String = ""
If oCFLEvento.BeforeAction = False Then
Dim oDataTable As SAPbouiCOM.DataTable
oDataTable = oCFLEvento.SelectedObjects
Try
If Not IsNothing(oDataTable) Then
distrule = CType(oDataTable.GetValue("OcrCode", 0), String)
disrulename = CType(oDataTable.GetValue("OcrName", 0), String)
CType(oForm.Items.Item("txtHRemarks").Specific, SAPbouiCOM.EditText).Value = disrulename
End If
Catch ex As Exception
oSBOApplication.MessageBox(ex.Message)
End Try
End If
If distrule <> "" Then
Dim oMatrix As SAPbouiCOM.Matrix
oMatrix = oForm.Items.Item("matrixUDO").Specific
addRowToMatrix(pVal.Row, pVal.BeforeAction, oForm, oMatrix)
End If
End If
End If
Here are the pictures of the failure:
If I type the value in the Distr. Rule, the field popup the list of cost centers window with empty values.
if I left the field empty and press Tab, the choose from list window appears but the selected value is not loaded into the distr, rule field.
Please kindly provide the solution for the issue soon.
Thank you
BRgd,
Steve