cancel
Showing results for 
Search instead for 
Did you mean: 

Reg - If ELSE usage in BEX Querry

Former Member
0 Kudos

Hi,

I have to implement below simple business logic at Querry level

Var Plan/Actual Cost Percent % =

If Plan Cost NE 0:

% = (Actual Cost - Plan Cost ) * 100 / Plan Cost

Else

Actual Cost = 0.

% = 0

Else

% = 100

endif.

and I have created calculated keyfigure as below

( 'Planned costs' NE 0 ) * 'Actual costs' % 'Planned costs' + ( ( 'Actual costs' == 0 ) AND ( 'Planned costs' == 0 ) ) * 0 + ( ( 'Actual costs' NE 0 ) AND ( 'Planned costs' == 0 ) ) * 100

I know that we need not validate again planned costs in else part but still as it was not working correctly just modified after refering sap help but still it is not giving expected result so can you please have a look at it and let me know what i am missing here??

Thanks for your valuable time..

BRK

Edited by: BRK on Jul 15, 2008 5:19 PM

Edited by: BRK on Jul 15, 2008 5:20 PM

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

Try the following formula. it should work for ya.

(( 'Planned costs' NE 0 ) * ('Actual costs' % 'Planned costs' ))+ (( ( 'Actual costs' NE 0 ) AND ( 'Planned costs' == 0 ) ) * 100)

Regds,

Shashank

Former Member
0 Kudos

Hi Shashank,

Just now I am looking at your reply infact just yesterday implemented the formula like you said and it worked ..

However i say fully thanks and award points as it is matching my requirement..

but i could not understand what was the wrong in my initial formula ..will see when have time again..

Thanks & Regards,

BRK

Answers (1)

Answers (1)

Former Member
0 Kudos
Former Member
0 Kudos

I think this one will work for u

(PLANCOST<>0)(ACTUALCOST<>0)(ACTUALCOST %A PLANCOST)+(PLANCOST=0)100 +(ACTUALCOST=0)0

Thanks

Former Member
0 Kudos

Hi Walt,

I think there is some problem in displaying NE in symbols as angle brackets because if we type angle brackets after saving those are getting disappeared (I mean in SDN)

anyway however i have seen your message you had mentioned * (star) between Plan Cost NE 0 and Actual Cost NE 0 ..

is it really star or Logical AND ..

(PLANCOST0)*(ACTUALCOST0)..

Inshort still it didnt solve my problem .. so can you please explain me in more detail..

Thanks & regards,

BRK