Skip to Content
avatar image
Former Member

User Defined Form

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

Error.jpg (247.3 kB)
EventLogger.jpg (138.8 kB)
Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

1 Answer

  • Jan 03, 2015 at 04:44 AM

    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

    Add comment
    10|10000 characters needed characters exceeded