‎2006 Dec 18 8:42 AM
Hi,
I need to round of a value to the next number.My formula is
v_value = im_ekpo-menge/v_umrez.
v_value..i need to round off to next number. I tried using ROUND function in an enhancement. But doesn';t work .Getting msg as ROUND is unknow,protected or private
Pls help
Thanks
Ram
‎2006 Dec 18 8:50 AM
Hi ,,
Since you want the next number if there is a remainder , the use the mod function to determine if there is a remainder , if there is a remainder then add 1 to the result.
the code will look like this
Data : test type i.
v_value = im_ekpo-menge/v_umrez.
test = im_ekpo-menge mod v_umrez.
if test ne 0.
v_value = v_value + 1.
endif.
Regards
Arun
‎2006 Dec 18 8:44 AM
Hi,
use abap command write ... round:
DATA X TYPE P DECIMALS 2 VALUE '12493.97'.
WRITE: / X ROUND -2, "Ausgabe: 1.249.397,00
/ X ROUND 0, "Ausgabe: 12.493,97
/ X ROUND 2, "Ausgabe: 124,94
/ X ROUND 5. "Ausgabe: 0,12
A.
‎2015 Mar 24 11:12 AM
i want to round up total amount of invoice
from smartform where i need to write code
and what is the syntax of round statement
‎2006 Dec 18 8:48 AM
hi,
please refer this code :
DATA:
L_MENGE_P5(16) TYPE P DECIMALS 5,
L_MENGE_P3(16) TYPE P DECIMALS 3,
L_ANDEC like T006-ANDEC value 0.
L_MENGE_P5 = '56.4456'.
CALL FUNCTION 'ROUND'
EXPORTING
DECIMALS = L_ANDEC
input = L_MENGE_P5 "over here u need to pass other than char
SIGN = '+'
IMPORTING
OUTPUT = L_MENGE_P3
EXCEPTIONS
INPUT_INVALID = 1
OVERFLOW = 2
TYPE_INVALID = 3
OTHERS = 4
.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
WRITE:/ L_MENGE_P3.
‎2006 Dec 18 8:50 AM
‎2006 Dec 18 8:50 AM
Hi ,,
Since you want the next number if there is a remainder , the use the mod function to determine if there is a remainder , if there is a remainder then add 1 to the result.
the code will look like this
Data : test type i.
v_value = im_ekpo-menge/v_umrez.
test = im_ekpo-menge mod v_umrez.
if test ne 0.
v_value = v_value + 1.
endif.
Regards
Arun
‎2006 Dec 18 8:53 AM
Hello Prabha,
Declare v_value as TYPE i which will round it to the next number.