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: 

Reg the Decimal Values

former_member248447
Participant
0 Kudos
174

Hi all,

I have a requirement where i have to sum up all the local curreincies for a given fiscal years.

so while summing up i am moving the amount to a string varaiable. But if the amount consists of zeros in the decimal places then the decimals are not being replicated in the string variable.

For ex.

loop at itab.

x = x + itab-dmbtr.

endloop.

in the above ex if the total value of x(where x is of type string) is eq 50.00 then i am not able to display the decimals zero in the output. I declared the varaible x as string because the summation value is exceeding the length of the amount feild.

But if my total value of X is say 50.05 or 50.25 i am able to get these decimal places in the output. But if my total summation value contains zeros in the decimal places in the last i am not able to get those,like 50.00 or 50.20 , these are being displayed as 50 and 50.2.

Can anyone suggest..

3 REPLIES 3

Former Member
0 Kudos
107

Hi Rajesh,

Is there any special reason behind taking currency field as string it looks interesting. check this .00 is displaying completely.

DATA: A(7) TYPE P DECIMALS 2 VALUE 1234567.

A = A + '.00'.

WRITE: 'ANSWER', A.

Any issues using the above example revert back.

Cheers!!

Balu

0 Kudos
107

Hi Balu,

I agree with you in the above example if you declare the variable as packed we will get decimals. But for me after doing the calculations the total sum is exceeding the packed varaible length 16 . Which is why i opted for string to hold the summation value in order to show in the output

0 Kudos
107

The issue has been resolved