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

Function For rounding the number field?

Former Member
0 Likes
845

Dear all,

Is there any function module that will round off the decimal place /or round to the 6 significant digit after the decimal place

Please Help!!

Vj

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
756

Hi,

Please checkout following ABAP commands;

<b>CEIL</b> - Smallest integer value that is not less than x

<b>FLOOR</b> - Largest integer value that is not greater than x

See the code below

*&---------------------------------------------------------------------*
DATA: l_low   TYPE bseg-dmbtr VALUE '2.2',
      l_high   TYPE bseg-dmbtr VALUE '2.2',
      l_value_l TYPE bseg-dmbtr,
      l_value_h TYPE bseg-dmbtr.

l_value_l = floor( l_low ).    "result is 2.00
l_value_h = ceil( l_high ).      "result is 3.00
*&---------------------------------------------------------------------*

Let me know if you need any other information.

Regards,

RS

Dear all,

Is there any function module that will round off the decimal place /or round to the 6 significant digit after the decimal place

Please Help!!

Vj

4 REPLIES 4
Read only

RichHeilman
Developer Advocate
Developer Advocate
0 Likes
756
data: p1 type p decimals 7 value '1234.1234567'.
data: p2 type p decimals 6 value.

p2 = p1.

write:/ p2.

Regards,

Rich Heilman

Read only

suresh_datti
Active Contributor
0 Likes
756

use the fm 'ROUND'. you can pass the no. of decimals as a parameter.

~Suresh

Read only

Former Member
0 Likes
756

Hi,

use FM <b>ROUND</b>


 call function 'ROUND'                        
      exporting                               
           decimals      = l_convert_digits   
           input         = l_convert_number   
           sign          = c_cross            
      importing                               
           output        = l_float.           

Regards,

Santosh

Message was edited by:

Santosh Kumar Patha

Read only

Former Member
0 Likes
757

Hi,

Please checkout following ABAP commands;

<b>CEIL</b> - Smallest integer value that is not less than x

<b>FLOOR</b> - Largest integer value that is not greater than x

See the code below

*&---------------------------------------------------------------------*
DATA: l_low   TYPE bseg-dmbtr VALUE '2.2',
      l_high   TYPE bseg-dmbtr VALUE '2.2',
      l_value_l TYPE bseg-dmbtr,
      l_value_h TYPE bseg-dmbtr.

l_value_l = floor( l_low ).    "result is 2.00
l_value_h = ceil( l_high ).      "result is 3.00
*&---------------------------------------------------------------------*

Let me know if you need any other information.

Regards,

RS