06-18-2010 8:29 AM
Dear forumers,
Using the WRITE statement, how may I properly display a currency amount that has a negative value?
In my program, the variable, V_AMOUNT to be displayed is originally of the type "WERTV12".
Using the WRITE statement for this, nothing gets displayed in the screen (blank only).
So, I assigned V_AMOUNT to another variable of the type "P DECIMALS 2", V_AMT.
Using the WRITE statement for this, the amount is displayed in the screen.
But, if the amount has a negative value, the negative sign is not displayed there.
I.e. If V_AMT has the value '500.00-', only '500.00' is displayed in the screen.
Finally, I changed the type of V_AMT as type string.
This works - any amounts with negative sign is displayed in the screen properly.
But, with this approach, I'm unable to "customize" the display of amounts according to currency, like this:-
DATA int TYPE i VALUE 12345678.
WRITE int CURRENCY 'EUR'.
The output of the WRITE statement is "123456,78".
Is there a better way to achieve this?
06-18-2010 4:47 PM
SAP display amounts/quantities as positive numbers with another field that denotes whether positive or negative. You could change the value to a character field and put the negative where you need it (or put an additional field next to the amount with the sign)... but using a character field probably would negate the currency display, too....
07-06-2010 11:16 AM
Currency amounts can be displayed properly after they are assigned to string variables.