Application Development and Automation 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: 
Read only

Zeros after decimal up to 2 places.

0 Likes
1,798

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
Read only

j_pavan_kumar
Product and Topic Expert
Product and Topic Expert
1,663

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
Read only

j_pavan_kumar
Product and Topic Expert
Product and Topic Expert
1,664

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

Read only

FredericGirod
Active Contributor
1,663

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

Read only

Sandra_Rossi
Active Contributor
1,663

Please provide a minimal reproducible example.

This one works:

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

RaymondGiuseppi
Active Contributor
0 Likes
1,663

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...

Read only

neXo
Participant
0 Likes
1,663

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.