cancel
Showing results for 
Search instead for 
Did you mean: 

BEx Query Formula Descriptions -- Conditional Formula

Former Member
0 Kudos

My question is in regards to the description that is returned from a formula within a structure. The data I'm expecting is based on (for example) "fiscal year." I have a text variable setup that returns the result of the "fiscal year" to be displayed as the column description.

However if no data is returned for the current fiscal year, I then want to display the data for the previous fiscal year.

I have a formula setup that uses a conditional statement. It is setup as described below:

<b>Formula Description</b>

-- If data is returned based on fiscal year "2008" then use that data.

-- Else use the data based on fiscal year "2007"

<b>Issue</b>

-- I use a text variable that is based on 0FISCYEAR called <b>0T_FYEAR</b>

-- When the query is run, the data returned is correct --> (2007 data if there is no 2008 data)

-- The text variable is also used as the formula "description" which is set to "0T_FYEAR" so if there was 2008 data, the text variable would say "2008" and if not it would say "2007."

The problem resides in the text variable which is used as the formula description. It is displaying the technical name of the text variable (&0T_FYEAR&) instead of "2008" or "2007."

Has anyone else had this occur? I would expect that if the data coming back is correctly based on 2008 or 2007, then the text variable used for the formula description would also be set to "2007" or "2008" based on my formula condition.

Any help would be greatly appreciated and of course points will be awarded!

Kevin

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

The variables gets populated before the formula calculation. i.e. when i_step = 1 or 2. (Just before & after the selection screen)

Whereas the formula will be calculated once the necessary data for your query layout is fetched.

Thus you text variable is searching for a definite fiscal year value which is not there at that time & hence it's returning the technical name of the variable.

Former Member
0 Kudos

Thanks for the quick response Pallavi...

That logic seems completely backwards to me...is there a reason BEx is trying to populate the text variable values BEFORE knowing what data is actually being returned?

Also, my next obvious question: Is there a way to get these variables populated with the correct value? Can I force it to populate AFTER the formula has been executed so BEx knows which value to assign?

What i'm trying to do is have a Year-Over-Year (last 3 years) comparison for the past 3 fiscal quarters. So I would compare the current quarter numbers (Qtr 1) YoY Q1/2008, Q1/2007, Q1/2006 with the previous quarter...but the previous quarter is Q4 of 2007 (not 2008). So I cant do the same 2008, 2007, 2006 comparison. I was hoping to move the years back one for a 2007, 2006, 2005 comparison --> Thus the need for the conditional statement.

I hope that helps explain. Any insight at all would be greatly appreciated.

Kevin

Message was edited by:

Kevin Susko

Former Member
0 Kudos

If I have not mistaken, this query will be always executed for current quarter & it will always have fixed columns.i.e.6 (current quarter for 3 years & prev quarter for 3 yrs).

If this is correct then you can define 6 text variables & populate them through customer exit.

Former Member
0 Kudos

Pallavi,

The description should come back as "Q3 2008" or "Q3 2007" depending on which condition is met in the formula and what data (2007 or 2008) is returned. It is being displayed as "Q1 &0T_FYEAR&" (but the data is correct). Still seems weird to me that it is trying to fill the labels of the returned data before the data is retrieved...it doesn't know which condition is met at that point?

Should I keep the formula in the query to bring back the data and use the customer exits simply to fill the text variables?

If so, how in ABAP could I conditionally set the value of a variable based on the results of the query formula?

The Quarter variable would be unneccessary as this value is correctly displayed in the results. It is the year that is showing up as "&0T_FYEAR&." <-- that is the text variable based on 0FISCYEAR which is used as the description of the formula.

Thanks for your help

Kevin

Answers (0)