cancel
Showing results for 
Search instead for 
Did you mean: 

SAP Service layer: Create numeric user-defined field in a user-defined object, cannot set size

former_member547648
Participant
0 Kudos

Hi,

I have an UDO nammed poligono. I try to add a field doing the following:

POST /UserFieldsMD

{
    "Name": "Reparte2",
    "Type": "db_Numeric",
     "Size": 9,
    "Description": "Reparte",
    "SubType": "st_None",
    "TableName": "@Poligono"
}

That gives me the following error:

{
    "error": {
        "code": -5002,
        "message": {
            "lang": "en-us",
            "value": "Field size deviates from legal range [1..11] "
        }
    }
}

So what would be the way to achieve this?

If I remove the line

 "Size": 9,

the error does not occur.

If I use db_Float as a type the parameter size gets accepted, I am not sure why this does not work here.

Accepted Solutions (1)

Accepted Solutions (1)

ANKIT_CHAUHAN
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi NILS STRITZEL,

Ideally, you should use "EditSize" instead of "Size". The following is mentioned in SDK Help File:

Size: The actual size of the field. The value is automatically determined by the input of the EditSize property. Do not set any value in the Size property.

EditSize: Sets or returns the field maximum value entered by the user. This applies only when the Type property is set to db_Alpha or db_Numeric.

Following HTTP request works fine at our side:

POST /b1s/v1/UserFieldsMD

{
    "Name": "TESTNEW",
    "Type": "db_Numeric",
     "EditSize": 9,
    "Description": "Test Numeric",
    "SubType": "st_None",
    "TableName": "@MASTERH"
}

Hope it helps!

Kind regards,

ANKIT CHAUHAN

SAP Business One Support

Answers (0)