How to write BW Customer exit to enhance BEx variables

Here I will site an example of how to enhance a BEx variable using BW customer exit.

More details and insightful examples can be accessed in my ebook BEx variable enhancement by Customer Exit.

Display only two years of data in the BEx query

Scenario: Displaying only two years data in the BEx query based on the system date. The BEx query is based on a cube having 5 years of data.

Method:

Create a variable for calday or any time characteristic present in the cube.

I am taking 0calday as an example. SAP provides standard variables also to serve the same purpose. Here I will create a customer exit variable to illustrate the method.

Let the variable name is VAR2

This variable should be Interval value and mandatory.

There is no user input required when the query is accessed. Hence the BEx variable should not be “Ready for Input”.

Based on the system date, an Interval of two years will be calculated. For example, if system date is 24th Feb, 2017, the BEx query should display 2016 and 2017 data.

Drag and drop this variable in the filter section of the query.

Save the query.

Now go to the CMOD transaction and select your project. The project is generally provided by the client and should not be created by the developer. Click Display.

Click on the “components” button and then double click on the Function exit EXIT_SAPLRRS0_001

Double click on Include file name to go into the coding area.

Write the following code: Continue reading →

Use of TVARVC table in BW customer exit variable

The TVARVC table serves very handy when we have to do a dynamic selection in BEx queries based on some condition which can change in future.

Usually we write customer exit variable in the query which is filled when the query is being executed.

This customer exit variable can take up any value depending upon the user requirement like Continue reading →