cancel
Showing results for 
Search instead for 
Did you mean: 

Bubble Event firing in one company but not another

Former Member
0 Kudos

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

Accepted Solutions (0)

Answers (4)

Answers (4)

former_member201110
Active Contributor
0 Kudos

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

Former Member
0 Kudos

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ñ

Former Member
0 Kudos

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!

Former Member
0 Kudos

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ñ

Former Member
0 Kudos

Hi Ibai,

The actual program doesn't fall over.

It just fails to stop the transaction being processed.

And yes, the U_CarReg is in each company.

All the best,

Dan

Former Member
0 Kudos

Hi Ibia,

I now know what the problem is!

The U_CarReg field is linked to a table in the live company, and not in the test company.

If I un-link, it works!

Is there a way round this? Or is this a bug?

Dan

Former Member
0 Kudos

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!

Former Member
0 Kudos

Just one more thing.

I just tested it in another test company, which is not mentioned in the code at all, and that works too!

Really confused now!

All the best,

Dan