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

generate_userfields

i will generate a userfield with values

but the program does not running,

because i get a error - 5002 when i use

ValidValuesMD.

what is wrong on my source code?

best regards

ingo

Public Function generate_userfields()

Dim UFld As SAPbobsCOM.UserFieldsMD

Dim VVFld As SAPbobsCOM.ValidValuesMD

Dim RetVal As Long

Dim ErrCode As Long

Dim ErrMsg As String

Set UFld = vCompany.GetBusinessObject(oUserFields)

UFld.TableName = “OITM”

UFld.Name = "test"

UFld.Description = "test”

UFld.Type = db_Alpha

UFld.Size = 10

RetVal = UFld.Add

The result was 0 in the error routine

Set VVFld = UFld.ValidValues

VVFld.Description = "test"

VVFld.Value = 1

VVFld.Add

The result was –5002 in the error routine

End Function

Add a comment
10|10000 characters needed characters exceeded

Related questions

1 Answer

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Jun 01, 2004 at 02:16 PM

    The description for error -5002 is "Default value is not valid for this field."

    If you are setting a list of valid values, you must specify a default value. Add the following to your code:-

    UFld.DefaultValue = 1

    Regards,

    John.

    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.