IF_EX_RSR_OLAP_BADI~DEFINE

Hi Experts,
In the BAdI RSR_OLAP_BADI for Virtual Characteristics and Key Figures there is the DEFINE method.  Does anyone know what is the purpose of this method ( IF_EX_RSR_OLAP_BADI~DEFINE )?  I've followed some sample coding and did what it says to do and it works, but I am not quite clear what/how/why it is needed?  I have the following code.  Can someone explain when and where c_t_chanm is used when executing a query?
Any clarifications is appreciated.
Thanks,
BQ
DATA: l_s_chanm TYPE rrke_s_chanm,
          l_s_chanm_used TYPE rschanm,
          l_kyfnm TYPE rsd_kyfnm.
FIELD-SYMBOLS:
         <l_s_chanm> TYPE rrke_s_chanm.
case i_s_rkb1d-infocube.
   when 'MYCUBE'.
       loop at i_th_chanm_used into l_s_chanm_used.
            case l_s_chanm_used.
               when 'VIRTUALCHAR'.
                     l_s_chanm-chanm = 'VIRTUALCHAR'.
                     l_s_chanm-mode = rrke_c_mode-no_selection.
                     append l_s_chanm to c_t_chanm.
               when others.
            endcase.
      endloop.
endcase.

Hi Binh,
DEFINE: only called during generation of the query; choose characteristics/key figures used in the exit; choose 'modes' for the characterists
DEFINE
FLT_VAL: Filter values for the infoprovider as defined in the BADI
I_S_RKB1D: General informations about Infoprovider and query. Most useful are the fields Infocube and COMPID for identifying the query
I_TH_CHANM / KYFNM_USED: list of infoobjects used in the query
C_T_CHANM/KYFNM: list of infoobjects used for calculation in the BADI
You must add a public instance attribute P_CHA_<object> for each InfoObject you want to access in the COMPUTE method - and attributes P_KYF_<object> for each key figure.
For more information about this subject, access the link below:
http://help.sap.com/saphelp_nw70/helpdata/EN/8f/f2e540f8648431e10000000a1550b0/frameset.htm
At
Nadja Xavier

Similar Messages

  • BAdi method not executing - IF_EX_RSR_OLAP_BADI~DEFINE

    dear all,
    I am trying to implement a virtual characteristics using BAdi and the article i'm using is this. However, when i try to put my breakpoint in the code it is not executing in either RSRT or RSRT2. Any idea why? Even if i put my breakpoint in the CASE statement to determine if it is the infocube i want to filter by, that does not get executed. Any idea why?
    http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/90b2babc-15ad-2d10-c4b2-bd3af67d86b1?quicklink=index&overridelayout=true
    thanks in advance for the reply friends.

    any body with any thoughts out there on this? thank you so much in advance for the reply.

  • How to reference Key figure in (BAdI) IF_EX_RSR_OLAP_BADI~COMPUTE method?

    Hi,
    I am a new bee to the ABAP world.
    I am writing a BAdI implementation (Definition name: RSR_OLAP_BADI) for a 'Virtual KeyFigure' named D_TAX1.
    I dont know how to set the value for key figure D_TAX1 in BADI implementation COMPUTE method (IF_EX_RSR_OLAP_BADI~COMPUTE).
    D_TAX1 is a virttual key figure I had added in DSO.
    I want to populate the value in BADI compute method (IF_EX_RSR_OLAP_BADI~COMPUTE).
    I haven't written any method implementation for IF_EX_RSR_OLAP_BADI~DEFINE.
    Is it mandatory that I need to write some thing there? I haven't declared any attributes either.
    I want to set tax amount to the D_TAX1 virtual key figure based on the amount (another key figure in DSO).
    I don't know if I need to write this, but the class name in BAdI is: : ZCL_IM_VAL_IMPL.
    I really appreciate your help in this matter.
    Thank you.
    Sekhar

    Thank you for your answers.
    I have added the following code to the methods DEFINE, INITIALIZE & COMPUTE methods.
    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.
    Insert Code
    CASE i_s_rkb1d-infocube.
      WHEN 'D_DSOIC1'.                                "DSO name
        l_s_chanm-chanm = 'D_CST1'.              "Characteristic
        l_s_chanm-mode = rrke_c_mode-read.
        APPEND l_s_chanm TO c_t_chanm.
        APPEND 'D_TAX1' TO c_t_kyfnm.          "D_TAX1 is a newly added Virtual KeyFigure
    ENDCASE.
    ENDMETHOD. "if_ex_rsr_olap_badi~define
    [In the following INITIALIZE method, I didn't change any thing. I used the INITIALIZE method from the CL_EXM_IM_RSR_OLAP_BADI as is]
    method IF_EX_RSR_OLAP_BADI~INITIALIZE.
      DATA: l_global_name TYPE string.
      FIELD-SYMBOLS:
            <l_global>    TYPE i,
            <l_s_sfc>     TYPE rrkg_s_sfc,
            <l_s_sfk>     TYPE rrkg_s_sfk.
    there's no need to change this method
    Just create attributes for each charactersitic
    with name P_CHA_<characteristic> TYPE i.
    and constants for each key figure with name
    P_KYF_<key figure> TYPE i.
      CLASS cl_exm_im_rsr_olap_badi DEFINITION LOAD.
    get field postions for characteristics in structure
      LOOP AT i_th_sfc ASSIGNING <l_s_sfc>
           WHERE user_exit NE rrke_c_mode-none.
    field name in structure is keyreturnnm
    name of the global variable
        CONCATENATE 'P_CHA' <l_s_sfc>-chanm
            INTO l_global_name
            SEPARATED BY '_'.
    fill the global variable
        UNASSIGN <l_global>.
        ASSIGN (l_global_name) TO <l_global>.
        CHECK <l_global> IS ASSIGNED.
        <l_global> = cl_exm_im_rsr_olap_badi=>get_field_position_d(
                                           i_fieldnm = <l_s_sfc>-keyreturnnm
                                           i_s_data  = i_s_data ).
      ENDLOOP.
    get field positions for key figures in structure
      LOOP AT i_th_sfk ASSIGNING <l_s_sfk>
           WHERE value_returnnm IS NOT INITIAL.
    name of the global variable
        CONCATENATE 'P_KYF' <l_s_sfk>-kyfnm
            INTO l_global_name
            SEPARATED BY '_'.
    fill the global variable
        UNASSIGN <l_global>.
        ASSIGN (l_global_name) TO <l_global>.
        CHECK <l_global> IS ASSIGNED.
        <l_global> = cl_exm_im_rsr_olap_badi=>get_field_position_d(
                                           i_fieldnm = <l_s_sfk>-value_returnnm
                                           i_s_data  = i_s_data ).
      ENDLOOP.
    endmethod.
    METHOD if_ex_rsr_olap_badi~compute.
      FIELD-SYMBOLS <fs_d_tax1> TYPE ANY.
      FIELD-SYMBOLS <fs_d_cst1> TYPE ANY.
      ASSIGN COMPONENT p_kyf_d_tax1 OF STRUCTURE c_s_data TO <fs_d_tax1>.
      ASSIGN COMPONENT p_cha_d_cst1 OF STRUCTURE c_s_data TO <fs_d_cst1>.
      <fs_d_tax1> = 10.
    ENDMETHOD.
    When I display the virtual key figure D_TAX1 in the query, it is not populated with value 10.
    Can you guys please tell me what I need to change?
    I haven't written any code in GET_FIELD_POSITION_D (in the example class CL_EXM_IM_RSR_OLAP_BADI, this method is implemented).
    I appreciate your suggestions and help.
    Thank you,
    Sekhar

  • Creation of virtual characteristic

    I have to create a virtual characteristic (ZVCDOCNO) same as another object (Document Number - ZDOC_NO).
    This virtual characteristic should have same data as Document number but should contain values that begin with 11.
    I have checked the forum and found some good inputs, but all of them have been done using BADIs.
    Is there any other method other than BADIs?
    Solution suing BADI
    [http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/e051fda8-71a9-2a10-ac9e-8d17414a8c8c?QuickLink=index&overridelayout=true]
    [http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/60e34f63-f44c-2c10-488e-c89b04e0ca7c?QuickLink=index&overridelayout=true]
    [http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/b04be008-86cc-2c10-4bad-e517ea3f4c80?QuickLink=index&overridelayout=true]
    Using BADIs what will be the DEFINE and COMPUTE codes.

    I created and interface.
    In the Class interface
    Attributes tab
    Attribute          Level              Visibility     Typing    Associated Type
    P_CHA_ZDOC_NO      Instance Attribute      Public         Type      VBELN
    P_CHA_ZVCDOCNO     Instance Attribute      Public         Type      VBELN
    In Methods tab
    IF_EX_RSR_OLAP_BADI~DEFINE
    method IF_EX_RSR_OLAP_BADI~DEFINE.
      CASE i_s_rkb1d-infocube.
        When 'ZBKDSO'.
          Append 'ZVCDOCNO' to c_t_chanm.
      ENDCASE.
    endmethod.
    IF_EX_RSR_OLAP_BADI~COMPUTE
    method IF_EX_RSR_OLAP_BADI~COMPUTE.
    FIELD-SYMBOLS <fs_zdoc_no> TYPE /BI0/OIZDOC_NO.
      FIELD-SYMBOLS <fs_zvcdocno> TYPE /BIC/OIZVCDOCNO.
    If P_CHA_ZDOC_NO is not initial.
    ASSIGN COMPONENT P_CHA_ZDOC_NO OF STRUCTURE c_s_data to <fs_zdoc_no>.
    IF <fs_zdoc_no>(2) = '11'.
    <fs_zvcdocno> = <fs_zdoc_no>.
    ENDIF.
    endif.
    endmethod
    I still find some logic missing.  What are the changes to be done to code?

  • Creating BADI for Virtual Key fig: Error: RSR_OLAP_BADI does not exist

    Hi,
    I am following some instructions to test the implementation of virtual key figure and came to the point to create the BADI.
    Intructions on page 5:
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/e051fda8-71a9-2a10-ac9e-8d17414a8c8c
    SE19
    Create Implementation; New BADI; Enhancement Spot:    RSR_OLAP_BADI
    At this point I get an error that RSR_OLAP_BADI does not exist.
    I then chose at random APB_LAUNCHPAD but this works in the sense that it took me to the next screen
    1. What does it mean by RSR_OLAP_BADI not existing?
    2. I know the instructions points to choose RSR_OLAP_BADI, but why that particular program and how does one gets to know that it is the one to use for virtual key figure/char implementation?
    3. When I tested with APB_LAUNCHPAD, I did not get the same screen on page 5 of the link, is it different for BI 7? Or, am I missing a point?
    Thanks

    Hi,
    thanks for the guidance.
    Yes, I tried to implement exactly as in the article.
    Yes, I defined the filter for the Infoprovider, as ZV*
    Are you suggesting that at this point, if in the method  if_ex_rsr_olap_badi~define, I change the value of
    "ZV_ZIPER" to my DSO or Cube, I should now see the virtual key figure in my query?
    Based on this understanding, I modified the method as follows, (my cube name is 2LIS_11_VASCL):
    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.
    Insert Code
      CASE i_s_rkb1d-infocube.
    CASE i_s_rkb1d-2LIS_11_VASCL.
          WHEN '2LIS_11_VASCL'.
          l_s_chanm-chanm = 'ZVAR_SHPR'.
          l_s_chanm-mode = rrke_c_mode-read.
          APPEND l_s_chanm TO c_t_chanm.
          l_s_chanm-chanm = 'ZVARDT'.
          l_s_chanm-mode = rrke_c_mode-read.
          APPEND l_s_chanm TO c_t_chanm.
          APPEND 'ZV_20DV' TO c_t_kyfnm.
      ENDCASE.
    endmethod. "if_ex_rsr_olap_badi~define
    After activation, I checked the query and still I am not seeing the virtual key figure in the query for selection.
    Any more ideas?
    Thanks
    Edited by: Amanda Baah on May 24, 2009 8:01 AM

  • 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

  • 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

  • BADI for Virtual Characteristic

    Hi,
    I am able to use BADI to populate Virtual Key Figure, but getting an error when I use similar code for Virtual Char.
    Following are the details
    Characteristic InfoObjects IO_MATRAL, IO_PLANT, IO_CMATRL (virtual char)
    I want to assign the value of IO_MATRAL to IO_CMATRAL using BADI.
    Attributes are
    P_CHA_IO_CMATRL  associated type I (level: instance, visibility: private)
    P_CHA_IO_MATRL   associated type I (level: instance, visibility: private)
    DEFINE method
    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 'IC_SEKH'.
        l_s_chanm-chanm = 'IO_MATRL'.
        l_s_chanm-mode = rrke_c_mode-read.
        APPEND l_s_chanm TO c_t_chanm.
        l_s_chanm-chanm = 'IO_CMATRL'.
        l_s_chanm-mode = rrke_c_mode-read.
        APPEND l_s_chanm TO c_t_chanm.
    ENDCASE.
    ENDMETHOD.                    "if_ex_rsr_olap_badi~define
    INITIALIZE method
    method IF_EX_RSR_OLAP_BADI~INITIALIZE.
      DATA: l_global_name TYPE string.
      FIELD-SYMBOLS:
            <l_global>    TYPE i,
            <l_s_sfc>     TYPE rrkg_s_sfc,
            <l_s_sfk>     TYPE rrkg_s_sfk.
    there's no need to change this method
    Just create attributes for each charactersitic
    with name P_CHA_<characteristic> TYPE i.
    and constants for each key figure with name
    P_KYF_<key figure> TYPE i.
      CLASS cl_exm_im_rsr_olap_badi DEFINITION LOAD.
    get field postions for characteristics in structure
      LOOP AT i_th_sfc ASSIGNING <l_s_sfc>
           WHERE user_exit NE rrke_c_mode-none.
    field name in structure is keyreturnnm
    name of the global variable
        CONCATENATE 'P_CHA' <l_s_sfc>-chanm
            INTO l_global_name
            SEPARATED BY '_'.
    fill the global variable
        UNASSIGN <l_global>.
        ASSIGN (l_global_name) TO <l_global>.
        CHECK <l_global> IS ASSIGNED.
        <l_global> = cl_exm_im_rsr_olap_badi=>get_field_position_d(
                                           i_fieldnm = <l_s_sfc>-keyreturnnm
                                           i_s_data  = i_s_data ).
      ENDLOOP.
    endmethod.
    COMPUTE method
    method IF_EX_RSR_OLAP_BADI~COMPUTE.
      FIELD-SYMBOLS: <fs_io_cmatrl>   TYPE ANY,
                     <fs_io_matrl>    TYPE ANY.
      ASSIGN COMPONENT p_cha_io_matrl  OF STRUCTURE c_s_data TO <fs_io_matrl>.
      ASSIGN COMPONENT p_cha_io_cmatrl OF STRUCTURE c_s_data TO <fs_io_cmatrl>.
      <fs_io_cmatrl> = <fs_io_matrl>.
    endmethod.
    I am not getting any value in IO_CMATRL in the query.
    Even when I assign hardcoded value like 's', in compute method, it's not showing the value in the query result.
    Can you guys please suggest what am I missing here? (similar code works for Virtual keyFig. implementation)
    Thank you,
    Lakshmi

    Hi,
    In DEFINE Method
    l_s_chanm-chanm = 'IO_MATRL'.
    l_s_chanm-mode = rrke_c_mode-read.
    APPEND l_s_chanm TO c_t_chanm.
    l_s_chanm-chanm = 'IO_CMATRL'.
    l_s_chanm-mode = rrke_c_mode-read.
    APPEND l_s_chanm TO c_t_chanm.
    If u2018IO_CMATRLu2019 is your virtual characteristic u2026try changing the read mode to  rrke_c_mode-no_selection
    Thanks,
    Advait

  • 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

  • Virtual key figure BADI - does not change value

    I wrote a badi for virtual key figure according to guidelines from an SDN doc on how to create virtual chars and kf's.
    However, the value of the key figure is not changed at all. Below is my code. Please see what I'm doing wrong
    method IF_EX_RSR_OLAP_BADI~DEFINE.
       APPEND 'ZRANKS' TO c_t_kyfnm.
    endmethod.
    method IF_EX_RSR_OLAP_BADI~COMPUTE.
      if P_KYF_ZRANKS > 0.
        assign component p_kyf_zranks of structure c_s_data
        to <fs_ranks>.
        <fs_ranks> = '1.0'.
      endif.
    endmethod.

    There is something you need to do which I have not seen described in any of the documention here.
    You need to copy the source code for the INITIALIZE method directly from the code given in the example class CL_EXM_IM_RSR_OLAP_BAPI. That is where the P_KYF<object> and P_CHA<object> attributes are assigned their values. If you do not copy this code into your own implementation, these attributes have no value in the COMPUTE method and your code will probably not work.
    Bryan

  • Help needed for Virtual Key Figure BADI

    I am trying to implement Virtual Key Figures via BADI.
    Here is what I have done
    Define Method
    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.
    Insert Code
    CASE i_s_rkb1d-infocube.
    WHEN 'ZMCOPA_02'.
      l_s_chanm-chanm = '0CUSTOMER'.
      l_s_chanm-mode = rrke_c_mode-read.
      APPEND l_s_chanm TO c_t_chanm.
      APPEND 'ZCPRC_FLG' TO c_t_kyfnm.
      APPEND 'ZRTNS_PRC' TO c_t_kyfnm.
    ENDCASE.
    ENDMETHOD. "if_ex_rsr_olap_badi~define
    Compute Method
    method IF_EX_RSR_OLAP_BADI~COMPUTE.
    FIELD-SYMBOLS <fs_ZRTNS_PRC> TYPE ANY.
    FIELD-SYMBOLS <fs_ZCPRC_FLG> TYPE ANY.
    FIELD-SYMBOLS <fs_0customer> TYPE ANY.
    DATA: l_zv_20dv TYPE curr09.
    ASSIGN COMPONENT p_kyf_ZRTNS_PRC OF STRUCTURE c_s_data
    TO <fs_ZCPRC_FLG>.
    ASSIGN COMPONENT p_kyf_ZCPRC_FLG OF STRUCTURE c_s_data
    TO <fs_ZCPRC_FLG>.
    ASSIGN COMPONENT p_cha_0customer OF STRUCTURE c_s_data
    TO <fs_0customer>.
      DATA: l_zrtns_prc TYPE /bic/pzcust_prc-/BIC/ZRTNS_PRC.
      DATA: lt_zcust_prc TYPE TABLE OF /bic/pzcust_prc.
      DATA: ls_zcust_prc TYPE /bic/pzcust_prc.
      IF NOT p_cha_0customer IS INITIAL.
      <fs_0customer> =
      ENDIF.
    SELECT SINGLE *
      INTO ls_zcust_prc
      FROM /bic/pzcust_prc
      WHERE /bic/zcust_prc = <fs_0customer>.
    IF sy-subrc = 0.
      <fs_ZCPRC_FLG> = 1.
      <fs_ZRTNS_PRC> = ls_zcust_prc-/BIC/ZRTNS_PRC.
    ELSE.
      <fs_ZCPRC_FLG> = 0.
      <fs_ZRTNS_PRC> = 0.
    ENDIF.
    endmethod.
    I have commented out line in the Compute method because I was getting an error on my SELECT statement.  I think the error is due to the fact that <fs_0customer> is not being populated.
    In debug mode, p_kyf_ZRTNS_PRC, p_kyf_ZCPRC_FLG and p_cha_0customer all return 0.  Shouldn't they have a different value.  I have to admit that I don't really understand how ASSIGN COMPONENT works.
    I have defined p_kyf_ZRTNS_PRC, p_kyf_ZCPRC_FLG and p_cha_0customer in the Attribute tab.
    Any help would be appreciated.  I have spent several hours trying to figure out how this works.
    Thanks.
    Ryan

    Check this if it helps:
    https://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/e051fda8-71a9-2a10-ac9e-8d17414a8c8c

  • Virtual Key Figures using RSR_OLAP_BADI

    Hi gurus,
    We have been using the RSR_OLAP_BADI to generate some virtual key figures for our queries, now we have a problem creating a virtual key figure...
    We have got 4 key figures in the query, 1 is a normal KF and the last 3 are virtuals, one of the virtuals uses the normal KF and splits it between the total of the same KF. The point here is that the calculations are not coming ok because the COMPUTE method does not bring the information summarized as the KF is defined, because in the same structure of the query ther are some formulas that have the same KF restricted to another level of information.
    If we remove from the query this formulas, the virtual KF works perfect because the normal KF is delivering the information summarized.
    The question is... is it normal that this happened or there may be something wrong in our definition?
    Thanks and best regards to all!!!

    Hi,
    You can get number of threads in SDN search.
    Check in the following blog
    IF_EX_RSR_OLAP_BADI~DEFINE
    https://forums.sdn.sap.com/click.jspa?searchID=23657256&messageID=6776739
    https://forums.sdn.sap.com/click.jspa?searchID=23657256&messageID=6788064
    http://sapbikk.blogspot.com/2008/05/writing-virtual-characteristics-or-key.html
    Thanks
    Reddy
    Edited by: Surendra Reddy on Mar 18, 2009 4:29 AM

  • Virtual Key Fig/Char RSR_OLAP_BADI/ RSR00002

    Hi guru's,
    I am trying to switch from the customer exit RSR00002 to then new RSR_OLAP_BAPI functionily. However, I can't get it working. What I did:
    1. Created Implementation (SE19) ZTEST
    2. Assigned the infocube
    3. Following code in 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 'ZBBC4W_VK'.
    *     characteristic
          l_s_chanm-chanm = 'Z_TESTJK'.
          l_s_chanm-mode  = rrke_c_mode-no_selection.
          APPEND l_s_chanm TO c_t_chanm.
      ENDCASE.
    ENDMETHOD.
    4. Didn't do any thing in INITIALIZE
    5. Following code in COMPUTE:
    METHOD IF_EX_RSR_OLAP_BADI~COMPUTE .
    field-symbols <l_Z_TESTJK> TYPE ANY.
    if P_CHA_Z_TESTJK > 0.
      assign component P_CHA_Z_TESTJK of structure C_S_DATA to <l_Z_TESTJK>.
      <l_Z_TESTJK> = 'TEST'.
    endif.
    ENDMETHOD.
    6. Assigned the following attribute to the Class in (SE24):
    P_CHA_Z_TESTJK Static Attr Private TYPE i.
    7. Included in the Characteristic Z_TESTJK in the cube
    8. runned the report and expected to see TEST for the CHAR. Instead I get # Not Assigned
    Where did I go Wrong????

    Stephan,
    Thanks for your response. Yes I did but it didn't work.
    I defined it as Private because this is the same as in the SAP document: How to… Realize summarized display of stock values on storage
    Any other tips?

  • Create Virtual Keyfigure using BADI

    Hi All,
    I Am tring to implement a virtual keyfigure using BADI, here is what i did created a Enhancement for BADI RSR_OLAP_BADI but i am not sure how to write the code for methods DEFINE and COMPUTE, i am just trying to populate value 100 for Virtual Keyfigure ZVIRT (Just testing) and i am using this keyfigure in my ODS.
    here is the define method i have:
    METHOD IF_EX_RSR_OLAP_BADI~DEFINE .
      DATA: l_s_chanm   TYPE rrke_s_chanm,
            l_kyfnm     TYPE rsd_kyfnm,
            l_s_chanm_used TYPE rschanm.
      FIELD-SYMBOLS:
            <l_s_chanm> TYPE rrke_s_chanm,
    CASE i_s_rkb1d-infocube.
    WHEN 'CUBEXYZ'.
    ENDCASE.
    ENDMETHOD.
    Compute Method:
    METHOD IF_EX_RSR_OLAP_BADI~COMPUTE .
    ENDMETHOD.

    found this code in other post thought this would be helpful for others, this works.
    The coding for DEFINE is
    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 'MYCUBE'.
    characteristic
    l_s_chanm-chanm = 'ZVIRTUAL'.
    l_s_chanm-mode = rrke_c_mode-no_selection.
    APPEND l_s_chanm TO c_t_chanm.
    l_s_chanm-chanm = 'ZPMORDER'.
    l_s_chanm-mode = rrke_c_mode-read.
    APPEND l_s_chanm TO c_t_chanm.
    The coding for compute is:
    field-symbols: <f_virt> type /bic/oizvirtual,
    <f_ord> type /bic/oizpmorder.
    if P_CHA_zvirtual > 0.
    assign component P_CHA_zvirtual of structure C_S_DATA to <f_virt>.
    if P_CHA_zpmorder > 0.
    assign component P_CHA_zpmorder of structure C_S_DATA to <f_ord>.
    <f_virt> = <f_ord>+2(3).
    else.
    clear <f_virt>.
    endif.
    else.
    clear <f_virt>.
    endif.

  • BADI Troubles

    Hi Experts,
    I am trying to implement Virtual Characteristics by BADI. I have error 'GETWA_NOT ASSIGNED' error when I launch the query. The 'SELECT' step in my code is in error because field symbols are not recognized.
    Can someone help me ? Thanks in advance.
    Julien DELSOL
    Parameters
    P_CHA_0UCINSTALLA (CHAR10)
    P_CHA_0UCINSTALLA_0UCRATE_CAT (CHAR10)
    P_CHA_ZDATEFROM (DATS)
    P_CHA_ZDATETO (DATS)
    Definition
    method IF_EX_RSR_OLAP_BADI~DEFINE.
    DATA: l_s_chanm TYPE rrke_s_chanm.
    FIELD-SYMBOLS:
    <l_s_chanm> TYPE rrke_s_chanm.
    CASE i_s_rkb1d-infocube.
    WHEN 'ZMDCPCES1'.
      L_S_CHANM-CHANM = '0UCINSTALLA'.
      L_S_CHANM-MODE = RRKE_C_MODE-READ.
      APPEND L_S_CHANM To C_T_CHANM.
      L_S_CHANM-CHANM = '0UCINSTALLA_0UCRATE_CAT'.
      L_S_CHANM-MODE = RRKE_C_MODE-READ.
      APPEND L_S_CHANM To C_T_CHANM.
      L_S_CHANM-CHANM = 'ZDATEFROM'.
      L_S_CHANM-MODE = RRKE_C_MODE-NO_selection.
      APPEND L_S_CHANM To C_T_CHANM.
      L_S_CHANM-CHANM = 'ZDATETO'.
      L_S_CHANM-MODE = RRKE_C_MODE-no_selection.
      APPEND L_S_CHANM To C_T_CHANM.
    ENDCASE.
    ENDMETHOD. "if_ex_rsr_olap_badi~define
    Compute
    method IFEX_RSR_OLAP_BADI~COMPUTE._
      TYPES : BEGIN OF ty_install,
      UC_INSTALL type /BI0/QUCINSTALLA-UCINSTALLA,
      UCRATE_CAT type /BI0/QUCINSTALLA-UCRATE_CAT,
      DATEFROM type /BI0/QUCINSTALLA-DATEFROM,
      DATETO type /BI0/QUCINSTALLA-DATETO,
      END OF ty_install.
      DATA :  gt_install type TABLE OF ty_install,
              gs_install type ty_install.
    field-symbols: <fs_0UCINSTALLA> type any,
                   <fs_0UCINSTALLA_0UCRATE_CAT> type any,
                   <fs_ZDATEFROM> type any,
                   <fs_ZDATETO> type any.
    assign component p_cha_0UCINSTALLA of structure c_s_data to <fs_0UCINSTALLA>.
    assign component p_cha_0UCINSTALLA_0UCRATE_CAT of structure c_s_data to <fs_0UCINSTALLA_0UCRATE_CAT>.
    assign component p_cha_ZDATEFROM of structure c_s_data to <fs_ZDATEFROM>.
    assign component p_cha_ZDATETO of structure c_s_data to <fs_ZDATETO>.
    select  UCINSTALLA UCRATE_CAT DATEFROM DATETO
    from /BI0/QUCINSTALLA
    into table gt_install
    where UCINSTALLA = <fs_0UCINSTALLA>
    and UCRATE_CAT = <fs_0UCINSTALLA_0UCRATE_CAT>
    and OBJVERS = 'A'.
    sort gt_install by DATEFROM ascending.
    read table gt_install index 1 into gs_install.
    <fs_ZDATEFROM> = gs_install-DATEFROM.
    sort gt_install by DATEFROM descending.
    read table gt_install index 1 into gs_install.
    <fs_ZDATETO> = gs_install-DATETO.
    Edited by: Delsol Julien on Aug 18, 2008 3:49 PM

    Hi,
    Any chance this is a navigational attribute.
    0UCINSTALLA_0UCRATE_CAT
    Also
    L_S_CHANM-CHANM = '0UCINSTALLA'. here remove 0 from the initial. Use
    L_S_CHANM-CHANM = 'UCINSTALLA'.
    Regds,
    Shashank

Maybe you are looking for

  • DVD Drive Broken on iSight G5

    Well, I think the DVD drive broek on my G5.  Also, I tok my new DVD drive and hooked it up, and it seems not to be compatible.  What can I do? Are there compatible drives - yes, I NEED to use the DVD drive for their school.  Thanks.

  • How can I contact with Adobe Systems because I want to know how many licenses are there and if its includes Bridge?

    I want to buy Creative Cloud, but I don't know how many licenses are included and I don't know if Bridge program is include too I hope you can help me I rang to 900810339 but nobody respond to phone thak U

  • Java Script and JSF question

    Hello, I have a JSF component like this that has a pageSize attribute. It shows a grid with 5 elements. <x:gridView id="#{tab}GridView" pageSize="5"> </f:gridView>Then I have a drop down with 5 menu items where the user can select how many elements t

  • ITunes not recognizing account

    I recently purchased a new laptop and I ran into some problems when attempting to transfer my iTunes store purchases from my iPod to my iTunes library. When I tried to authorize my iTunes account on my new computer (the account under which all of my

  • Scout: Too much time calculating dirty regions

    Hi All, Frist of all, sorry for my English. I have a problem with my AIR App, I'm developing for Android and iOS. In iOS works perfectly but on Android the performance is poor. I checked with Scout and this is what i see: I don't understand why it sp