Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Two digits after decimal needed to be displayed instead of 3 digits.

Former Member
0 Kudos

Hi,

   In an ALV report, the output shows the delivery quantity as 565.400. instead, I want it to be displayed as 565.40. The concerned field is LFIMG which is a data element of type QUAN. Can anyone please help in this requirement?

The third digit after the decimal point is insignificant. So, I only need two digits. i tried to change the structure used in this, but it didn't work. Any other way out?

Everywhere its given to change the fieldcat value. but i am not using fieldcat manually. So what to do?

Thanks,

Alkananda

1 ACCEPTED SOLUTION

Private_Member_49934
Contributor
0 Kudos

Change the datatype for the field. Make it rerfer to a data element of QUAN type and two decimal places. It will work.

8 REPLIES 8

kesavadas_thekkillath
Active Contributor
0 Kudos

Some questions.

What have you tried before posting ?

What if the values is like 123.456 ? should it remove 6 ?

Is this condition only for a particular currency ?

Private_Member_49934
Contributor
0 Kudos

Change the datatype for the field. Make it rerfer to a data element of QUAN type and two decimal places. It will work.

koolspy_ultimate
Active Contributor

Hi in your internal table declaration just declare it as   type decimals 2 .

or

use

wa_fieldcat-decimals_out  = 2. " use this in your fieldcat.

So that your purpose will be solved.

Regards,

madhumahesh.


former_member200345
Contributor
0 Kudos

Hi,

There is field 'DECIMALS_OUT' in the fieldcat.

Use this field to control the decimals on the ALV outputs.

Regards,

Vijaymadhur.

Former Member
0 Kudos

Hi,

I just changed the data type in the structure used in the program. Now its working fine. But is this a right approach?

Regards,

Alkananda

0 Kudos

Yes.

You can also use the below way also.

in your fieldcat use decimals_out

i.e

wa_fieldcat-decimals_out  = 2. " use this in your fieldcat.

0 Kudos

Hi,

For me the right approach should be the second suggestion of

i.e

wa_fieldcat-decimals_out  = 2. " use this in your fieldcat.

0 Kudos

using 'decimal_out' is the right approach because, it truncate the value only at the time of display. If your have to do some computation on the values, then it will take the actual value in internal table and not the truncated value.