Dear All,
I had created and Registered a User Defined Form Through Screen Painter and Its working Fine.Now i need to set the ChooseFromList Condition through UI API.I had write the code for same.But When the' UDF Form Load Event' it shows an error message like 'Object Reference is Not set to an instance of object"How can solve the issu. My code is as follows.
Private Sub SBO_Application_ItemEvent(ByVal FormUID As String, ByRef pVal As SAPbouiCOM.ItemEvent, ByRef BubbleEvent As Boolean) Handles SBO_Application.ItemEvent
Dim Txt As SAPbouiCOM.EditText
Dim Itm As SAPbouiCOM.Item
Dim Ocfl As SAPbouiCOM.ChooseFromList
If ((pVal.FormTypeEx = "UDO_FT_KVR_VEHAPPR" And pVal.EventType <> BoEventTypes.et_FORM_UNLOAD)) Then
oForm = SBO_Application.Forms.GetForm(pVal.FormTypeEx, pVal.FormTypeCount)
If pVal.EventType = BoEventTypes.et_FORM_LOAD Then
Dim oCons As SAPbouiCOM.Conditions = Nothing
Dim oCon As SAPbouiCOM.Condition = Nothing
Itm = oForm.Items.Item("17_U_E")
Ocfl = oForm.ChooseFromLists.Item("BPList")
oCons = Ocfl.GetConditions()
oCon = oCons.Add()
oCon.Alias = "CardType"
oCon.Operation = SAPbouiCOM.BoConditionOperation.co_EQUAL
oCon.CondVal = "C"
oCon.Relationship = SAPbouiCOM.BoConditionRelationship.cr_AND
oCon = oCons.Add()
oCon.Alias = "GroupCode"
oCon.Operation = SAPbouiCOM.BoConditionOperation.co_NOT_EQUAL
oCon.CondVal = "138"
oCon.Relationship = SAPbouiCOM.BoConditionRelationship.cr_AND
oCon = oCons.Add()
oCon.Alias = "GroupCode"
oCon.Operation = SAPbouiCOM.BoConditionOperation.co_NOT_EQUAL
oCon.CondVal = "137"
Ocfl.SetConditions(oCons)
End If
End If
End sub
When i run this code i get the following error.
How can i solve this error ,Please Help