Skip to Content
0
Former Member
Jan 11, 2006 at 03:51 AM

VB Crashes when accessing any UDF thru DIAPI

28 Views

I'm using 2005A, PL05 (6.80.123)

Whenever I access any property of a User Defined object, VB crashes (no jokes, please ;-). It can be somthing as simple as this:

Dim sboCompany As SAPbobsCOM.Company
' connect to SBO...

Dim sboPoHead As SAPbobsCOM.Documents
Set sboPoHead = sboCompany.GetBusinessObject(oPurchaseOrders)
sboPoHead.GetByKey(poNum)

Dim sboUf As SAPbobsCOM.UserFields 
Set sboUf = sboPoHead.UserFields

Dim sboField As SAPbobsCOM.Field
       
For Each sboField In sboUf.Fields
    Debug.Print sboField.Name
    Debug.Print sboField.Description
Next sboField

You get the idea: connect to SBO; get a PO; get its UDFs; look at them one by one.

That first "Debug" line, where I'm trying to print the Name property of the first UDF object, that's where VB bites it. Full blown "do you want to send an error report" and close the app crash. It happens when I try to do this too:

sboPoHead.UserFields.Fields(0).Name

I just wanted to see exactly where the error occurred.

Anyone seen this? Is it fixed in PL06? I'm I doing something grossly stupid?