How to round off decimal places?
I am in a situation where i need to pass a currency field value Type P decimals 8 to
a variable of type c length 12.
As I have to write the output on application server.
Value to be converted of Type P decimals 8 i.e. 5678.65800341
Value Required in Chararcter 12 with decimals 2 i.e. (9.2) total 12 characters. required value 5678.65 or 5678.66
Will reward points to correct answers.
Check this sample:
DATA: WA_INPUT TYPE P DECIMALS 8,
WA_OUTPUT TYPE P DECIMALS 2.
WA_INPUT = '5678.65800341'.
CALL FUNCTION 'ROUND'
INPUT = WA_INPUT
OUTPUT = WA_OUTPUT
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.