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

Simple Query

Former Member
0 Likes
573

hi all

I had a requirement to convert -ve value to +ve and +ve to -ve is there any Fm to achieve this.

eg 4.6 to -4.6

or -4.6 to 4.6

Regards

Hitesh

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
554

You don't need a Fm to achieve that. Just multiply your numeric value to -1.

sample code:

****************

var1 = 46.

MULTIPLY var1 BY -1.

*************

output will be:

var1 = -46.

or

*********

var1 = -46.

MULTIPLY var1 BY -1.

*********

output will then be:

var1 = 46.

hope this will help...

5 REPLIES 5
Read only

Former Member
0 Likes
554

Hi,

DATA N TYPE P DECIMALS 2.

DATA M TYPE P DECIMALS 2 VALUE '-5.55'.

N = ABS( M ). WRITE: 'ABS: ', N.

Pls. reward if useful....

Read only

Former Member
0 Likes
555

You don't need a Fm to achieve that. Just multiply your numeric value to -1.

sample code:

****************

var1 = 46.

MULTIPLY var1 BY -1.

*************

output will be:

var1 = -46.

or

*********

var1 = -46.

MULTIPLY var1 BY -1.

*********

output will then be:

var1 = 46.

hope this will help...

Read only

Former Member
0 Likes
554

why u want to go with the FM . Just multiply the value with -1 .

Read only

Former Member
0 Likes
554

Multiply the value with -1.

data : v_val type p decimals 2 value '4.6'.

v_val = v_val * -1.

Read only

Former Member
0 Likes
554

Hi,

eg 4.6 to -4.6

to achive the above one, use the FM

CLOI_PUT_SIGN_IN_FRONT