Dear Edy,
I've tried to remove the Private Sub ProductionOrder_InsertValue to avoid the above error.
So, I am using this following
Public Sub FormDataEvent_Handler_ProductionOrder(ByVal BusinessObjectInfo As SAPbouiCOM.BusinessObjectInfo, ByRef BubbleEvent As Boolean, ByVal SBO_Application As SAPbouiCOM.Application, ByVal oCompany As SAPbobsCOM.Company)
If BusinessObjectInfo.EventType = SAPbouiCOM.BoEventTypes.et_FORM_DATA_LOAD Then
If BusinessObjectInfo.BeforeAction = False Then
DisableEnable(BusinessObjectInfo.FormUID, SBO_Application, oCompany)
End If
End If
If BusinessObjectInfo.EventType = SAPbouiCOM.BoEventTypes.et_FORM_DATA_UPDATE Then
Dim oForm As SAPbouiCOM.Form = SBO_Application.Forms.Item(BusinessObjectInfo.FormUID)
' If BusinessObjectInfo.BeforeAction = False And BusinessObjectInfo.ActionSuccess = True Then
If BusinessObjectInfo.BeforeAction = True Then
Try
If oForm.DataSources.DBDataSources.Item("OWOR").GetValue("U_PRODUCT", 0) = "Y" And oForm.DataSources.DBDataSources.Item("OWOR").GetValue("Status", 0) = "L" Then
Dim oUDFForm As SAPbouiCOM.Form = SBO_Application.Forms.Item(oForm.UDFFormUID)
Dim oRec As SAPbobsCOM.Recordset
Dim ProdDocNum As String = ""
Dim MainProductCode As String = ""
Dim VariantAmount As String = ""
ProdDocNum = oForm.DataSources.DBDataSources.Item("OWOR").GetValue("DocNum", 0)
oRec = CType(oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset), SAPbobsCOM.Recordset)
oRec.DoQuery("select ItemCode from OWOR where DocEntry= '" & ProdDocNum & "'")
MainProductCode = oRec.Fields.Item("ItemCode").Value.ToString
'Get Resource
oRec.DoQuery("exec GetValueResourceActual """ + MainProductCode + """,""" + oProductionOrderDocNum + """")
ActualResource= oRec.Fields.Item("ActualResource").Value.ToString
oUDFForm.Items.Item("U_ActualCap").Specific.String = ActualResource '<---- This Line
End If
Catch ex As Exception
SBO_Application.MessageBox(ex.Message)
End Try
End If
If BusinessObjectInfo.BeforeAction = False And BusinessObjectInfo.ActionSuccess = True Then
Try
If oForm.DataSources.DBDataSources.Item("OWOR").GetValue("U_PRODUCT", 0) = "Y" And oForm.DataSources.DBDataSources.Item("OWOR").GetValue("Status", 0) = "L" Then
Dim oProductionOrderDocEntry As Integer = oForm.DataSources.DBDataSources.Item("OWOR").GetValue("DocEntry", 0)
RunActionProductionOrder(BusinessObjectInfo.FormUID, SBO_Application, oCompany)
End If
Catch ex As Exception
oCompany.EndTransaction(SAPbobsCOM.BoWfTransOpt.wf_RollBack)
SBO_Application.MessageBox(ex.Message)
End Try
End If
End If
End Sub
Pls kindly help to solve this issue. Thank you
Rgds,
Steve