Skip to Content
Jun 18, 2010 at 07:29 AM

Properly displaying currency amounts (negative sign) via WRITE statement


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. 

The output of the WRITE statement is "123456,78".

Is there a better way to achieve this?