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: 

prefix negative sign to a number

Former Member
0 Kudos

hi folks,

how do you prefix the negative sign to the number.

I have the number stored in 'zpayment' and I have to add the negative sign to the before the number.

thanks

Santhosh

1 ACCEPTED SOLUTION

Former Member
0 Kudos

You could:


CONCATENATE '-' zpayment INTO zpayment.
CONDENSE zpayment NO-GAPS.
SHIFT zpayment RIGHT DELETING TRAILING space.

On the other hand, you could do the calculation before moving the amount to zpayment.

Rob

2 REPLIES 2

Former Member
0 Kudos

Hi,

Move the fields to a char type variable and then concatenate - sign before it.

Look at the code :

data : a type i,

b(10) type c.

a = 1 - 100.

b = a.

if a < 0.

concatenate '-' b into b .

condense b no-gaps.

endif.

write : b RIGHT-JUSTIFIED.

regards,

Gagan

Former Member
0 Kudos

You could:


CONCATENATE '-' zpayment INTO zpayment.
CONDENSE zpayment NO-GAPS.
SHIFT zpayment RIGHT DELETING TRAILING space.

On the other hand, you could do the calculation before moving the amount to zpayment.

Rob