Skip to Content
Former Member
Oct 29, 2013 at 01:23 PM

object reference not set to an instance of an object



I am getting the message "object reference not set to an instance of an object " addon execution.

Below code i have written in ItemEvent, plz check it and let me know the solution.

Case SAPbouiCOM.BoEventTypes.et_LOST_FOCUS

If pVal.ItemUID = "c_vno" And pVal.BeforeAction = True And pVal.FormMode <> SAPbouiCOM.BoFormMode.fm_FIND_MODE Then


Dim ds1 As SAPbobsCOM.Recordset

ds1 = oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset)

ds1.DoQuery("SELECT T0.[U_VACC] as VN, T0.[U_LPAN] as LP, T0.U_TrpExpns as TE, T0.U_TrAcct as TA FROM [dbo].[ABC] T0 where T0.[Name]='" & frm1.Items.Item("c_vno").Specific.Value & "'")

frm1.Items.Item("vacct").Specific.Value = ds1.Fields.Item("VN").Value

frm1.Items.Item("c_lpan").Specific.Value = ds1.Fields.Item("LP").Value

frm1.Items.Item("trpxpns").Specific.Value = ds1.Fields.Item("TE").Value

frm1.Items.Item("tacct").Specific.Value = ds1.Fields.Item("TA").Value

Catch ex As Exception

oApplication.StatusBar.SetText("Item Event(Lost Focuse - 1) Failed" & ex.Message, SAPbouiCOM.BoMessageTime.bmt_Medium, SAPbouiCOM.BoStatusBarMessageType.smt_Warning)


End Try

End If

With Regards