Skip to Content
author's profile photo Former Member
Former Member

how to assign unique keys to UDF(tried sample but getting error -1120)

hi all

how to assign unique keys through userkeysMD

i am writing the same way as example in sdk. but i am getting Error : -1120. what does this mean. the sample code i wrote is


' A User Fields object

Dim oUserFieldsMD As SAPbobsCOM.UserFieldsMD

Dim oUserKeysMD As SAPbobsCOM.UserKeysMD

''Dim oUserKeys As SAPbobsCOM.UserKeysMDClass

'' Init the user fields object

oUserFieldsMD = oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oUserFields)

oUserKeysMD = oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oUserKeys)

oUserFieldsMD.Name = "emp1_ld"

oUserFieldsMD.Type = SAPbobsCOM.BoFieldTypes.db_Alpha

oUserFieldsMD.Size = 8

oUserKeysMD.Unique = SAPbobsCOM.BoYesNoEnum.tYES

oUserKeysMD.KeyName = "PK_emp_id"

oUserFieldsMD.Description = "Linked Field"

'oUserFieldsMD.LinkedTable = "OHEM"

oUserFieldsMD.TableName = "Employment1"

'oUserFieldsMD.EditSize = 8

''// Adding the Field to the Table

''// Determine whether the key is unique or not

'oUserKeysMD.Unique = SAPbobsCOM.BoYesNoEnum.tYES


lRetCode = oUserFieldsMD.Add

Add a comment
10|10000 characters needed characters exceeded

Related questions

2 Answers

  • Best Answer
    Posted on Aug 31, 2006 at 07:01 AM

    As said on the other thread, this happens becouse you use more than 1 metadata object.

    Have a look at the SBO FAQ for info about creating user fields, user keys, and the "RefCount higher than 0" error.



    Ibai Peñ

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Aug 31, 2006 at 12:46 PM

    Om hi -

    please don't open several threads for the same issue.

    This is only causing confusion. You may want to read

    the rules of engagements published in this forum.

    Thanks for your understanding


    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.