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

Former Member
0 Likes
913

hi,

i went thru the forum for this and tried but did not work out..

my requirement is to round off a decimal number to zero decimals. so if the value is 1.3456 it should be 1.00 and if it is 1.8767 then it should be 2.00.

i used the ROUND FM, no help..anything else is can do ?

i am trying to set this rounded number in my dialog screen text element whose data type is set as INIT1.

do i need to change anything ?? pl suggest.

thks

1 ACCEPTED SOLUTION
Read only

naimesh_patel
Active Contributor
0 Likes
870

Just move the content to TYPE I field.

Like:


DATA: P_VAL TYPE P DECIMALS 3 VALUE '1.887',
P_INT TYPE I.

P_INT = P_VAL.
P_VAL = P_INT.

WRITE: P_VAL.

Regards,

Naimesh Patel

4 REPLIES 4
Read only

naimesh_patel
Active Contributor
0 Likes
871

Just move the content to TYPE I field.

Like:


DATA: P_VAL TYPE P DECIMALS 3 VALUE '1.887',
P_INT TYPE I.

P_INT = P_VAL.
P_VAL = P_INT.

WRITE: P_VAL.

Regards,

Naimesh Patel

Read only

narin_nandivada3
Active Contributor
0 Likes
870

Hi,

Check this thread..

Hope this would help you.

Good luck

Narin

Read only

Former Member
0 Likes
870

Hi Friend,

You can use the function module:

J_1I6_ROUND_TO_NEAREST_AMT

CALL FUNCTION 'J_1I6_ROUND_TO_NEAREST_AMT'
EXPORTING I_AMOUNT = V_KWERT u201C Amount to convert*
 
I_AMOUNT1 =
I_AMOUNT2 =
I_AMOUNT3 =
I_AMOUNT4 = ...

Regards,

Chandra Sekhar

Read only

Former Member
0 Likes
870

Hi,

you can do this by declaring one more variable of type INT. and then pass the value with decimal to this type.

for e.g

type_p = 12.224.

type_i = type_p . it will store 12

type_p = type_i.

it will store 12.00.

*Please reward if you find the answer useful.

Thanks,

Kamesh