Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Properly displaying currency amounts (negative sign) via WRITE statement

former_member367551
Participant
0 Kudos

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?

2 REPLIES 2

Former Member
0 Kudos

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

former_member367551
Participant
0 Kudos

Currency amounts can be displayed properly after they are assigned to string variables.