Skip to Content
author's profile photo
Former Member

Virtual Key Figure Issue

Hi,

I am using a virtual key figure to count the number of email answered within 48 hrs.

Can any one tell me where is the code for virtual key figure written?

now i will tell you what my requirement is

Suppose in the report, I am checking for e-mail count for date range 01/01/2007 to 01/31/2007

then the (email time recieved - email time replied) should be less than 48 hrs

also if Sunday comes in between while calculating then

(email time recieved - email time replied + 24hrs) should be less than 48 hrs

how to do this using virtual key figue? Where to write the code?

Also is there any other alternate approach for the same.

Thanks.

Rakesh

Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

2 Answers

  • author's profile photo
    Former Member
    Posted on Sep 27, 2007 at 05:29 AM

    Rakesh,

    Virtual characteristics and Key figures are useful if you want to dynamically pouplate data from the fact table to the field which doesn't have any data in the fact table and also used to build an internal security model before the data gets passed to DATA_PROVIDER.

    You create virtual keyfigure just like create normal keyfigure (RSD2),

    populate not via transformation/transfer/update rules, but when query execution via user exit take a look

    virtual-characteristic-problem

    virtual-key-figure

    http://www.bwexpertonline.com/downloads/Nissen.doc

    User Exit Virtual Characteristics and Key figures

    Example:

    InfoCube DEMOCUBE has the characteristic PRODUCT PRICE_TP and the key figure ACT_PRICE and QUANTITY. In the enhancement, the product from the current price for PRODUCT and the key figure QUANTITY should be determined. If successful, the characteristic PRICE_TP should contain the characteristic value '1'.

    The include ZXRSRU02: Definition

    INCLUDE ZXRSRU02

    DATA: L_S_CHANM TYPE RRKE_S_CHANM.

    CASE I_S_RKB1D-INFOCUBE.

    WHEN 'DEMOCUBE'.

    L_S_CHANM-CHANM = 'PRODUCT'.

    L_S_CHANM-MODE = RRKE_C_MODE-READ.

    APPEND L_S_CHANM TO E_T_CHANM.

    L_S_CHANM-CHANM = 'PRICE_TP'.

    L_S_CHANM-MODE = RRKE_C_MODE-NO_SELETION.

    APPEND L_S_CHANM TO E_T_CHANM.

    APPEND 'ACT_PRICE' TO E_T_KYFNM.

    APPEND 'QUANTITY' TO E_T_KYFNM.

    ENDCASE.

    The include ZXRSRTOP: global data

    INCLUDE ZXRSRTOP .

    DATA: G_POS_DEMOCUBE_PRODUCT TYPE I.

    DATA: G_POS_DEMOCUBE_PRICE_TP TYPE I.

    DATA: G_POS_DEMOCUBE_ACT_PRICE TYPE I.

    DATA: G_POS_DEMOCUBE_QUANTITY TYPE I.

    The Include ZXRSRZZZ: Changing the data

    INCLUDE ZXRSRZZZ .

    FORM USER_DEMOCUBE USING I_S_RKB1D TYPE RSR_S_RKB1D

    CHANGING C_S_DATA TYPE ANY.

    FIELD-SYMBOLS <L_PRODUCT>.

    FIELD-SYMBOLS <L_PRICE_TP>.

    FIELD-SYMBOLS <L_ACT_PRICE>.

    FIELD-SYMBOLS <L_QUANTITY>.

    ASSIGN COMPONENT G_POS_DEMOCUBE_PRODUCT

    OF STRUCTURE C_S_DATA TO <L_PRODUCT>.

    ASSIGN COMPONENT G_POS_DEMOCUBE_PRICE_TP

    OF STRUCTURE C_S_DATA TO <L_PRICE_TP>.

    ASSIGN COMPONENT G_POS_DEMOCUBE_ACT_PRICE

    OF STRUCTURE C_S_DATA TO <L_ACT_PRICE>.

    ASSIGN COMPONENT G_POS_DEMOCUBE_QUANTITY

    OF STRUCTURE C_S_DATA TO <L_QUANTITY>.

    • Routine to get the price

    • PERFORM GET_PRICE USING <L_PRODUCT>

    • CHANGING <L_ACT_PRICE>.

    IF <L_ACT_PRICE> GT 0.

    <L_ACT_PRICE> = <L_ACT_PRICE> * <L_QUANTITY>.

    <L_PRICE_TP> = '1'.

    ENDIF.

    ENDFORM.

    hope this helps...

    ********Assign Points if it helps**********

    Thanks

    Gattu

    Add comment
    10|10000 characters needed characters exceeded

  • Posted on Sep 28, 2007 at 03:45 AM

    Can you plaese expalin me w.r.t the scenario that i have provided?

    Thanks,

    Rakesh pattani

    Add comment
    10|10000 characters needed characters exceeded