Skip to Content

Using Virtual Key Figure and Characteris in an InfoSet

Using Virtual Key Figure / Characteristics in an InfoSet


</p>h5. Virtual Key Figures(VKF) / Characteristics can also be used in an InfoSet. An example here to demonstrate is as follows:

Example: The InfoSet ( ZV_IS1) is based on two ODSs (Product-ZV_OPD and Shipper-ZV_OSHPR) . The requirement is to create a virtual Key Figure which is a part of the Shipper ODS( ZV_OSHPR) which will filled up at runtime.
The algorithm of the calculation is a complex calculation and based on a Function Module(ZV_FMPRC1). Moreover ZV_FMPRC1 will input the Product No and Shipper Number, access database table and perform complex calculations and the output would be the required ZVPRV.

Step 4. Go to the Methods Section and Double Click on the Method . Sample code can be used by editing the required changes.

CASE i_s_rkb1d-infocube.
           WHEN ‘ZV_IS1’. ” When using the InfoSet
                           l_s_chanm-chanm = ‘ZV_IS1___F1’.
                           l_s_chanm-mode = rrke_c_mode-read.
                           APPEND l_s_chanm TO c_t_chanm.
                           l_s_chanm-chanm = ‘ZV_IS1___F37’.
                           l_s_chanm-mode = rrke_c_mode-read.
                           APPEND l_s_chanm TO c_t_chanm.

                            l_kyfnm = ‘ZVPRV’.
                            l_s_chanm-mode = rrke_c_mode-no_selection.
                            APPEND ‘ZV_IS1___F38’ TO c_t_kyfnm.
          WHEN OTHERS.

Step 5. Go to the Method and add the sample code .

You must be Logged on to comment or reply to a post.
  • Hi Noor,

    good job. I would wonder if you could explain a scenario with coding, of course, how to create a virtual characteristics.

    Is it possible to add this new infoObject only to Multiprovider, not to all of the participating InfoProviders? (so I can use in CASE WHEN ‘MYMULTIPROVIDER’)

    How to calculate and assign in method ‘IF_EX_RSR_OLAP_BADI~COMPUTE’ a value for the InfoObject (virtual) depending on combination of another real InfoObjects?

    Thank you very much for you answer or even better for coding.


    • Hi Standa,
      Sorry to reply you bit late.
      An InfoObject can be attached to a multiprovider from an Infoprovider. I could not able to think how can we can attach an InfoObject to an Multiprovider without attaching to an InfoProvider.

      To see how to use ‘IF_EX_RSR_OLAP_BADI~COMPUTE’ please see the above example.


      • Hi Noor,<br/><br/>I have followed steps defined in your white paper to use virtual key figure and I am getting a short dump when I assign the value to virtual key figure. Please advice if I’m doing something wrong. InfoObject GAOCOS is a key figure with 0CURRENCY unit.<br/> <br/>************************************************************************<br/>ShrtText<br/>    The current statement supports only numeric data objects.<br/> <br/>What happened?<br/>    Error in ABAP application program.<br/>    The current ABAP program “ZCL_IM_EOPVKF_IMPL============CP” had to be<br/>     terminated because one of the<br/>    statements could not be executed.<br/>    This is probably due to an error in the ABAP program.<br/> <br/>Error analysis<br/>    The statement<br/>      “Convert BCD to object”<br/>    supports only numeric data objects at the argument position “object”.<br/>    In this case, the operand “object” has the non-numeric data type “G_S_DATA”.<br/>     The<br/>    current program is flagged as a Unicode program. In the Unicode context,<br/>     structures that have at least one non-numeric component, are seens as<br/>    non-numeric.<br/> <br/>How to correct the error<br/>    You may able to find an interim solution to the problem<br/>    in the SAP note system. If you have access to the note system yourself,<br/>    use the following search criteria:<br/>    –

        <br/>    “UC_OBJECTS_NOT_NUMLIKE” C<br/>    “ZCL_IM_EOPVKF_IMPL============CP” or “ZCL_IM_EOPVKF_IMPL============CM003″<br/>    “IF_EX_RSR_OLAP_BADICOMPUTE”<br/>    –

        <br/>    If you cannot solve the problem yourself and you wish to send<br/>    an error message to SAP, include the following documents:<br/>    1. A printout of the problem description (short dump)<br/>       To obtain this, select in the current display “System->List-><br/>       Save->Local File (unconverted)”.<br/>    2. A suitable printout of the system log<br/>       To obtain this, call the system log through transaction SM21.<br/>       Limit the time interval to 10 minutes before and 5 minutes<br/>       after the short dump. In the display, then select the function<br/>       “System->List->Save->Local File (unconverted)”.<br/>    3. If the programs are your own programs or modified SAP programs,<br/>       supply the source code.<br/>       To do this, select the Editor function “Further Utilities-><br/>       Upload/Download->Download”.<br/>    4. Details regarding the conditions under which the error occurred<br/>       or which actions and input led to the error.<br/>Information on where terminated<br/>    The termination occurred in the ABAP program “ZCL_IM_EOPVKF_IMPL============CP”<br/>     in “IF_EX_RSR_OLAP_BADI
        COMPUTE”.<br/>    The main program was “WRITEQUERY_NEU “.<br/>    The termination occurred in line 47 of the source code of the (Include)<br/>     program “ZCL_IM_EOPVKF_IMPL============CM003″<br/>    of the source code of program “ZCL_IM_EOPVKF_IMPL============CM003” (when<br/>     calling the editor 470).<br/> <br/>Source Code Extract<br/>Line  SourceCde<br/>   37 field-symbols: <fs_gaocos> type any.<br/>   38<br/>   39 data: l_gaocos type i.<br/>   40<br/>   41   if not fiscper is initial and not company is initial.<br/>   42     assign component p_kyf_gaocos of structure c_s_data to <fs_gaocos>.<br/>   43   endif.<br/>   44<br/>   45 l_gaocos = 323232.<br/>   46<br/>>>>>>    <fs_gaocos> = l_gaocos.<br/>   48<br/>   49 endmethod.<br/> <br/>
        **********************************************************************************<br/> <br/>Appreciate your response in this regard.<br/> <br/>Thanks,<br/>Raj<br/>

  • This is a great example of how you can calculate virtual key figures.

    I followed your example.
    When I run my query however, I get the following error:

    The initial exception that caused the request to fail was:

    Subfield access of structure without character-type initial part$Exception: (104) RFC_ERROR_SYSTEM_FAILURE: Subfield access of structure without character-type initial part

    Details: Full Exception Chain

    Do you know what I am doing wrong?

    Thank you

  • the code for this does not work.

    in my BW system the structure of c_s_data does not contain any components with names like ZINFOSET___FXXX…all I see in c_s_data when I debug are wiered component names like S___5467 (or c_s_data-S___5467 for characteristics, Z_6375 for keyfigures, etc.
    So, none of the field symbols get assigned correctly cause it cannot find my fields in c_s_data.