Showing results for 
Search instead for 
Did you mean: 

Virtual Keyfigures

Former Member
0 Kudos

Where/ How do I create a virtual Key figure? Is it in RSD1 or in the query designer? Also, if I create a VKF and add it to my colums in my query, will it apply the logic for each line in my data set or will it execute the logic once and apply the resutl to every row?

Please help!!!

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos


Virtual key figures are key figures within an InfoProvider that are not filled with data. Instead the key figure value is determined at runtime of the query using custom ABAP coding.Please see the following links.


Answers (3)

Answers (3)

0 Kudos


You can create VKFs using standard BW user exits also.

Step 1: Define characteristics and key figures. You need to define the characteristics and key figures infoobjects which you intend to use having the required properties similar to defining the standard infoobjects.

Step 2: Allocate the objects to the InfoCube. The characteristics need to be included in the infocube under the appropriate dimensions.

Step 3: Maintain user exits. User exits are where the ABAP code is added to calculate virtual key figures at query runtime.

Use transaction CMOD to create a project, and assign and activate enhancements RSR00001(Definition of virtual characteristic and key figure) and RSR00002(Customer exit global variables in reporting) to the project

Step 4: Create query-Similar to normal query

Step 5: Write the ABAP Program

The ABAP program has different parts:

Declare global values for each virtual characteristic and key figure (program ZXRSRTOP).

Make virtual field settings (program ZXRSRU02)

Program the code to calculate the virtual figures per InfoCube record (program ZXRSRZZZ).

The ABAP code is processed for every info cube record.

Hope this helps,


Former Member
0 Kudos


thanks for the information but I'm still stuck. I've created the kf and added it to my infoprovider. I went to se18 to try and create the BADI but I'm stuck here. I looked at RSR_OLAP_BADI but I don't see where I can display the code so that I can use as a reference. Is there another way I can create my code without using a BADI?

Former Member
0 Kudos


It looks like there is already a project in my system whic includes the two enhancements. In this case what do I do?

Also, there is some confustion because in step 3 you say write the user exit and you say to do this again in step 5.

Please advise

Former Member
0 Kudos

I recommend you to use BADI instead UserExit (cmod).

You dont need create BADI you must create you implementation.

SE18>(BADi Name = RSR_OLAP_BADI)>View>Implementation->Create.

And only one method you must rewrite - COMPUTE method.

search example on the forum.

Former Member
0 Kudos

VKF - standart KF, which filling when execute query. Logic will apply to each line of data.

goto SE18 and create you own implementation of RSR_OLAP_BADI.

in SE18 you can see some example if there exist. (SE18>(BADi Name = RSR_OLAP_BADI)>Implementation--->Overview).

sorr for bad eng.

Active Contributor
0 Kudos

You can create Virtual Key Fig in BADI. For this you need to go to transaction <b>SE19</b>

In this transaction you can create a new or display the existing <b>BADI</b>.

There you can see two tabs

The <b>Attribute Tab</b> we need to give the name of the Multiprovider on which the query with the virtual key fig is getting executed.

The <b>Inerface Tab</b> has three following sections. Need to write the ABAP code for al the three.

<b>Define</b> : Defind all the characteristics and virtual key fig that will be used for virtual Key Fig calculation

<b>Initialize</b> : Initialize them

<b>Compute</b> : Here you will have to write the logic for calculating the virtual key fig.

Once the logic is written then you can use this key fig in your query . It will apply the logic to each row