Skip to Content
0
Jun 23, 2006 at 11:07 AM

SAP Crashes in SBO 2005 SP01 P04

23 Views

Hi Everyone

When i'm in a sales order i'm trying to open the window that would be opened when clicking the "copy from" button at the bottom right to copy from a Sales Quote. It must only be done when the Customer selected has open quotes. Obviosuly you must have the Customer code filled in already. It works up until there. Brings up the window.

But as soon as the user selects which quote you get a windows error and then sap closes instantly.

here is my code and the item event.

Private Sub CheckForSalesQuotes(ByVal FormUID As String)

Dim oEdit As SAPbouiCOM.EditText

Dim RS As SAPbobsCOM.Recordset = Nothing

Try

oEdit = SBO_Application.Forms.Item(FormUID).Items.Item("4").Specific

RS = oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset)

RS.DoQuery("SELECT T0.DocNum FROM OQUT T0 WHERE T0.DocStatus ='O' and T0.CardCode = '" & oEdit.Value & "'")

If RS.RecordCount > 0 Then

Dim oCombo As SAPbouiCOM.ComboBox

oCombo = SBO_Application.Forms.GetForm("139", 0).Items.Item("10000330").Specific 'Click(SAPbouiCOM.BoCellClickType.ct_Regular)

oCombo.Select("Sales Quotations", SAPbouiCOM.BoSearchKey.psk_ByValue)

'oCombo.Select(0, SAPbouiCOM.BoSearchKey.psk_Index)

End If

Catch ex As Exception

MsgBox(ex.Message)

End Try

End Sub

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

If pVal.FormType = 139 And pVal.BeforeAction = False Then

If pVal.ItemUID = "4" And pVal.EventType = SAPbouiCOM.BoEventTypes.et_LOST_FOCUS Then

CheckForSalesQuotes(FormUID)

End If

End If

Any ideas would be great.

Thanks in advance