on 10-29-2013 1:23 PM
Hi,
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
Try
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)
Finally
End Try
End If
With Regards
Hi,
if ds1.RecordCount > Then
ds1.MoveFirst()
'put your code here
frm1.Items.Item("vacct").Specific.Value = ds1.Fields.Item("VN").Value
.
.
.
End If
Beni.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
hi.
This is a normal error. It is asking some reference.
First check it in source code..
enable Exception
Control +Alt and press E and enable exception..
you are pasting some values ok
i think here
define form
oForm = SBO_Application.Forms.Item("yourformuid") |
before this code.
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
and
one more thing
where is the form uid in item event
If pVal.ItemUID = "c_vno" and pval.forumuid="yourformuid" And pVal.BeforeAction = True And pVal.FormMode <> SAPbouiCOM.BoFormMode.fm_FIND_MODE Then
if my suggestions not works wait for experts reply..
bye
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
95 | |
11 | |
11 | |
6 | |
6 | |
4 | |
4 | |
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.