11-30-2007 12:59 PM
I have curr variable with '-ve' sign. I want it to store it in a variable without
the '-ve' sign.Please reply..Reward assured
11-30-2007 1:07 PM
Hi Dilraj,
Do as below..
if amount < 0
amount = amount * -1.
endif.
FUNCTION Z_CONVERT_NEGATIVE_SIGN.
*"----
""Local interface:
*" IMPORTING
*" VALUE(DMBTR) LIKE VBAK-NETWR
*" VALUE(WAERS) LIKE BSID-WAERS DEFAULT 'NTD'
*" EXPORTING
*" VALUE(ZMBTR) TYPE CHAR16
*"----
IF DMBTR > 0.
WRITE DMBTR TO ZMBTR RIGHT-JUSTIFIED CURRENCY WAERS.
ELSE.
DMBTR = ABS( DMBTR ).
WRITE DMBTR TO ZMBTR RIGHT-JUSTIFIED CURRENCY WAERS.
CONDENSE ZMBTR NO-GAPS.
WRITE ZMBTR TO ZMBTR RIGHT-JUSTIFIED.
ENDIF.
ENDFUNCTION.
11-30-2007 1:02 PM
try like this...
DATA : amount(10) type p decimals 2 value '-125.25'.
amount = amount * -1.
write 😕 amount.
Message was edited by:
Perez C
11-30-2007 1:02 PM
11-30-2007 1:07 PM
Hi Dilraj,
Do as below..
if amount < 0
amount = amount * -1.
endif.
FUNCTION Z_CONVERT_NEGATIVE_SIGN.
*"----
""Local interface:
*" IMPORTING
*" VALUE(DMBTR) LIKE VBAK-NETWR
*" VALUE(WAERS) LIKE BSID-WAERS DEFAULT 'NTD'
*" EXPORTING
*" VALUE(ZMBTR) TYPE CHAR16
*"----
IF DMBTR > 0.
WRITE DMBTR TO ZMBTR RIGHT-JUSTIFIED CURRENCY WAERS.
ELSE.
DMBTR = ABS( DMBTR ).
WRITE DMBTR TO ZMBTR RIGHT-JUSTIFIED CURRENCY WAERS.
CONDENSE ZMBTR NO-GAPS.
WRITE ZMBTR TO ZMBTR RIGHT-JUSTIFIED.
ENDIF.
ENDFUNCTION.