Application Development and Automation 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: 
Read only

Convert Negative value to Positive value

Former Member
0 Likes
12,487

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
Read only

Former Member
0 Likes
5,184

Hi

Use ABS function or multiple it with minus 1

f1 = ABS ( f1 ).

f1 = f1 * -1.

Reward points for useful Answers

Regards

Anji

Read only

Former Member
0 Likes
5,184

Hi

declare a variable type n.

Then try assigning the negative value to the variable.

Hope this helps.

Tatvagna

Read only

Former Member
0 Likes
5,184

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.

Read only

Former Member
0 Likes
5,184

Hi,

Use <b>ABS</b> Function.

a = ABS( a ).

Regards,

Padmam.

Read only

Clemenss
Active Contributor
0 Likes
5,184

Hi vamsi,

simply:

reverse the sign using

value = - value.

remove the sign:

value = abs( value ).

Regards,

Clemens

Read only

Former Member
0 Likes
5,184

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