📚 SAP Business One SDK Help

AppEvent Event
See Also  Example
EventType
The type of application event

Description

Occurs when one of the following changes takes place in the SAP Business One application:

  • Application shutdown
  • Company database was changed
  • Interface language was changed
  • UI server shutdown

Syntax

Visual Basic
Public Event AppEvent( _
   ByVal EventType As BoAppEventTypes _
)

Parameters

EventType
ValueDescription
aet_ShutDownThe SAP Business One application shuts down.

Catch this event to terminate your add-on when the application is closed.

aet_CompanyChangedA new company database is selected.

Catch this event when you want to check what company was selected, especially in cases there your add-on is designed for a specific company.

aet_LanguageChangedThe user interface language is changed.

Catch this event to make sure the language of the add-on corresponds to the language of the application. After the user interface language is changed, actions made on the menu are deleted because the menu is reloaded from the resource file. We recommend refreshing menu actions every time this event occurs.

aet_FontChangedThe font of the user interface is changed.
The type of application event

Example

Catching application events (Visual Basic)Copy Code
Private Sub SBO_Application_AppEvent(ByVal EventType As SAPbouiCOM.BoAppEventTypes)

'//********************************************************************************
'// the following are the events sent by the application
'// in order to implement your own code upon each of the events
'// place you code instead of the matching message box statement
'//********************************************************************************
    Select Case EventType

        Case aet_ShutDown:

            SBO_Application.MessageBox "A Shut Down Event has been caught" _
                & vbNewLine & "Terminating Add On..."

            '//**************************************************************
            '//
            '// Take care of terminating your AddOn application
            '//
            '//**************************************************************

            End

        Case aet_CompanyChanged:

            SBO_Application.MessageBox "A Company Change Event has been caught"

            '//**************************************************************
            '// Check the new company name, if your add on was not meant for
            '// the new company terminate your AddOn
            '// If SBO_Application.Company.Name Is Not "Company1" then
            '// Close
            '// End If
            '//**************************************************************

        Case aet_LanguageChanged:

            SBO_Application.MessageBox "A Languge Change Event has been caught"

            '//**************************************************************
            '// Check the new language name, if your AddOn's items needs
            '// to be changed, take care of it at this point
            '//
            '// Select Case SBO_Application.Language
            '// Case ln_English:
            '// Case ln_French:
            '// Case ln_German:
            '// End Select
            '//**************************************************************

    End Select

End Sub

See Also