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

Similar Messages

  • In Query key figure are not populated

    Hi Gurus,
    i am using a RSCRMBAPI to get the out put of my query into a Ztable but when i run my program the Ztable is getting data but no key figures are getting populated.
    plz help
    thanks
    neelu

    Hi gurus,
    i just have 1.6lac records with six keyfigures so i think its not the problem of limitation...
    then can somebody help me how to get rid of this, no key figure values are getting populated
    thanks and regards
    Neel

  • Key figures are not available when i performing LBWE action

    Hi gurus,
      I am trying to load 2lis_02_hdr, 2lis_02_itm and 2lis_02_scl to infocube 0pur_c04.
    But whatever the key figures available in the cube its not appear in the R/3 side data Source.. but those keyfigures are available in LIS structure.. for that how can i bring those key figures to dataSource for using LO Cockpit..
    I heard we need to perform some prerequistes in SBIW.. let me know in breif with step by step..
    Full points will assign to all those reply my query early..
    Please let me know if not understand my query..
    Thanks in Advance

    Hello Sudheer
    2LIS_02_HDR, ITM and SCL do not take data from S011 but directly from transactionnal tables like EBEP, EBKO, EBPO (names quoted from memory).
    So you have to look for the key figures from those tables and not the one in S011.
    Historically, the three datasource were built to replace 2LIS_02_S011 but the calculations to rebuild the keyfigures were delivered in BW in an old BCT that made the conversions. The logic and modeling have changed completely.
    If you really need to transfer S011 to BW without remodelling the data, you may want to use a generic extractor based on S011 (provided you have a delta key available).
    Otherwise, in SBIW, Options for datasource specific to the application, Logistics, purchasing, you have two customizing transactions. you have to define branch and process key to load data into BW. But that will not have any effect to LBWE.
    Hope this helps.
    Regards
    Fabrice

  • Getting error "Column is not indexed " when executing query on ORACLE 10g

    Hi all,
    When executing the below query im getting the error "ORA-20000:Column is not indexed"
    query:
    select xmlelement("nexml:result",xmlattributes('http://namespaces.nextance.com/nex/xml' as "xmlns:nexml"),xmlelement("nexml:value",count(*))).getClobVal()
    from "permission"
    where ( ((contains(object_value,'(searchDocument) inpath(/permission/action)') > 0)) and ((existsNode(object_value,'/permission[resource/resourcekey/@type[. = "document"]]') = 1)) and ((contains(object_value,'(GeneralUser) inpath(/permission/principal/@name)') > 0)) and ((existsNode(object_value,'/permission[principal/@type[. = "group"]]') = 1)) and ((existsNode(object_value,'/permission[type[. = "allow"]]') = 1)) and ((contains(object_value,'(nexip) inpath(/permission/resource/resourcekey/field/@value)') > 0) or (contains(object_value,'(Corporate) inpath(/permission/resource/resourcekey/field/@value)') > 0) or (contains(object_value,'(ProcurementAgreement) inpath(/permission/resource/resourcekey/field/@value)') > 0) or (contains(object_value,'(Procurement) inpath(/permission/resource/resourcekey/field/@value)') > 0) or (contains(object_value,'(SalesAgreement) inpath(/permission/resource/resourcekey/field/@value)') > 0)) )
    Then after checking some forum, i replaced "contains" with "ora:contains" and executed the query. Now im not getting the first error but got a new error "invalid relational operator"
    So please help me in resolving the errors?
    Thanks in advance.

    Anil kumar wrote:
    Hi,
    Thanks for your reply. Could you please explain your solution in detail?Hi,
    I just have a try...
    create table t (id int,my_lob clob)
    begin
    insert into t values(101,'Oracle redwood shores USA');
    insert into t values (102,'HP palo alto USA');
    insert into t values(103,'Capgemini  FRANCE');;
    end;
    create index my_idx on t(my_lob) indextype is ctxsys.context
    select *
    from t
    where contains(my_lob,'USA',1)>0
    Output
    ID      MY_LOB
    101     Oracle redwood shores USA
    102     HP palo alto USA Hope it helps,
    CKLP

  • Virtual Key figure not getting populated

    Hi All,
    I have included a virtual key figure in a multiprovider  on which the query is created and its underlying ODS.
    This issue is the virtual key figure is not getting populated . I am not sure what I am missing
    I did the following :
    1) Tried Debugging - Put a break point and execute the query in RSRT.It  did not go to the Exit. I also tried  generating the query from RSRT.
    I am using the BADI (RSR_OLAP_BADI) to populate the Vir Key Fig.
    Please guide me.
    Thanks,
    HM

    Hi All,
    Now that I am able to get the logic to come up in debug. I am faced with another issue.
    I am implementing  avery simple logic . I added a integer type key figure to the ODS and I am tryin to assign value 1 to the the key figure in the code (I am assigning 1 just ot check if the value is passed to query or not. I do have acomplex logic tha i need to implement).
    Here I am able ot see the value in the debug but in the qury the value is not populated.
    N ot sure what might be going wrong.
    code is
    l_z_avg = 1.
    <fs_zavglate> = l_z_avg .
    Appreciate help.
    Thanks,
    HM

  • Virtual Key Figures in RSR_OLAP_BADI not re-calculated correctly

    Hello BW/BI Experts!
        Please clarify why is the COMPUTE METHOD of RSR_OLAP_BADI not triggered or executed
    if you remove a drilldown to a certain characteristic.
        For instance, my query is drilled down by customer and material by default. Upon
    opening the query and after entering the appropriate selections, the virtual key figures
    that I have used in the query are correct .
        However, if you remove the drilldown by customer(for example), the virtual key figure
    is not re-computed. I was able to verify this by setting break-point in the COMPUTE
    method. However, if you drilldown by customer again, the re-calculation for the virtual
    key figure is correct likewise, if you refresh query, the results will be correct.
         Is this really the normal behavior of the said BADI? Why is it unstable? If I will
    use RSR00002(the user exit version), will I not have the same issue?
    Thanks in Advance!

    If I will use RSR00002(the user exit version), will I not have the same issue?
    I dont see any reason why this wouldnt behave the same way.
    I assume from ur post that you need to read ur customer and material to derive ur virtual KF in the BAdi. When you remove the drilldown the customer value is no more available for the exit to calculate  the KF, thats when it throws out a wrong number. I havent seen a work around for this. Please update the form if you find a solution to get the customer values into the exit even after removing the drill down.

  • Virtual key figures problem?

    Hi Gurus,
    what is Virtual key figures? at what scenerio you go for that.
    please guide me ASAP.
    In advance i appreciate you
    RK

    Hi
    Virtual key figures are used when you want to determine the value of a key figure at runtime , the key figure is not populated in the load process ie its value is not stored in the cube. The logic for populating the keyfigures is written in an SAP Exit RSR00002.
    Since the values are computed at run time, it affects the query performance if you have too many VKF or too many records in your cube.
    There is a how to guide on the steps for working with virual key figures/ characteristics.
    To give an example suppose you need an aging report where you want to show how many orders are delayed by 30 days , how many 30 to 60 days and so on based on todays date, So this number needs to change dynamically based on the date the report is run , you could use VKF in this scenario...There might be other ways of doing but just giving an example to explain the concept.

  • Virtual Key Figures in RSR_OLAP_BADI COMPUTE Method not recalculated

    Hi,
    Please clarify why is the COMPUTE METHOD of RSR_OLAP_BADI not always 
    triggered or executed.
    For instance, my query is drilled down by customer and
    material by default. Upon opening the query and after entering
    the appropriate selections, the virtual key figures that I have
    used in the query are correct .
    However, if i make any change to the query and run it in RSRT, the BADi method COMPUTE is not executed.
    Is this really the normal behavior of the said BADI? Why is
    it unstable?

    Hi Rohit,
    I have a similar problem the compute method is not trigerring and i am trying to debug it but it is not breaking at all, although when i generate from rsrt it breaks at a breakpoint of define method however i have defined another break at compute method but not breaking.
    I am using the infoobject inside the query but and tried to hard code it  for testing in the compute method but doesnt seem to be getting executed.
    Please help.
    Cheers,
    Jad

  • BADI for populating virtual Key Figure : Exception Occurs

    Hello,
    I am using BADI for populating virtual Key Figure.
    Since my info provider in a Cube , query is built on it with addition to Virtual Key figure.
    I have used select statement for retrieving data from cube as input for the variables in BADI.
    But after debugging it , it stop or exception occurs at the select statement.
    Need help for the same.
    My code :  Cube name : ZGMR_C01
    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.
    Insert Code
      CASE i_s_rkb1d-infocube.
        WHEN 'ZGMR_C01'.
          l_s_chanm-chanm = 'ZEC_PLOAD'.
          l_s_chanm-mode = rrke_c_mode-read.
          APPEND l_s_chanm TO c_t_chanm.
          l_s_chanm-chanm = 'ZCOM_BLM'.
          l_s_chanm-mode = rrke_c_mode-read.
          APPEND l_s_chanm TO c_t_chanm.
          APPEND 'ZVKF_TTBL' TO c_t_kyfnm.
      ENDCASE.
    endmethod.
    DEFINE ******
    COMPUTE *****
    method IF_EX_RSR_OLAP_BADI~COMPUTE.
    FIELD-SYMBOLS <fs_ZVKF_TTBL> TYPE ANY.   -
    Virtual Key Figure
    FIELD-SYMBOLS <fs_ZEC_PLOAD> TYPE ANY.  -
    Variable 1
    FIELD-SYMBOLS <fs_ZCOM_BLM> TYPE ANY.   -
    Variable 2
    DATA: l_ZVKF_TTBL TYPE /BIC/OIZVKF_TTBL.
    TYPES : BEGIN OF TY_ITAB,
    PLOAD TYPE /BIC/OIZEC_PLOAD,
    BLMONTH TYPE /BIC/OIZCOM_BLM,
    TOTBL TYPE /BIC/OIZKF_TOTBL,
    END OF TY_ITAB.
    data: IT_ITAB TYPE STANDARD TABLE OF TY_ITAB,
          WA_ITAB type TY_ITAB.
    data: IT_ITAB1 TYPE STANDARD TABLE OF TY_ITAB,
          WA_ITAB1 type TY_ITAB.
    ASSIGN COMPONENT P_KYF_ZVIR_TOT OF STRUCTURE c_s_data
    TO <fs_ZVKF_TTBL>.
    ASSIGN COMPONENT P_CHA_ZVIR_POL OF STRUCTURE c_s_data
    TO <fs_ZEC_PLOAD>.
    ASSIGN COMPONENT P_CHA_ZVIR_MON OF STRUCTURE c_s_data
    TO <fs_ZCOM_BLM>.
    break-point id z_routines.
    SELECT  /BIC/DZGMR_C011SID_ZEC_PLOAD  /BIC/DZGMR_C01TSID_0CALMONTH /BIC/VZGMR_C01F~/BIC/ZKF_TOTBL
    FROM /BIC/VZGMR_C01F
    INNER JOIN /BIC/DZGMR_C011 ON /BIC/VZGMR_C01FKEY_ZGMR_C011 = /BIC/DZGMR_C011DIMID
    INNER JOIN /BIC/DZGMR_C01T ON /BIC/VZGMR_C01FKEY_ZGMR_C01T = /BIC/DZGMR_C01TDIMID
    INTO TABLE IT_ITAB
    WHERE /BIC/DZGMR_C011~SID_ZEC_PLOAD = <fs_ZEC_PLOAD>
    AND /BIC/DZGMR_C01T~SID_0CALMONTH = <fs_ZCOM_BLM>.
    break-point id z_routines.
    LOOP AT IT_ITAB INTO WA_ITAB.
    WA_ITAB1-PLOAD = WA_ITAB-PLOAD.
    WA_ITAB1-BLMONTH = WA_ITAB-BLMONTH.
    WA_ITAB1-TOTBL = WA_ITAB-TOTBL.
    COLLECT WA_ITAB1 INTO IT_ITAB1.
    CLEAR : WA_ITAB1 , WA_ITAB.
    ENDLOOP.
    break-point id z_routines.
    IF sy-subrc EQ 0.
    <fs_ZVKF_TTBL> = WA_ITAB1-TOTBL.
    endif.
    endmethod.
    COMPUTE *****

    Exception :
    Exception CX_SY_NO_HANDLER triggered
    An exception with the type CX_SY_OPEN_SQL_DB occured, but was not handled
    This comes when i debug the BADI.

  • Virtual Key Figures-  RSRT says Key Figures are not valid

    Hi,
    Getting the following mssg when I try to generate a query in RSRT for the first time after I have coded Virtual Key Figures.
    For the characteristic that I am pulling the user entered data from:
    /BIC/ZNEWEST is not a valid characteristic for InfoProvider 0QM_C08
    Message no. BRAIN122
    Diagnosis
    "Customer enhancement RSR00002 or the implementation of BAdI RSR_OLAB_BADI delivers /BIC/ZNEWEST as the characteristic to be calculated. 1. is however not a valid key figure for Infoprovider 0QM_C08.
    System response
    /BIC/ZNEWEST is ignored.
    Procedure
    Check the exit."
    From the key figure I am using this info to populate value:
    "/BIC/ZKF3 is not a valid key figures for InfoProvider 0QM_C08
    Message no. BRAIN121
    Diagnosis
    Customer enhancement RSR00002 or the implementation of BAdI RSR_OLAB_BADI delivers /BIC/ZKF3 as the key figure to be calculated. 1. is however not a valid key figure for Infoprovider 0QM_C08 or /BIC/ZKF3 references the key figure . In this case, the basic key figure l  is enough to calculate in the exit.
    System response
    /BIC/ZKF3 is ignored.
    Procedure
    Check the exit."
    Any help would be appreciated.
    This is my first time using Virtual KF's.
    Thanks,
    Brandon

    Hi Ajay,
    Here is my code:
          FORM user_0QM_C08                                            *
    -->  L_S_RKB1D                                                      *
    -->  C_S_DATA                                                       *
    FORM user_0QM_C08 USING l_s_rkb1d   TYPE rsr_s_rkb1d
                         CHANGING c_s_data TYPE any.
    *-- Local data
      DATA: l_n TYPE n,
            FIN1 like /bic/azqm_O5000-/BIC/ZPFINNT,
           FIN2 like /bic/azqm_O5000-/BIC/ZPFINNT,
           STAR1 like /bic/azqm_O5000-/BIC/ZPFINNT,
            STAR2 like /bic/azqm_O5000-/BIC/ZPFINNT,
            TASK type STRING.
    *-- Field Symbols
      FIELD-SYMBOLS <ZNEWEST>.
      FIELD-SYMBOLS <ZOLDEST>.
      FIELD-SYMBOLS <ZPSTARNT>.
      FIELD-SYMBOLS <ZPFINNT>.
      FIELD-SYMBOLS <ZKF3>.
      FIELD-SYMBOLS <ZKF4>.
      FIELD-SYMBOLS <0NOTIFICATN>.
    *->>> Initial checks
      SELECT SINGLE * FROM  zvir_reports
             WHERE  infocube  = l_s_rkb1d-infocube
             AND    compid    = l_s_rkb1d-compid.
      CHECK sy-subrc IS INITIAL.
    *->>> Prepare the structure
      ASSIGN COMPONENT g_pos_0QM_C08_ZNEWEST
        OF STRUCTURE c_s_data TO <ZNEWEST>.
      ASSIGN COMPONENT g_pos_0QM_C08_ZOLDEST
        OF STRUCTURE c_s_data TO <ZOLDEST>.
      ASSIGN COMPONENT g_pos_0QM_C08_ZPSTARNT
        OF STRUCTURE c_s_data TO <ZPSTARNT>.
      ASSIGN COMPONENT g_pos_0QM_C08_ZPFINNT
        OF STRUCTURE c_s_data TO <ZPFINNT>.
      ASSIGN COMPONENT g_pos_0QM_C08_0NOTIFICATN
        OF STRUCTURE c_s_data TO <0NOTIFICATN>.
    *~~~>Changeable
      ASSIGN COMPONENT g_pos_0QM_C08_zKF3
        OF STRUCTURE c_s_data TO <ZKF3>.
      ASSIGN COMPONENT g_pos_0QM_C08_zKF4
        OF STRUCTURE c_s_data TO <ZKF4>.
    *do not go thru code if user fields are blank.
      IF <znewest> IS INITIAL OR <zoldest> IS INITIAL.
      Exit.
      Endif.
    *-->>> Read general data
      CLEAR: /BIC/AZQM_O5000, FIN1, FIN2, STAR1, STAR2, TASK.
      TASK = 'SCM'.
    get Start1 time
      SELECT /BIC/ZPSTARNT   FROM  /bic/azqm_O5000 INTO STAR1
             WHERE  notificatn        EQ <0NOTIFICATN>
             AND    /bic/ZNEWEST      EQ <ZNEWEST>.
      ENDSELECT.
    Get Finish1 time
      SELECT /BIC/ZPFINNT   FROM  /bic/azqm_O5000 INTO FIN1
             WHERE  notificatn        EQ <0NOTIFICATN>
             AND    /bic/ZNEWEST      EQ TASK.
      ENDSELECT.
    Get Finish2 time & Start2 time
      SELECT /BIC/ZPFINNT /BIC/ZPSTARNT FROM  /bic/azqm_O5000 INTO (FIN2 ,
    STAR2)
             WHERE  notificatn        EQ <0NOTIFICATN>
             AND    /bic/ZOLDEST      EQ <ZOLDEST>.
      ENDSELECT.
    *- Update key figures
      <zKF3>  = abs( FIN1 - STAR2 ).
      <zKF4>  = abs( STAR1 - FIN2 ).
    ENDFORM.                    "user_0QM_C08
    Thx

  • 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

  • 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

  • Virtual Key Figures - How are they triggered?

    HI,
    I am trying to implement the Virtual Key Figure user-exit. I have created all the necessary coding and activated the user-exit.
    My cube contains data but the VKF in question has not been populated with any data because I have set the update rules to "NO UPDATE", so the VKF is completly empty.
    I've defined my query to use the VKF, but when I execute it, the user-exit is not triggered.
    <b>How does BW determine if a query should call the user-exit?</b> I though it was to do with creating the variables in ZXRSTOP in line with the cube/kf name as I have done (<b>DATA: g_pos_0IC_C03_zfcstwk   TYPE i.</b>).
    I'm using BW 3.5 by the way if this makes any difference.
    Here is the code I have created in the various includes:
    <u><b>ZXRSTOP</b></u>:
    *   INCLUDE ZXRSRTOP                                                   *
    DATA  g_pos_0ic_c03_fcstwk.
    **Global fields for virtual characteristics -                          *
    DATA: g_pos_0IC_C03_0plant   TYPE i.
    DATA: g_pos_0IC_C03_0material   TYPE i.
    DATA: g_pos_0IC_C03_0calday   TYPE i.
    DATA: g_pos_0IC_C03_zfcstwk   TYPE i.
    * End Program ZXRSRTOP                                                 *
    <u><b>ZXRSRZZZ</b></u>:
    * Includes for specific subroutines for each avriable
    Include: zxrsrf01,     "Common Subroutines
               zxrsrf02,     "Fiscal Period / Year Variables
               " zxrsrf05,     "Fill selections from Variable value table
               zxrsrf04.     "Fill virtual chars + KF
    FORM USER_0IC_C03 USING i_s_rkb1d TYPE rsr_s_rkb1d
      CHANGING c_s_data TYPE any.
      DATA: lsgid LIKE i_s_rkb1d-genuniid. "query ID
    * Define ODS temp table
      DATA: l_zic_forc_itab LIKE STANDARD TABLE OF /bic/azic_forc00.
    * Define cooresponding work area
      DATA: l_zic_forc_wa LIKE /bic/azic_forc00.
    * field symbols definitions
      FIELD-SYMBOLS <l_plant>.
      FIELD-SYMBOLS <l_material>.
      FIELD-SYMBOLS <l_calday>.
      FIELD-SYMBOLS <l_zfcstwk>.
      CASE i_s_rkb1d-infocube.
        WHEN '0IC_C03'.
    *      Which Query are we deriving for ?.
          CASE i_s_rkb1d-compid.
            WHEN 'Z0IC_STKVAL'  OR
                 'Z0I_EXP_DAT' OR
               'Z0IC_PCM_STKVAL'.
    *          Assign object values to field symbols
              ASSIGN COMPONENT g_pos_0ic_c03_0plant
                OF STRUCTURE c_s_data TO <l_plant>.
              ASSIGN COMPONENT g_pos_0ic_c03_0material
                OF STRUCTURE c_s_data TO <l_material>.
              ASSIGN COMPONENT g_pos_0ic_c03_0calday
                OF STRUCTURE c_s_data TO <L_CALDAY>.
              ASSIGN COMPONENT g_pos_0ic_c03_zfcstwk
                OF STRUCTURE c_s_data TO <l_zfcstwk>.
              SELECT * INTO TABLE l_zic_forc_itab
                 FROM /bic/azic_forc00
                 WHERE material = <l_material>
                   AND plant = <l_plant>.
              IF sy-subrc NE 0.
    *             no sort required
              ELSE.
    * Fill the VKF by reading the itab and locating the first record that exists >= 0calday
                SORT l_zic_forc_itab BY calday ASCENDING.
                LOOP AT l_zic_forc_itab INTO l_zic_forc_wa
                        WHERE calday <= <l_calday>.
                  IF sy-subrc EQ 0.
                    <l_zfcstwk>  = ''.
                  ELSE.
                    <l_zfcstwk>  = l_zic_forc_wa-/bic/zfcstwk.
                    EXIT.
                  ENDIF.
                ENDLOOP.
              ENDIF.
          ENDCASE.
      ENDCASE.
    ENDFORM.                    "user_0IC_C03
    * End Program ZXRSRZZZ                                                 *
    <u><b>ZXRSRU02</b></u>:
    * ZXRSRU02    Exits for Virtual chars and Key Figs                    *
    DATA: l_s_chanm TYPE rrke_s_chanm.
    DATA: l_s_kyfnm TYPE rsd_kyfnm.
    *   Which cube are we deriving for ?.
    DATA: l_stop(1) TYPE c VALUE 'Y'.
    WHILE l_stop = 'Y'.
    ENDWHILE.
    CASE i_s_rkb1d-infocube.
      WHEN '0IC_C03'.
    *        Which Query are we deriving for ?.
        CASE i_s_rkb1d-compid.
          WHEN 'Z0IC_STKVAL'  OR
               'Z0I_EXP_DAT' OR
               'Z0IC_PCM_STKVAL'.
    *             set up the chars to be used or abused. (based on mode)
            l_s_chanm-chanm = '0MATERIAL'.
            l_s_chanm-mode  = rrke_c_mode-read.
            APPEND l_s_chanm TO e_t_chanm.
            l_s_chanm-chanm = '0PLANT'.
            l_s_chanm-mode  = rrke_c_mode-read.
            APPEND l_s_chanm TO e_t_chanm.
            l_s_chanm-chanm = '0CALDAY'.
            l_s_chanm-mode  = rrke_c_mode-read.
            APPEND l_s_chanm TO e_t_chanm.
            l_s_kyfnm = 'ZFCSTWK'.
            APPEND l_s_kyfnm TO e_t_kyfnm.
        ENDCASE.
    ENDCASE.
    * End Program ZXRSRU02                                                 *

    hi Peter,
    try to check with RSRT, put in your query technical name,
    and click 'technical information', check info on 'virtual char/keyfigures', it should have 'Y' and a list of virtual char/kf. and also check 'execute+debug', mark checkbox 'display sql', after that check the sql statement if your virtual kf is in select statement.
    try in RSRT menu 'environment'->delete old abaps.
    if you want the virtual kf only run for certain query,
    you can restrict in ZXRSRZZZ, using
    if I_S_RKB1D-compid = 'your query technical name'.
    ... your logic for virtual kf ...
    endif.
    hope this helps.

  • 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.

Maybe you are looking for