Showing results for 
Search instead for 
Did you mean: 

Error while adding user fields to user table using vb6.0

Former Member
0 Kudos


I am adding a user tables using vb6.0 using DIAPI.

I am able to add the user table successfully.

I am getting the following error when i am adding the fields to the table.

"The metadata object for this object cannot be updated, since it's ref count is bigger than 0."

My code is as follows:

oUserFieldsMD.TableName = TABLE_NAME_ITEM_LOCN

oUserFieldsMD.Name = vTableFields(0, lCount)

oUserFieldsMD.Description = vTableFields(1, lCount)

oUserFieldsMD.Type = vTableFields(2, lCount)

oUserFieldsMD.EditSize = CLng(vTableFields(3,lCount))

lRetCode = oUserFieldsMD.Add

This error does not come up when i try to add the field to my table using the vb sample provided by SAP.

Your help will me much appreciated.


View Entire Topic
Active Contributor
0 Kudos

Hi Satish,

The problem is that you added the table and the objetc that you used to add the table is not freed properly. You need to free the object and then the reference count to that table will be 0 - which will enable you to add the fields



Dim pUTables As SAPbobsCOM.UserTablesMD

'Do your stuff

Set pUTables = Nothing

Dim pUFields As SAPbobsCOM.UserFieldsMD

'Do your stuff

Set pUFields = Nothing