Skip to Content
0
Former Member
Feb 03, 2004 at 01:03 PM

SBO_sp_TransactionNotification problems....

44 Views

Using the VB example provided with this Stored procedure:

________________________________________________________________________________

Public Function DisplaySBOInfo(ObjectType As Variant, TransactionType As String, _

NumOfColsInKey As Variant, ListOfKeyColsTabDel As String, ListOfColsValTabDel As String) _

As String

On Error GoTo ErrorHandler

Dim sSBOInfo As String

sSBOInfo = "Object Type: " & CStr(ObjectType) & vbTab

sSBOInfo = sSBOInfo & "Transaction Type: " & TransactionType & vbTab

sSBOInfo = sSBOInfo & "Number of Columns in Key: " & CStr(NumOfColsInKey) & vbTab

sSBOInfo = sSBOInfo & "List of Columns: " & ListOfKeyColsTabDel & vbTab

sSBOInfo = sSBOInfo & "Values: " & ListOfColsValTabDel & vbCrLf

WriteToFile (sSBOInfo)

DisplaySBOInfo = sSBOInfo 'return value

ErrorHandler:

sSBOInfo = Err.Description

DisplaySBOInfo = Err.Description

End Function

Private Sub WriteToFile(InfoString)

Dim fso As New FileSystemObject

Dim ts As TextStream

Set ts = fso.OpenTextFile(App.Path & "Log.txt", ForAppending, True)

ts.Write InfoString

ts.Close

Set fso = Nothing

End Sub

_______________________________________________________________________________

The log file is create and the transaction is logged in fine.

The problem is this;

As soon as I call the SAP BO SDK from the dll and retrieve information of say (a business partner update) SAP freezes completely as if the is an infinite loop.

Yet I have no loops in my code.

Here is my code that freezes SAP :

______________________________________________________________________________

Public Function DisplaySBOInfo(ObjectType As Variant, TransactionType As String, _

NumOfColsInKey As Variant, ListOfKeyColsTabDel As String, ListOfColsValTabDel As String) _

As String

On Error GoTo ErrorHandler

Dim oCompany As SAPbobsCOM.Company

Set oCompany = New SAPbobsCOM.Company

Dim BusinessPartners As SAPbobsCOM.BusinessPartners

Dim oRecordSet As SAPbobsCOM.Recordset

oCompany.Server = "SQL_Server"

oCompany.DbPassword = "PassWord"

oCompany.DbUserName = "Admin"

oCompany.CompanyDB = "SBODemo_US"

oCompany.UserName = "manager"

oCompany.Password = "manager"

oCompany.UseTrusted = False

oCompany.Connect

If oCompany.Connected Then

'Getting a new BusinessPartners object

Set BusinessPartners = oCompany.GetBusinessObject(oBusinessPartners)

'// Getting a new Recoset object

Set oRecordSet = oCompany.GetBusinessObject(BoRecordset)

oRecordSet.DoQuery ("Select cardcode from ocrd where cardcode = '" & ListOfColsValTabDel & "'")

'// asigning (linking) the Recordset object

'// to the Browser.Recordset property

BusinessPartners.Browser.Recordset = oRecordSet

Dim sSBOInfo As String

sSBOInfo = "Businesspartner name: " & BusinessPartners.CardName

WriteToFile (sSBOInfo)

DisplaySBOInfo = sSBOInfo 'return value

Else

sSBOInfo = "Not connected"

WriteToFile (sSBOInfo)

DisplaySBOInfo = sSBOInfo 'return value

End If

oCompany.Disconnect

'BusinessPartners.Close

Set oCompany = Nothing

Set oRecordSet = Nothing

Set BusinessPartners = Nothing

ErrorHandler:

sSBOInfo = Err.Description

DisplaySBOInfo = Err.Description

End Sub

Private Sub WriteToFile(InfoString)

Dim fso As New FileSystemObject

Dim ts As TextStream

Set ts = fso.OpenTextFile(App.Path & "Log.txt", ForAppending, True)

ts.Write InfoString

ts.Close

End Sub

________________________________________________________________________________

I think by retrieving information from the SDK it might be triggering something that calls SBO_sp_TransactionNotification and calls my dll. Which would cause an infinite loop?

I?m completely at a loss for ideas?

Denis