Defining number of decimals in DecimalValue data type

Dear All,

Hope you are fine

I have a question about defining the number of decimals.
We have created a field in CustomerQuote.xbo with the type of: decimalValues.

I want to know is there any way that we can define the number of decimals for example to be always 2.

As I found it is not possible,
Does anyone have any idea?

Regards
Sin

Dear All, Hope you are fine I have a question about defining the number of decimals. We have created a field in CustomerQuote.xbo with the type of: decimalValues. I want to know is there any way that we can define the number of decimals for example to be always 2. As I found it is not possible, Does anyone have any idea? Regards Sin

Defining number of decimals in DecimalValue data type

Very Helpfull

User Rating: Be the first one !
Vice Professor Asked on May 23, 2017 in SAP PORTAL.
Add Comment
3 Answer(s)

    Hi Sin,

    You could use :

    [Decimal (5,2)] element dAmt: DecimalValue;

    where 5 is the number of digits allowed and 2 is the number of digits allowed after decimal place.

    Thanks, Pradeep.

    Add Comment

      If you have already set the data type as Quantity, you cannot change it if you have deployed the solution to production.

      You can use the combination of Numeric.RoundToString and Numeric.ParseFromString functions to round off the value stored in the extension field and convert it back to the type quantity during save.

      Add Comment

        Hi Pradeep,

        Thanks a lot for your response and sorry for my late answer, Actually we have a custom field that is a type of “Quantity” and we want the decimal value to be shown max 2 number. But when I add [Decimal (5,2)] to my element, the system gave me an error that

        Parameter ‘[5,2]’ of annotation Decimal is expected to be of type ‘DecimalValue’. But my DataType is Quantity, I can not change it, Do you have any other suggetsion?

        Regards Sin

        Add Comment

        Your Answer

        By posting your answer, you agree to the privacy policy and terms of service.