Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

-ive sign with variable.

I have curr variable with '-ve' sign. I want it to store it in a variable without

the '-ve' sign.Please reply..Reward assured

Tags:
Former Member
Former Member replied

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.

0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question