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

error while entering values in table.

Hi All,

I have a quantity field in table having data type as dec and length as 13 and decimal places as 5.

But when i enter 255 in table,it automatically changes to .255 but it should be 255.

Thanks and Regards,

Amanpreet Sehgal

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

2 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Apr 29, 2008 at 08:50 AM

    Enter the value as 255.000

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member

      I can try this out but if any other person tests it,he may not know that he has to enter 255.00

      I have a table vbap.I tried to copy the datatype for quantity from this table.But still the same problem exists.Whatever data I enter it takes it in the decimal form.

      If I enter 5555555,it will take it as 5555.555

      Thanks and Regards,

      Aman

  • author's profile photo Former Member
    Former Member
    Posted on Apr 29, 2008 at 09:12 AM

    Hi,

    I tried it as 255.00 but it automatically changed to .255

    Please help me with some other alternative.

    Thanks and Regards,

    Aman

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member

      hi

      check this one

      For calculations in business applications, use packed numbers. The program attribute Fixed point arithmetic affects calculations using packed numbers.

      If the program attribute Fixed point arithmetic is not set, type P fields are interpreted as integers without decimal places. The decimal places that you specify in the DECIMALS addition of the TYPES or DATA statement only affect how the field is formatted in the WRITE statement.

      DATA: PACK TYPE P DECIMALS 2.

      PACK = '12345'.

      WRITE PACK.

      If the program attribute Fixed point arithmetic is not set, the output is as follows:

      123.45

      If the program attribute Fixed point arithmetic is set, the output is as follows:

      12,345.00

      If the Fixed point arithmetic attribute is set, the decimal places are also taken into account in arithmetic operations. Calculations with packed numbers in ABAP use the same arithmetic as a pocket calculator. Intermediate results are calculated using up to 31 digits (before and after the decimal point). You should therefore always set the Fixed point arithmetic attribute when you use type P fields.

      DATA: PACK TYPE P.

      PACK = 1 / 3 * 3.

      WRITE PACK.

      If you have not set the Fixed point arithmetic attribute, the result is 0, since the calculation is performed using integer accuracy, and the result is therefore rounded internally to 0.

      If the program attribute Fixed point arithmetic is set, the result is 1 because the result of the division is stored internally as 0.333333333333333333333333333333 with an accuracy of up to 31 digits.

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.