‎2006 Jul 25 11:47 AM
Hi Experts,
I have a curr variable with '-ve' sign. I want it to store it in a variable without the '-ve' sign.
Any suggestions?
‎2006 Jul 25 11:48 AM
Hello,
if amount < 0
amount = amount * -1.
endif.
Regards,
Naimesh
‎2006 Jul 25 11:50 AM
See the code..
Cheers,
Thomas.
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.
‎2006 Jul 25 11:52 AM
u can do it in this way:
first find the length of that field value ,let it be <len.
now do
fld = fld + 2( len-1 ).