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.

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.

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.

## Add a comment