Skip to Content

### Formula

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

##### Add comment
10|10000 characters needed characters exceeded

### 3 Answers

• Former Member
Nov 03, 2015 at 01:58 PM

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

##### Add comment
10|10000 characters needed characters exceeded
• Nov 03, 2015 at 02:00 PM

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

##### Add comment
10|10000 characters needed characters exceeded
• Karthik Vasudevan Asif Ummad

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

Capture.PNG (3.7 kB)
Capture1.PNG (17.2 kB)
• Former Member
Nov 03, 2015 at 05:42 PM

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

##### Add comment
10|10000 characters needed characters exceeded