In SAP the negative sign by default come after the number. In case if you wish to place the negative sign before the number the following function module should be used.
SAP ABAP Function Module to place the sign before a number.
VALUE
Note: This is a changing parameter and accepts the value with Data Type Character.
Find the code below.
SAP ABAP Function Module to place the sign before a number.
CLOI_PUT_SIGN_IN_FRONT
The above mentioned function module has the following parameters.VALUE
Note: This is a changing parameter and accepts the value with Data Type Character.
Find the code below.
REPORT ZEXAMPLE_SIGN .
PARAMETERS : p_num1 TYPE i,
p_num2 TYPE i.
DATA: d_sum TYPE i,
d_value(10).
d_sum = p_num1 + p_num2.
d_value = d_sum.
Write: d_sum.
CALL FUNCTION 'CLOI_PUT_SIGN_IN_FRONT'
CHANGING
VALUE = d_value
.
SKIP.
write:/ d_value RIGHT-JUSTIFIED.
PARAMETERS : p_num1 TYPE i,
p_num2 TYPE i.
DATA: d_sum TYPE i,
d_value(10).
d_sum = p_num1 + p_num2.
d_value = d_sum.
Write: d_sum.
CALL FUNCTION 'CLOI_PUT_SIGN_IN_FRONT'
CHANGING
VALUE = d_value
.
SKIP.
write:/ d_value RIGHT-JUSTIFIED.