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

decimal places

Former Member
0 Likes
536

Hi;

i have a smartform where i have fields with 3 decimal places. Now the SD consultor whants that i take off one decimal place and some fields display 2 decimal places and other fields with no decimal places.

thanks on advance.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
485

Hi,

Declare like this

data: w_decimal TYPE p DECIMALS 2. "for storing dec value up to 2

Pass the value to w_decimal to store with 2 decimal

Thanks,

Krishna...

Hi;

i have a smartform where i have fields with 3 decimal places. Now the SD consultor whants that i take off one decimal place and some fields display 2 decimal places and other fields with no decimal places.

thanks on advance.

3 REPLIES 3
Read only

Former Member
0 Likes
486

Hi,

Declare like this

data: w_decimal TYPE p DECIMALS 2. "for storing dec value up to 2

Pass the value to w_decimal to store with 2 decimal

Thanks,

Krishna...

Read only

MarcinPciak
Active Contributor
0 Likes
485

data:   dec_0 type p,
        dec_2 type p decimals 2,
        dec_3 type p decimals 3.

dec_0 = dec_2 = dec_3.
write: dec_0, dec_2, dec_3.
Read only

Former Member
0 Likes
485

Hi,

You need to use the following statement:

WRITE v_wrbtr TO v_char CURRENCY v_waers.

Here: V_WRBTR stores the amount value (define it as DATA: v_wrbtr TYPE wrbtr),

V_CHAR will store the amount depending on the Currency (define it as DATA: v_char(16) TYPE c),

For ex.: If the currency is USD and Amount is 100, v_char = 100.00

If the currency is JPY and Amount is 100, v_char = 10,000 (JPY has no decimal places)

If the currency is USD and Amount is 100, v_char = 10.000 (TND has 3 decimal places)

So you just need to display the variable 'v_char'.

V_WAERS will store the currency i.e. USD, JPY or TND etc (DATA: v_waers TYPE waers).

Hope it helps.

Thanx & Regards,

Nadim