cancel
Showing results for 
Search instead for 
Did you mean: 

Formula

Aummad
Participant
0 Kudos

Hi,

I have a requirement. I need to create a formula in BEx,

If cost centre = ABC and if the value of FK1 is negative than multiply by -1 else FK1

basically our cost centre  ABC comes with negative values and we need to converter in positive values

please help me to write down the formula.

Thanks

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

Hi Asif,

Your formula would be

(((costcenter == 'ABC') * (((FK1 < 0) * (-1))+ ((FK1 > 0) * FK1)))

Analysis:


Condition : If cost centre = ABC and if the value of FK1 is negative than multiply by -1 else FK1


A.) Cost Center = ABC and Value of FK1 is not negative

Formula:  (1) * (0+FK1)   Result = FK1


B.) Cost Center NE ABC and Value of FK1 is not negative

Formula: (0) * (0+FK1)  Result = 0


C.) Cost Center = ABC, FK1 is negative

Formula: (1) * (FK1 + 0)  Result: FK1


Thanks,

Krishna

karthik_vasudevan
Active Contributor
0 Kudos

Hi Asif

You don't have to involve cost centre in this formulae. Just create a formula with the below syntax. It should work.

As you said, ABC will hold only negative values.

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

Regards

Karthik

Aummad
Participant
0 Kudos

Thanks Amit and Karthik,

for some reason i can not use user exit variable and cannot eliminate cost centre.

Please give me some advice.

Thanks

former_member220624
Contributor
0 Kudos

Hi Asif,

Create a restricted key-figure with a restriction on cost center as ABC.

Ñow use this RKF in the formula suggested by Karthik.

Let us know if this works.

Regards,

Amit

Aummad
Participant
0 Kudos

Hi,

can you please give me the complete formula.

i created RFK but how i use it in formula

Can you please help me

Thanks

karthik_vasudevan
Active Contributor
0 Kudos

Hi Asif

Right Click on your keyfigures structure and choose the option New formula

Edit the formula as below using Boolean operators and your new RKF.

Hope this helps!

Regards

Karthik

former_member220624
Contributor
0 Kudos

Hi Asif,

You can try with a formula variable of type customer exit.

In the cmod you can write a simple Abap code to achieve the requirement.

Regatds,

Amit