Access on aggregated levels with virtual key figures

Hi all,
I need access to the aggregated view of a BEx report within user-exit RSR00002 for processing virtual key figures. Currently I only get access to the lowest non-aggregated level.
My requirements in detail:
I get certain key-figures (250 historical values)on the lowest aggregation level - so-called folders. Then I have to aggregate this vector of values at the next hierarchy level up to the top-level, say along-side a company's business department structure. Drill-down, slice&dice should be possible. So far so good - this is done easily with standard BEx features.
Then, on each aggregation level, i.e. hierarchy node, I need to get the third lowest of the 250 aggregated values to assign this to my vkf. This is not an issue of the algorithm but of the internal data representation or access to the OLAP processor because I don't get this vector on the same aggregated level such as I could see it in my BEx report but on the lowest non-aggregated folder level.
The question is now:
a. Is data access on aggregated levels and drill-downs because of the internal representation generally not possible within this user-exit and would I have to supply the aggragation logic myself or
b. do I have overlooked something critical - did I miss the trick?
Every idea or hint is deeply welcome!!
Thanks a lot,
Michael
Message was edited by: Michael Kronenberger

First check in <b>Technical Information</b> in <b>RSRT</b> , whether the
<b>Virtual Char/Key</b> Fig is<b> Y</b> or <b>N</b>.

Similar Messages

  • Problem with virtual Key Figure in a query

    Hi Experts,
    I would like to share my problem with the virtual key figure in a query:
    I have a query with a virtual key figure and when I eject the query by analyzer, the result sometimes is displayed and sometimes is not displayed (is equal to 0), with the same initials values. And when I eject the query by RSRT always display the result for the virtual key figure.
    Why don't always display the result?
    Thanks a lot

    Hi,
    I think that the problem is the level of support package. We have BI AddOn 7.X (based on 7.20) support package 0.
    What do you think?
    Regards

  • Issue with Virtual Key Figures Using BADI

    Hi,
    We are populating values for a few virtual key figures in a query over a multiprovider through a BADI implementation(RSR_OLAP_BADI). On execution the VKF fields appear blank in the report.
    We tried debugging the methods of BADI by adding Break-Points in specific points. On doing so, we found that the values are properly updated in the 'Field-Symbols' used in the Compute method, but the same values do not appear in the report result and the fields are blank.
    Kindly provide any pointers or suggestions.
    Thanks.

    First check in <b>Technical Information</b> in <b>RSRT</b> , whether the
    <b>Virtual Char/Key</b> Fig is<b> Y</b> or <b>N</b>.

  • Subject : Problem with Virtual key figures for one scenario.

    Hi Gurus,
    I have implemented Virtual Keyfigures for my Bex report and it is working perfectly bUt for one scenario.
    If i give PLANT and MATERIALS in the selection  , The report calaculates the Virtual
    keyfigure value correctly But if i give Only PLANT
    and NO Materials ( A single plant can have 700 materials also!!), The report executes and after sometime
    gives me a messsage " Disconnecting from Server"
    I executed the report in RSRT . It gives me this error "exception with the type CX_SY_ARITHMETIC_OVERFLOW occurred"
    Since the Virtual keyfigure doesnot use Cache memory. Is it restricted by the Physical memory?.  How to overcome this
    problem?
    Please let know if anyone faced this issue and resolved It. Any help or guidance is really appreciated.

    Hi Oscar,
    Thanks for reply,
    How can i know the overflow and how can i use the catch for avoiding the short dump?
    thanks in advance.

  • Exception aggregation on Non-cumulative key figure

    Dear experts,
    I have a problem. We have an InfoCube in BW in which the Activity Journals are loaded every day. In this Activity Journals it is registered that a Material was listed (available) at a customer (value 0 or 1).
    We have a non-cumulative key figure MXW_LISTN with inflow (MXW_LISTI) and outflow (MXW_LISTO). In time this key figure receives +1 or -1 for a customer, material combination.
    I want to use MXW_LISTN in the query in a specific way. The key figure on itselve tells me how many listings there are. However, I want to know how many business partners there are with a listing.
    I was thinking about an exception aggregation on MXW_LISTN with reference characteristic 0BPARTNER and "Count <> 0". BW however refuses to do so and only lets me do simple aggregations such as AVG, MIN, MAX etc.
    Can you think with me and come with an proper solution to count the number of business partners with a listing?
    Your help is very much appreciated and rewarded!
    Best regards, Hans de Klein

    Maybe a solution with virtual key figures is an option?
    Please help me out!
    Best regards, Hans de Klein

  • Type conflict with ASSIGN in BADI for Virtual Key Figures

    We get the below error dump in ST22 when executing BEx queries that contain virtual key figures.
    error message - 'Type conflict with ASSIGN in
    program "ZCL_IM_THR_RSR_OLAP_BADI======CP".'
    We have a BADI implementation that calculates few virtual key figures included in some infocubes & multiproviders. The error would arise if we execute two queries (containing common Virtual Key figures) one after the other without closing the first query.
    We found a note "Note 1237689 - Virtual chars. and key figures in input-ready querys" that could be relevant to our issue and wanted to apply this note but unfortunately the note is only applicable to SAPKW70016 to SAPKW70018 and we are support pack 15.
    Can you please advise what the problem could be/suggest corrections for the same.

    Hi Kulmohan,
    Did you fix your issue? We are facing the same issue. Could you please let me know if you have any solution for this issue,
    Thank you,
    Mike

  • Problems with creating badi implementation for virtual key figures

    Hi,
    I'm running BI 7.0 (unicode).
    I have been trying to follow this blog to calculate the virtual keyfigure in my infoset - Using Virtual Key Figure and Characteris in an InfoSet
    My infoset includes 1 infocube, and 3 master data infoobjects. I have created everything the blog was referring to, and activated fine. However, it seems that when the field symbols are assigned from the c_s_data structure, they do not get referenced correctly, so that no correct memory area is assigned and instead the whole c_s_data structure is assigned to the field symbol, which prevents me from referencing the right mem area correctly.
    For example, in this statement
    ASSIGN COMPONENT P_CHA_ZMYINFOSET___F120 OF STRUCTURE c_s_data
                                                                           TO  <fs_ZMYINFOSET___F120>.
    the component p_cha_zmyinfoset___F120 of c_s_data supposed to be assigned to the field symbol (point to the correct place in structure c_s_data). In other words when this statement is executed, the program looks at structure c_s_data, finds the component zmyinfoset___F120 in it, and assignes the position of that component in the structure to the field symbol, so that it could be referenced in the code. However, the correct assignment does not happen.
    When I debug the code and view the structure c_s_data, I can never find any component with any of the names I can find in my BEX query like ZMYINFOSET___F120. All I see are the components that are named like these: Z____5179 (C_S_DATA-Z____5179), C_S_DATA-S____5150, etc. I see the correct values, but components all have weired names like that. I thought in Infosets the components are named in the following fashion: INFOSETNAME___FXXX which you can see from your BEX query designer. Why is this happening? Why don't I see the correct names in the c_s_data structure? If instead I try to assign those components with their weired names directly, I still get incorrect assignment.
    what am I doing wrong?
    I was reading abap help on this statement:  assign COMPONENT comp OF STRUCTURE struc
    and the following I found:
    With this expression for mem_area, the memory area of a component comp of a structure struc is assigned to the field symbol. While the structure struc is specified directly, a data object must be specified for comp. The evaluation depends on the data type of comp:
    If the field comp has a non-text, elementary type, the content is converted to the type i and interpreted as a position of the component in the structure. if the value for comp is 0, the storage area of the entire structure is assigned to the field symbol.
    From what it says above, my value for comp is always 0, so that the entire structure is always assigned to my field symbol instead of a specific position in that structure.
    please let me know what is wrong here.
    thanks.
    Edited by: AG on Oct 11, 2008 10:41 AM
    Edited by: AG on Oct 11, 2008 10:42 AM

    Hi,
    I am facing the similar issue. Can you please tell me how you solved this problem in more details?
    which sample code and how u can find that in SE24 and where to copy that code.
    Thanks in advance..
    vamsi.

  • Virtual Key Figure on Multicube (RSR_OLAP_BADI)

    I've created a virtual key figure (using RSR_OLAP_BADI) for number of days in month [zdays_month].  Everything works perfectly when it's used in a query on a cube cube.  BUT, when I try to use it in  aquery on a multi-cube, it doesn't.  The multi-cube query returns a number = the number of days in the month * the number transactions in that month. 
    Anyone know how I can force the VKF to execute after the data is returned?  I would prefer to not mess with exception aggregation, or key figure properties.  I need to keep this VERY SIMPLE for my query developers.
    Your assistance is greatly appreciated,
    Kenneth

    hi,
    first try to check whether the query access virtual kf or not, use transaction rsrt, type in the query name, and click technical info or properties, there will some line 'virtual char/kf'.
    i think the query may never access the code in BadI because in the code it's set with condition infoprovider technical name, it will cover only the infoprovider, when we access query from multiprovider, which join from one of the infoprovider, it's not automatically have the virtual kf/char, we have to specified the multiprovider name in the BadI, you may change the code as following :
    hope this helps.
    CASE i_s_rkb1d-infocube.
        WHEN '[your infocube name]'.
    ENDCASE.
    to
    IF i_s_rkb1d-infocube = [your infocube name] or
       i_s_rkb1d-infocube = [your multiprovider name].
    ENDIF.
    for other infoproviders
    CASE i_s_rkb1d-infocube.
        WHEN '[other cube name]'
    ENDCASE.

  • Problems using virtual key figures

    Hi experts,
    I have got 2 questions regarding virtual key figures, by using the OLAP BADI
    1. Is there a chance to get the variable values out of the variable selection screen in the BADI implemtentation? If so, how?.
    2. In the compute method the assign does not work because the Attributes (p_kyf_ZIMCREDAY, p_cha_0material,p_cha_0calday)  are 0 all the time.
        How does the attribute get a correct assignment to a component name? See my coding of the define and compute method below.
    Thanks and Regards, Mario
    IF_EX_RSR_OLAP_BADI~DEFINE
    DATA: l_s_chanm TYPE rrke_s_chanm,
    l_kyfnm TYPE rsd_kyfnm.
    FIELD-SYMBOLS:
    <l_s_chanm> TYPE rrke_s_chanm.
    CASE i_s_rkb1d-infocube.
    WHEN 'ZD_IMC001'.
    l_s_chanm-chanm = '0MATERIAL'.
    l_s_chanm-mode = rrke_c_mode-read.
    APPEND l_s_chanm TO c_t_chanm.
    l_s_chanm-chanm = '0CALDAY'.
    l_s_chanm-mode = rrke_c_mode-read.
    APPEND l_s_chanm TO c_t_chanm.
    APPEND 'ZIMCREDAY' TO c_t_kyfnm.
    ENDCASE.
    IF_EX_RSR_OLAP_BADI~COMPUTE
    FIELD-SYMBOLS <fs_ZIMCREDAY> TYPE ANY.
    FIELD-SYMBOLS <fs_material> TYPE ANY.
    FIELD-SYMBOLS : <fs_calday> TYPE ANY.
    ASSIGN COMPONENT p_kyf_ZIMCREDAY OF STRUCTURE c_s_data
    TO <fs_ZIMCREDAY>.
    ASSIGN COMPONENT p_cha_0material OF STRUCTURE c_s_data "p_cha_0material
    TO <fs_material>.
    ASSIGN COMPONENT p_cha_0calday OF STRUCTURE c_s_data "p_cha_0calday
    TO <fs_calday>.

    Regarding 1.
    I checked in debugging the variable I_TH_SFC in the initialize method, but there is no information regarding the selections in the variable popup.
    Can you please explain in detail how to access the variable values.
    Regarding 2.
    I changed l_s_chanm-mode to rrke_c_mode-no_selection according to your recommendation.
    Unfortunately it´s still the same. The attributes still does have the value 0. Therefore the assign does not work correct.
    The attributes are defined with type i. But the component names are like 'K____132'. Is this the cause of the problem?
    Thanks, Mario

  • Virtual Key Figures its not populated when execute query

    Hi All
    I did a BADI for populate a Virtual Key Figure, I follow the instructions of link
    Link:[http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/60e34f63-f44c-2c10-488e-c89b04e0ca7c?quicklink=index&overridelayout=true]
    In addition I add the code section of data declarated on example of: CL_EXM_IM_RSR_OLAP_BADI section define: IF_EX_RSR_OLAP_BADI~DEFINE, only information that said:
      DATA: l_s_chanm   TYPE rrke_s_chanm,
            l_kyfnm     TYPE rsd_kyfnm.
      FIELD-SYMBOLS:
            <l_s_chanm> TYPE rrke_s_chanm.
    I test the query on RSRT and the virtual Key Figure is "0.00" this look like if the virtual key figure is not populated.
    I did other things like:
    Set a Break Point on COMPUTE section of my BADI, I saw that the value is assigned, but I don't know how I can continue reviewing the pass of this value to result of query.
    I generate again the query on RSRT.
    My code is:
    IF_EX_RSR_OLAP_BADI~DEFINE
    method IF_EX_RSR_OLAP_BADI~DEFINE.
      data: L_S_CHANM   type RRKE_S_CHANM,
            L_KYFNM     type RSD_KYFNM.
      field-symbols:
            <L_S_CHANM> type RRKE_S_CHANM.
      case I_S_RKB1D-INFOCUBE.
        when 'ZGTO_OB2'.
          append 'ZVIRTKF' to C_T_KYFNM.
      endcase.
    endmethod. 
    IF_EX_RSR_OLAP_BADI~COMPUTE
    method IF_EX_RSR_OLAP_BADI~COMPUTE.
      field-symbols <FS_ZVIRTKF> type any.
      P_KYF_ZVIRTKF = 16.
      assign component P_KYF_ZVIRTKF of structure C_S_DATA
      to <FS_ZVIRTKF>.
      <FS_ZVIRTKF> = 10 .
    endmethod.
    I will appreciate your recommendations, Thanks in advanced.
    Al

    Thank you very much Sanganya
    I saw this:
    I put a break point on P_KYF_ZVIRTKF = 16., then I saw that P_KYF_ZVIRTKF obtain value 16.
    Then on sentence: assign component P_KYF_ZVIRTKF of structure C_S_DATA
    to <FS_ZVIRTKF> , when the system pass this line, I review the sy-subrc and is equal 4, as I understood the ASSIGN sentence did not be complete, the value shoul be 0.
    Then when the system try to run the sentence: <FS_ZVIRTKF> = 10  the system send an Execution error that say:  GETWA_NOT_ASSIGNED...
      Error analysis
        You attempted to access an unassigned field symbol
        (data segment 32780).
        This error may occur if
        - You address a typed field symbol before it has been set with
          ASSIGN
        - You address a field symbol that pointed to the line of an
          internal table that was deleted
        - You address a field symbol that was previously reset using
          UNASSIGN or that pointed to a local field that no
          longer exists
        - You address a global function interface, although the
          respective function module is not active - that is, is
          not in the list of active calls. The list of active calls
          can be taken from this short dump.
    Exactly the line selected with error is:
    >>>>    <fs_zvirtkf> = '10.0'.
    I will appreciate your help
    Thank you
    Al

  • Create Badi for Virtual Key Figure

    Hi experts,
    i have to create badi for virtual key figure in BIW for dat i m creating Badi in BI development but its asking for Access Key.
    Badi name is RSR_OLAP_BADI
    i want to know while creating classic Badi with Implementation Name do developer need access key or thr any othr way to develop Badi for Virtual Key Figure.
    Tell me for creating virtual key figure in biw we use Badi and for dat we have to create the Badi in BIW Dev. or in R/3 Dev.
    it first time dat i m creating BAdi.
    Ankit
    Edited by: ankit375 on Feb 3, 2011 11:14 AM
    Edited by: ankit375 on Feb 3, 2011 11:14 AM

    To see how to create this BADI see here:
    http://www.sdn.sap.com/irj/scn/index?rid=/library/uuid/90b2babc-15ad-2d10-c4b2-bd3af67d86b1
    You you need to be registered as developer (you have to have dev.key) to do the coding.

  • Virtual Key Figure

    Hi all,
    Before implementing a virtual key figure, I'd like to make sure this will answer my need. I work for a brewery, and I am looking at our customer taps activity.
    Records in the cube:
    Trading Region A, Brand X, Customer 001, Action "Install": 1 "Tap action"
    Trading Region A, Brand X, Customer 002, Action "Install": 2 "Tap action" (<i>new taps</i>)
    Trading Region A, Brand X, Customer 002, Action "Removal": 1 "Tap action" (<i>old tap</i>)
    So what I want to have in my report is :
    Trading Region A Brand X: 2 "customer activity"
    I am thinking I could use a virtual key figure that will look in the cube and check if there was any activity for a customer on that brand and trading region, and then will allow me to aggregate the result in the query.
    But I am not sure because it seems to me that Virtual Key Figure are calculated at record level...
    Could any of you clarify this for me ?
    Many thanks for your help,
    Nicolas

    Thanks a lot !
    I don't know why I tried such a complicated solution...
    Tried to assign points and close the issue, let me know if it didn't work as this is my first post...

  • Use of Key Date in Virtual Key Figure Calculation

    I have a virtual key figure whose value depends in part on the key date entered by the user.  I have the VKF set up with a dummy calculation, and it is working OK.
    How do I refer to the value of the key date in the code that assigns the VKF value?
    Thanks,
    DP

    Found the answer, thanks to another thread:
    Function RRS_VAR_VALUE_FROM_MEMORY_GET with I_VNAM equal to the key date variable returns the value of the key date.
    DP

  • Using Virtual Key Figures/ Characteristics is possible to use in InfoSets

    Hi All,
    Is it possible Using Virtual Key Figures/ Characteristics is possible to use in InfoSets?
    I have tried all the possibilities using the BADI implementation RSR_OLAP_BADI without success.
    The VKF / Characteristics works fine when it is being used with a query based on the ODS however it is not populated when i am using the infoset. Moreover i have used the code for InfoSet as well it is not working.
    I would appreciate any help in this regard.
    Regards
    Noor

    Hi PV,
    r u sure about that, as i have tried all sort of permutation and combinations for using the same in RSR_OLAP_BADI without any luck.
    I have the got felling about the same however if you look into the following SAP note it puts me into doubt.
    Note 657690 - Virtual characteristics and key figures in InfoSets
    Note 618738 - Virtual characteristics or key figures and InfoSets.
    It describe about using the RSR00002.
    Many thanks for the information.
    Kind Regards
    Noor

  • BEX - Virtual key-figure

    Hi gentlemen,
    I am facing a problem with a BADI that I created for populating a virtual key figure.
    I simply want to read a masterdata table and populate a key figure. When executing the query, a dump occurs with a very explicit explanation. Unfortunately, I don't know how to solve it.
    Dump:
    You attempted to assign a field to a typed field symbol,
    but the field does not have the required type.      
    Attributes in the BADI:
    P_CHA_0PLANT     Instance Attribute     Private     Type     I     Plant
    P_KYF_ZSHPQTEUT     Instance Attribute     Private     Type     I     Shipment quantity EUT
    See below.
    Define:
    method IF_EX_RSR_OLAP_BADI~DEFINE.
    DATA: l_s_chanm like line of c_t_chanm.
    DATA: l_kyfnm TYPE rsd_kyfnm.
    CASE i_s_rkb1d-infocube.
        WHEN 'ZFM_M01'.
          l_s_chanm-chanm = '0PLANT'.
          l_s_chanm-mode  = rrke_c_mode-read.
          APPEND l_s_chanm TO c_t_chanm.
    l_kyfnm = 'ZSHPQTEUT'.
    APPEND l_kyfnm TO c_t_kyfnm.
    endcase.
    ENDMETHOD. "if_ex_rsr_olap_badi~define   "
    Compute:
    METHOD if_ex_rsr_olap_badi~compute .
      FIELD-SYMBOLS: <fs_ZSHPQTEUT> TYPE /BIC/OIZSHPQTEUT.
      FIELD-SYMBOLS: <fs_0PLANT> TYPE /BI0/OIPLANT.
      ASSIGN COMPONENT P_CHA_0PLANT OF STRUCTURE c_s_data
      TO <fs_0PLANT>.
      ASSIGN COMPONENT P_KYF_ZSHPQTEUT OF STRUCTURE c_s_data
      TO <fs_ZSHPQTEUT>.
      SELECT /BIC/ZSHPQTEUT
      INTO <fs_ZSHPQTEUT>
      UP TO 1 ROWS
      FROM /BI0/PPLANT
      WHERE PLANT = <fs_0PLANT>.
      ENDSELECT.
    ENDMETHOD.
    Thank you in advance.
    Jacques

    Hi Jacques,
    Please include 2 changes:
    1. As suggested by Jen, declare Field Symbols with type ANY.
    2. Instead of directly using Field symbol values in the select query, create 2 temporary variables of type string and use them.
    After changes the method COMPUTE would look like below:
    METHOD if_ex_rsr_olap_badi~compute.
    FIELD-SYMBOLS: <fs_ZSHPQTEUT> TYPE ANY.
    FIELD-SYMBOLS: <fs_0PLANT> TYPE ANY.
    ASSIGN COMPONENT P_CHA_0PLANT OF STRUCTURE c_s_data
    TO <fs_0PLANT>.
    ASSIGN COMPONENT P_KYF_ZSHPQTEUT OF STRUCTURE c_s_data
    TO <fs_ZSHPQTEUT>.
    DATA tp_shpqty type string.
    DATA tp_plnt  type string.
    IF <fs_0PLANT> is ASSIGNED.
    tp_plnt = <fs_0PLANT>.
    ENDIF.
    SELECT SINGLE  /BIC/ZSHPQTEUT
    INTO tp_shpqty
    FROM /BI0/PPLANT
    WHERE PLANT = tp_plnt.
    IF <fs_ZSHPQTEUT> is ASSIGNED.
    <fs_ZSHPQTEUT> = tp_shpqty.
    ENDIF.
    ENDMETHOD.
    Regards,
    Hemant Khemani

Maybe you are looking for