cancel
Showing results for 
Search instead for 
Did you mean: 

only 1 chance to catch the event (form load)

Former Member
0 Kudos

Hi,

i'm using quiet simple code. After loading the form Production Order i wish to create a new tab on the system form.

But i got 2 problems:

1. when the system reach the code line where it gets the system form with getFormbyTypeandCount (here the last line of the procedure) something happens and the following code won't be read.

2. after getFormbyTypeandCount no event is fired anymore.

Does anybody have an idea whats going wrong?



    Private Sub moSBOApplication_ItemEvent(ByVal FormUID As String, ByRef pVal As SAPbouiCOM.ItemEvent, ByRef BubbleEvent As Boolean) Handles moSBOApplication.ItemEvent

        'Events verarbeiten
        Select Case pVal.EventType

            Case SAPbouiCOM.BoEventTypes.et_FORM_LOAD

                'Montageauftrag
                If pVal.FormType = 65211 And pVal.Before_Action = False Then
                    createTabDepend(pVal)
                End If

        End Select

    End Sub

#Region "design tab 'abhängige Aufträge'"
    Private Sub createTabDepend(ByRef pval As SAPbouiCOM.ItemEvent)
        Dim oRecSet As SAPbobsCOM.Recordset
        Dim oForm As SAPbouiCOM.Form

        Dim oItem As SAPbouiCOM.Item
        Dim oNewItem As SAPbouiCOM.Item
        Dim oBtn As SAPbouiCOM.Button
        Dim oFolder As SAPbouiCOM.Folder
        Dim oText As SAPbouiCOM.StaticText
        Dim oCheck As SAPbouiCOM.CheckBox

        Dim oMatrix As SAPbouiCOM.Matrix
        Dim oColumns As SAPbouiCOM.Columns
        Dim oColumn As SAPbouiCOM.Column

        Dim oDBDataSource As SAPbouiCOM.DBDataSource

        oForm = moSBOCompany.Forms.GetFormByTypeAndCount(pval.FormType, pval.FormTypeCount)

best regards

Markus

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Markus,

Why don't you get the form on the form load event and then pass the form as a parameter to your method?

e.g

Private Sub moSBOApplication_ItemEvent(ByVal FormUID As String, ByRef pVal As SAPbouiCOM.ItemEvent, ByRef BubbleEvent As Boolean) Handles moSBOApplication.ItemEvent
 
        'Events verarbeiten
        Select Case pVal.EventType
 
            Case SAPbouiCOM.BoEventTypes.et_FORM_LOAD
 
                'Montageauftrag
                If pVal.FormType = 65211 And pVal.Before_Action = False Then
 oForm = moSBOCompany.Forms.GetFormByTypeAndCount(pval.FormType, pval.FormTypeCount)

                    createTabDepend(pVal, form)
                End If
 
        End Select
 
    End Sub

Regards, Lita

Answers (1)

Answers (1)

AdKerremans
Active Contributor
0 Kudos

Hi Markus,

why don't you do this

oForm = moSBOCompany.Forms.item(pval.formUID)

this is the best way to uniquely select a form.

Regards

Ad

Former Member
0 Kudos

hi Lita, hi Ad

i already solved the problem. I have to use application instead of company to get the form.

thanks for help

regards

Markus