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

ABS statement

Former Member
0 Likes
32,781

Can anyone explain me the use of ABS statement.

Eg. f = abs(g).

7 REPLIES 7
Read only

Former Member
0 Likes
11,565

Hi

ABS statement gives the absolute value of any field

means if it is Negative it gives the positive value

Reward points for useful Answers

Regards

Anji

Read only

Former Member
0 Likes
11,565

use to convert -ve to +ve or viseversa

Use ABS function or multiple it with minus 1 are same

f1 = ABS ( f1 ).

f1 = f1 * -1.

Read only

11,565

Feel like I'm being super picky on a 16 year old post...
but it's not technically correct to say "ABS function or multiple(sic) it with minus 1 are same"

If the original operand is negative, this is true.

If the original operand is positive... ABS will return a positive result; * -1 will return a negative result...

So basically, like a cheerful developer... it removes any negativity...

Read only

Former Member
0 Likes
11,565

Hi Camila,

This statement returns the absolute value of the number g, ie f will contain the absolute value of g. Absolute value means the value without taking into consideration the sign.

For example, if g has the value -10, f will get the value 10.

Reward points if helpful.

Regards

Renuka

Read only

Former Member
11,565

camila,

ABS()--Means it will convert - sign to + sign

Ex : F1 = -100.

F2 = ABS ( f1 ).

Write : F2.

Ans: 100

Don't forget to reward if useful...

Read only

Former Member
0 Likes
11,565

HI,

use to convert -ve to +ve or viseversa

Use ABS function or multiple it with minus 1 are same , which gives same result.

for ex:

data a type i value -10.

a = ABS(a)

write a. o/p is 10

if helpful reward some points.

with regards,

suresh.

Read only

Clemenss
Active Contributor
0 Likes
11,565

Hi all,

ABS like i.e. sign, ceil or trunc are so-called overloaded functions. That means that the type of the result is determined by the type of the argument.

When creating such functional methods using the class builder I learned that the RETURN parameter must be explicily typed. So my question is: Can you create overloaded functions with ABAP class builder?

TIA,

Regards,

Clemens