Hi all,
I have a problem which is beating me at the moment, I have an addon I am working on that is causing the following error and causing SAP to crash out completely:
The remote procedure call failed. (Exception from HRESULT: 0x800706BE)
I have isolated the issue down to my SBO_Application_ItemEvent function. I have reduced it down to only the following:
Private Sub SBO_Application_ItemEvent(ByVal FormUID As String, ByRef pVal As SAPbouiCOM.ItemEvent, ByRef BubbleEvent As Boolean) Handles SBO_Application.ItemEvent
Try
If (pVal.EventType <> SAPbouiCOM.BoEventTypes.et_FORM_CLOSE And _
pVal.EventType <> SAPbouiCOM.BoEventTypes.et_FORM_UNLOAD And _
pVal.EventType <> SAPbouiCOM.BoEventTypes.et_FORM_ACTIVATE And _
pVal.EventType <> SAPbouiCOM.BoEventTypes.et_FORM_DEACTIVATE And _
pVal.EventType <> SAPbouiCOM.BoEventTypes.et_LOST_FOCUS And _
pVal.EventType <> SAPbouiCOM.BoEventTypes.et_GOT_FOCUS) Then
Dim EventEnum As SAPbouiCOM.BoEventTypes
EventEnum = pVal.EventType
SBO_Application.MessageBox("An " & EventEnum.ToString & " has been sent by a form with the unique ID: " & FormUID)
End If
Catch ex As Exception
MessageBox.Show("Error Message: " & ex.Message)
End Try
End Sub
As you can see there is nothing flash left in the function but it crashes, however if I use the following code:
Private Sub SBO_Application_ItemEvent(ByVal FormUID As String, ByRef pVal As SAPbouiCOM.ItemEvent, ByRef BubbleEvent As Boolean) Handles SBO_Application.ItemEvent
Try
If (pVal.EventType <> SAPbouiCOM.BoEventTypes.et_FORM_CLOSE And _
pVal.EventType <> SAPbouiCOM.BoEventTypes.et_FORM_UNLOAD And _
pVal.EventType <> SAPbouiCOM.BoEventTypes.et_FORM_ACTIVATE And _
pVal.EventType <> SAPbouiCOM.BoEventTypes.et_FORM_DEACTIVATE And _
pVal.EventType <> SAPbouiCOM.BoEventTypes.et_LOST_FOCUS And _
pVal.EventType <> SAPbouiCOM.BoEventTypes.et_GOT_FOCUS) Then
Dim EventEnum As SAPbouiCOM.BoEventTypes
EventEnum = pVal.EventType
MessageBox.Show("An " & EventEnum.ToString & " has been sent by a form with the unique ID: " & FormUID)
End If
Catch ex As Exception
MessageBox.Show("Error Message: " & ex.Message)
End Try
End Sub
Everything works fine with no errors. It appears that calling the SBO_Application object is what is causing everything to crash totally. I know it should work as I have tried the basic examples and these work fine with the same code, does anyone have any ideas what might be causing me trouble accessing the SBO_Application object?
It works in other events, as I have placed it in the SBO_Application_MenuEvent and SBO_Application_AppEvent and no errors and messsage boxes pop up everywhere they should.
I have tried using the Dlls from the examples that work (though technically they are the same), I have even tried recreating the current project from one of the example ones and copied across my code incase I added something, yet it still crashes SAP.
Any help or ideas on how I might solve this is much appreciated.
Many Thanks,
Matthew
Edited by: Matthew Cooper on Jun 26, 2009 11:06 AM