on 01-02-2015 2:55 PM
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
Hi Rahesh,
The error is clearly showing that you are using an invalid Item Unique Id in your code.
You just open your form in Screen Painter then check the particular Item's Unique Id there. Use it as it is on screen painter.
Hope it helps.
Thanks & Regards
Ankit Chauhan
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
101 | |
12 | |
11 | |
6 | |
6 | |
4 | |
3 | |
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.