cancel
Showing results for 
Search instead for 
Did you mean: 

User Defined Form

Former Member
0 Kudos

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

Accepted Solutions (0)

Answers (1)

Answers (1)

ANKIT_CHAUHAN
Product and Topic Expert
Product and Topic Expert
0 Kudos

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

Former Member
0 Kudos

Hi Ankit,

            Please check the EventLogger Screenshot also.The Unique ID Of the item is correct.But In from load event It throws  an exception .

ANKIT_CHAUHAN
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi Rahesh,

Can you please use this code in Choose_From_List Event on BeforeAction == true ?

Thanks & Regards

Ankit Chauhan