I have serious problem in BOM I created four udf for calculation.
In the first udf in lost focus I written some code for calculation but if not clicking any where if I scroll matrix then lost focus get padding and calculation not done until I click any another column. Please suggest in which event I should write code. My code below.
' this code use to calculation in bill of material
If (pVal.FormType = "672" Or pVal.FormType = "-672") Then ' Bill of Material
Try
If pVal.BeforeAction = False Then
' After changing the item quantity
If (pVal.ItemUID = "3") And (pVal.ColUID = "U_PR") And (pVal.EventType = SAPbouiCOM.BoEventTypes.et_LOST_FOCUS) Then 'And pVal.BeforeAction = False Then
oFormBillofMaterial = SBO_Application.Forms.GetFormByTypeAndCount(pVal.FormType, pVal.FormTypeCount)
PerCalBillOfMat(pVal.Row, oFormBillofMaterial, "Error in U_PR et_LOST_FOCUS sapBillOfMaterial")
ElseIf (pVal.ItemUID = "3") And (pVal.ColUID = "U_PR") And (pVal.EventType = SAPbouiCOM.BoEventTypes.et_KEY_DOWN) Then 'And pVal.BeforeAction = False Then
flagBOM = True
ElseIf (pVal.ItemUID = "3") And (pVal.ColUID = "U_PY") And (pVal.EventType = SAPbouiCOM.BoEventTypes.et_LOST_FOCUS) Then 'And pVal.BeforeAction = False Then
oFormBillofMaterial = SBO_Application.Forms.GetFormByTypeAndCount(pVal.FormType, pVal.FormTypeCount)
PerCalBillOfMat(pVal.Row, oFormBillofMaterial, "Error in U_PY et_LOST_FOCUS sapBillOfMaterial")
ElseIf (pVal.ItemUID = "U_PerRecov") And (pVal.EventType = SAPbouiCOM.BoEventTypes.et_LOST_FOCUS) Then
'this code for UDF event
oFormBillofMaterial = SBO_Application.Forms.GetFormByTypeAndCount(pVal.FormType, pVal.FormTypeCount)
PerCalBillOfMat(pVal.Row, oFormBillofMaterial, "Error in U_PerRecov et_LOST_FOCUS sapBillOfMaterial")
End If 'end of condition
End If 'end pVal.BeforeAction
Catch ex As Exception
MyErrorMsg("Error in FormType Itemevent sapBillOfMaterial" & ex.Message)
End Try
End If ' End of Bill of Material