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: 

Convert Negative value to Positive value

Former Member
0 Kudos

How to conver the negative sign to Positive sign.

Eg: -2.00 to become 2.00

Please guide me.

Thanks in advance.

6 REPLIES 6

Former Member
0 Kudos

Hi

Use ABS function or multiple it with minus 1

f1 = ABS ( f1 ).

f1 = f1 * -1.

Reward points for useful Answers

Regards

Anji

Former Member
0 Kudos

Hi

declare a variable type n.

Then try assigning the negative value to the variable.

Hope this helps.

Tatvagna

Former Member
0 Kudos

Hi Vamsi.

move the amount to one charater field and use this FM

use this FM CLOI_PUT_SIGN_IN_FRONT

Thanks,'

Reward If helpful.

Former Member
0 Kudos

Hi,

Use <b>ABS</b> Function.

a = ABS( a ).

Regards,

Padmam.

Clemenss
Active Contributor
0 Kudos

Hi vamsi,

simply:

reverse the sign using

value = - value.

remove the sign:

value = abs( value ).

Regards,

Clemens

Former Member
0 Kudos

Hi,

Use ABS function.

Ex.

DATA: T1(10),

T2(10) VALUE '-100'.

T1 = ABS( T2 ).

WRITE T1.

This produces the following output:

100

Two conversions are performed. First, the contents of field T2 (type C) are converted

to type P. Then the system processes the ABS function using the results of the

conversion. Then, during the assignment to the type C field T1, the result of the

function is converted back to type C.

Regards,

Bhaskar