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 point

Former Member
0 Likes
535

hi,

i'm having a record with value 12345.6 This shall be rounded to 12345 and not to 12346 in output.

is there any function module for this.

pls suggest..

thank u

1 ACCEPTED SOLUTION
Read only

matt
Active Contributor
0 Likes
516

There's the ABAP function trunc

DATA: a type p decimals 3,
      b type p decimals 3.

p = '1.123'.
a = trunc( p ).

a will have value '1.000'.

matt

4 REPLIES 4
Read only

matt
Active Contributor
0 Likes
517

There's the ABAP function trunc

DATA: a type p decimals 3,
      b type p decimals 3.

p = '1.123'.
a = trunc( p ).

a will have value '1.000'.

matt

Read only

Former Member
0 Likes
516

thank u for ur reply..

but in output i don't need any decimals again.

can u tel me the solution.

thanks.

Read only

Former Member
0 Likes
516

Hi sunny,

Just change the type of the variable 'a' to integer.

DATA: A TYPE I,
      B TYPE P DECIMALS 3.
B = '1.742'.
A = TRUNC( B ).
WRITE: A.

Regards,

Isaac Melendez

Read only

matt
Active Contributor
0 Likes
516

Yes. What Isaac said.