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: 

Zeros after decimal up to 2 places.

0 Kudos
482

I need to display a value up to 2 decimal places. When it comes to values like 0.50 it will display like 0.5 only, but I need 0.50 .

What should I do ?

1 ACCEPTED SOLUTION

j_pavan_kumar
Product and Topic Expert
Product and Topic Expert
347

Hi Pratiksha,

Have the data declaration for the variable as packed with decimals equals to 2.

DATA lv_dec TYPE p DECIMALS 2 .

Thanks,

Pavan

5 REPLIES 5

j_pavan_kumar
Product and Topic Expert
Product and Topic Expert
348

Hi Pratiksha,

Have the data declaration for the variable as packed with decimals equals to 2.

DATA lv_dec TYPE p DECIMALS 2 .

Thanks,

Pavan

FredericGirod
Active Contributor
347

Where do you display this value ? Form, ALV, report, Fiori ?

Sandra_Rossi
Active Contributor
347

Please provide a minimal reproducible example.

This one works:

data value type p length 8 decimals 2.
value = '0.50'.
write value.

raymond_giuseppi
Active Contributor
0 Kudos
347

How is

  • defined the value (type, length, decimals, currency amount, quantity, etc.)
  • displayed the value (write, dynpro, ALV, fiori, html, form, pdf, etc.)

Read The quality of an answer depends significantly on the quality of the question (or: how to ask good q...

neXo
Participant
0 Kudos
347

Hi Pratiksha,

I hope this helps. Define the 'correct' type to 'p' and hopefully it will work. Cheers!!! 🙂

PARAMETERS:
p_num1 TYPE p DECIMALS 2.