cancel
Showing results for 
Search instead for 
Did you mean: 

Mathematical Function ABS() not working

Former Member
0 Kudos

Hi

The ABS Function is not working for the formulae created in the report. The values is getting subtracted, but '-' value is not getting removed from the final output.

Can anyone suggest how to proceed further.

Regards

Nitin

Accepted Solutions (0)

Answers (5)

Answers (5)

henrique_costa
Discoverer
0 Kudos

Hi.

We can solve this way:

DATA: valor TYPE i,
zval TYPE i.


zval = '-111.1'.
PERFORM abs USING zval CHANGING valor.

WRITE valor.
FORM abs USING p_zval
CHANGING p_valor.

IF p_zval LE 0.
p_valor = p_zval * -1.
ELSE.
p_valor = p_zval.
ENDIF.

Former Member
0 Kudos

Hi All,

While checking the error i noticed that the formula doesnot get saved in the backend instantaneously, it takes some time to save the formulae after which it will start giving the output.

sometimes even after changing the formulae, old formulae values were appearing in the output.

Can you please suggest how can i check it ...

Regards

NitRam

former_member186053
Active Contributor
0 Kudos

Hi Nitin,

Can you re-generate the report in RSRT and see if you are still getting the old values.

Also try clear cache memory with the help of basis.

Regards,

Vengal.

Former Member
0 Kudos

Hi Vengal,

I tried regenerating the report and creating the formulae, but still the values are not working fine ..

Whenever i try using mathematical function the foumulae doesnot create/save.

Without using simple calculations using +,-,*,/ the report works fine and output is displayed properly ...

But the problem occurs when using mathematical function, data function.....

Kindly suggest...

Loed
Active Contributor
0 Kudos

Hi Nitin,

How about creating your own ABS formula? Error still occurs?

( ZKF_TEST < 0 ) * ( ZKF_TEST * (-1) ) + ZKF_TEST

If you are using analyzer for queries, you may logout then login again to refresh the query being used in analyzer..

Regards,

Loed

Former Member
0 Kudos

Hi loed,

i need to analyze why this function is allowing the formulae to work at report level..

On further analyzing the issue i found that, using NODIM function in the formulae the values are coming right.

so ..

Formulae : ABS('a'-'b')   - is not working fine.

Formuale : ABS(NODIM('A')-NODIM('B')) is working fine....

Can this be because the Base unit of keyfigures are different and which would lead to this error while calculating values on the fly from the infoprovider .

Regards

Nitin

former_member186053
Active Contributor
0 Kudos

Hi Nitin,

Yes,i think that would be the reason. When you try without NODIM function, it was not able to interpret both A and B are of similar type(due to different base units).

Regards,

Vengal.

Loed
Active Contributor
0 Kudos

Hi Nitin,

As Vengal said, you Query Designer does not allow us calculate values having different units since it doesn't make sense..

Like, adding 10 KG with 10 KL..

Regards,

Loed

Former Member
0 Kudos

Hi Loed,

I having this problem at web report level ..

Regards

NitinRamola

Loed
Active Contributor
0 Kudos

Hi Nitin,

If ABS formula is not working, let's just do your own ABS formula..Let's call the keyfigure you are using as ZKF_TEST:

Create a formula, let's call it ZFORMULA_KF and enter this:

( ZKF_TEST < 0 ) * ( ZKF_TEST * (-1) ) + ZKF_TEST

Regards,

Loed

KodandaPani_KV
Active Contributor
0 Kudos

Hi,

if you use the ABS funciton it will remove the -ve vlaues

I have one sales keyfigure and which is having +ve -ve values, but I need all values in +ve only so I use  Absolute Value, ABS ( 'Sale').

-Phani.

Former Member
0 Kudos

Hi Phani,

On further analyzing the issue i found that, using NODIM function in the formulae the values are coming right.

so ..

Formulae : ABS('a'-'b')   - is not working fine.

Formuale : ABS(NODIM('A')-NODIM('B')) is working fine....

Can this be because the Base unit of keyfigures are different and which would lead to this error while calculating values on the fly from the infoprovider .

Regards

Nitin

anshu_lilhori
Active Contributor
0 Kudos

can you share the formula you have written ?

Regards,

AL