on 01-11-2006 9:26 AM
Having spent the past 2 days trying to get the installer working (which it finally does thanks to people on this forum!), I've finally pushed my add-in out to people this morning.
Unfortunately, the bubbleevent seems to be being ignored in all companies bar the test company.
The code is below. The nominal codes do not begin with "720", so that section is not being fired in either company.
So, my question is, why would a bubble event work in one company but not another?
Private Sub oApp_ItemEvent(ByVal FormUID As String, ByRef pVal As SAPbouiCOM.ItemEvent, ByRef BubbleEvent As Boolean) Handles oApp.ItemEvent
Dim NumberRows As Long
Dim oMatrix As SAPbouiCOM.Matrix
Dim oRowCount As Integer
Dim oCheck As SAPbouiCOM.EditText
Dim oCheck2 As SAPbouiCOM.EditText
REM Check for Profit Centre and Project Code on each line of Purchase Transactions
If pVal.FormTypeEx = "142" Or pVal.FormTypeEx = "141" Or pVal.FormTypeEx = "181" Or _
pVal.FormTypeEx = "139" Or pVal.FormTypeEx = "133" Or pVal.FormTypeEx = "179" Then
REM Set to active form and Sales/Purchase transaction matrix
oForm = oApp.Forms.ActiveForm
oItem = oApp.Forms.Item(FormUID).Items.Item("38")
oMatrix = oItem.Specific
If pVal.EventType = SAPbouiCOM.BoEventTypes.et_ITEM_PRESSED And _
pVal.Before_Action Then
If pVal.ItemUID = "1" Then
NumberRows = oMatrix.RowCount
For oRowCount = 1 To NumberRows - 1
oCheck = oMatrix.Columns.Item("30").Cells.Item(oRowCount).Specific
If oCheck.Value = "" Then
oApp.MessageBox("Please enter a Profit Centre on row " & oRowCount)
BubbleEvent = False
End If
oCheck = oMatrix.Columns.Item("31").Cells.Item(oRowCount).Specific
If oCheck.Value = "" Then
oApp.MessageBox("Please enter a Project on row " & oRowCount)
BubbleEvent = False
End If
oCheck = oMatrix.Columns.Item("U_CarReg").Cells.Item(oRowCount).Specific
oCheck2 = oMatrix.Columns.Item("1").Cells.Item(oRowCount).Specific
If oApp.Company.DatabaseName = "FOLLIS_LIVE" Or oApp.Company.DatabaseName = "FOLLUK_TEST" Then
If oCheck.Value = "" And Left(oCheck2.Value, 3) = "720" Then
oApp.MessageBox("Please enter a Car Registration on row " & oRowCount)
BubbleEvent = False
Exit For
End If
End If
Next oRowCount
End If
End If
End If
REM Check for Profit Centre and Project Code on each line of Nominal Transactions
If pVal.FormTypeEx = "392" Or pVal.FormTypeEx = "393" Then
REM Set to active form, journal matrix
oItem = oApp.Forms.Item(FormUID).Items.Item("76")
oMatrix = oItem.Specific
If pVal.EventType = SAPbouiCOM.BoEventTypes.et_ITEM_PRESSED And _
pVal.Before_Action Then
If pVal.ItemUID = "1" Then
NumberRows = oMatrix.RowCount
For oRowCount = 1 To NumberRows - 1
oCheck = oMatrix.Columns.Item("23").Cells.Item(oRowCount).Specific
If oCheck.Value = "" Then
oApp.MessageBox("Please enter a Profit Centre on row " & oRowCount)
BubbleEvent = False
End If
oCheck = oMatrix.Columns.Item("16").Cells.Item(oRowCount).Specific
If oCheck.Value = "" Then
oApp.MessageBox("Please enter a Project on row " & oRowCount)
BubbleEvent = False
End If
Next oRowCount
End If
End If
End If
End Sub
Hi Dan,
I came across a similar problem recently where the a change of BubbleEvent wasn't working for an addon I'd written, even though it was working previously. When I find this type of odd behaviour my first step is always to reboot the machine and delete the SM_OBS_DLL folder in the user's temp folder (normally C:\Document and Settings\[Profile]\Local Settings\Temp on an XP machine).
In my case this solved the problem and BubbleEvent was then working correctly on all companies. The SM_OBS_DLL folder is rebuilt the next time you run SBO on the machine.
Hope this helps,
Owen
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Daniel,
Then the only option I see is that the If statement is true in one database, and false on the others.
If oApp.Company.DatabaseName = "FOLLIS_LIVE" Or oApp.Company.DatabaseName = "FOLLUK_TEST" Then
If oCheck.Value = "" And Left(oCheck2.Value, 3) = "720" Then
oApp.MessageBox("Please enter a Car Registration on row " & oRowCount)
BubbleEvent = False
Exit For
End If
End If
If oCheck.Value = "" Then
oApp.MessageBox("Please enter a Project on row " & oRowCount)
BubbleEvent = False
End If
One of this is should be different on the companies.
Nothing else comes to my mind.
Regards,
Ibai Peñ
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
OK here's the full story!
This is a program which fires on the event "Add" on a purchase transaction.
It works in one company but not another, and is not name related, as I've now copied all the data from the failing one into the successful one, and that now fails too.
I am always logged in as a Superuser.
So, it must be a configuration setup in the live companies that is making the event still fire, but ignore the Bubble Event (i.e. to stop the transaction being submitted).
Help!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Daniel,
First of all I´ll suggest you to use try catch statements, to make it easier.
Second, does the U_CarReg field exist in all the databases? As this is one of the last UDF you get, could be that all is executed ok, then fails in this line, and then bubble event code is not executed.
Hope helps,
Ibai Peñ
I've done some more testing.
This definitely works for one user on the test company, but fails on the live company.
All settings in both companies should be exactly the same. Help!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
99 | |
9 | |
9 | |
5 | |
4 | |
3 | |
3 | |
3 | |
3 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.