‎2008 Mar 09 9:22 AM
what is the predefind function module for round of the dispalyed valu (for ex NETWER value 12.34, but we want 12.00) ?
‎2008 Mar 09 9:41 AM
Hi,
Use ceil function
data: netwer type p decimals 2.
netwer = ceil(12.34).
write:/ netwer.
Regards
‎2008 Mar 09 9:41 AM
Hi,
Use ceil function
data: netwer type p decimals 2.
netwer = ceil(12.34).
write:/ netwer.
Regards
‎2008 Mar 09 4:52 PM
Hi,
Use ROUND FM to achieve this ...
data : orig_amt type p decimals 10 value '0.29846',
round_amt type p decimals 4.
call function 'ROUND'
exporting
decimals = 4
input = orig_amt
sign = '-'
importing
output = round_amt
exceptions
input_invalid = 1
overflow = 2
type_invalid = 3
others = 4.
write : round_am.
Hope thhis helps u,
Regards,
Arunsri
‎2008 Mar 10 5:05 AM
‎2008 Mar 10 7:00 AM
A number of rounding FMs with worked exmaples are in the book "common sap r/3 functions manual". Here are three witht he explanation it gives for the parameters. I think ROUND will work for you.
(1) HR_ROUND_NUMBER
(2) ROUND:
Parameters:
EXPORTING
DECIMALS Number of decimals places in output
INPUT Input quantity
SIGN Rounding type:
Value Meaning
examples
+ Round up (10.55 => 10.60)
- Round down (10.55 => 10.50)
X Commercial (10.55 => 10.60)
' ' No rounding (10.55 => 10.55)
(3) ROUND_AMOUNT:
Parameters:
EXPORTING
AMOUNT_IN Amount to be rounded
COMPANY Company code
CURRENCY Currency code
IMPORTING
AMOUNT_OUT Amount after rounding
DIFFERENCE Difference between Amount In and Amount Out
NO_ROUNDING Flag: no rounding setup for this company code and currency
ROUNDING_UNIT Unit to round up to
Do reward if helpful
‎2008 Mar 10 9:28 AM
Hi,
Use CEIL keyword to get upper round figure, and use FLOOR keyword to get lower roud figure.
Ex: x = 12.34
CEIL(x) = 13.00.
FLOOR ( x) = 12.00.
Regards,
kavitha.
‎2008 Mar 10 10:30 AM
Hi,
Use this code
fraction = FRAC( amount ) .
IF fraction GE '0.50' .
amount = CEIL( amount ) .
else .
amount = floor( amount ).
ENDIF .
t_output-pswbt_hec = amount .
O/p : if 1.3 it gives 1
if 1.7 it gives 2
regards,
Kannnan
‎2008 Mar 14 4:58 AM
Hi,
u can use the FM "Round" to round the value to specfic decimal places . u can make round up, round down or commercial round.
Please find below a sample code for that.
DATA: VALUE TYPE F,
ROUND_VALUE TYPE F.
...
CALL FUNCTION 'ROUND'
EXPORTING
DECIMALS = 2-
INPUT = VALUE
SIGN = '+'
IMPORTING
OUTPUT = ROUND_VALUE
EXCEPTIONS
INPUT_INVALD = 01
OVERFLOW = 02
TYPE_INVALID = 03.
when the SIGN = SPACE there is no rounding which means OUTPUT= INPUT .
please reward points if useful.
regards
sandhya