Monday, June 23, 2008

SAP ABAP Negative Sign Before a Number

SAP ABAP Function Module to place negative Sign Before a Number

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.

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 ZEX_SIGN .

Parameter: 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.



No comments:

Post a Comment