Skip to Content

Introduction

From time to time in various projects customers have the following, and without doubts seem as very simple and regular, requirement: to restrict the values which are shown on F4 in BEx query according to some business logic.

The first reaction to such requirement – “use authorizations concept” – obviously miss the fact that it does not give full response to the requirement as well as it does not restrict F4 values at all.

Actually, there are some workarounds. However all of them could be used only in WAD, but not in BEx parameters screen.

Since BI 7.01 SP 09 (SAP Note 1416952) we can use BADI RSR_VARIABLE_F4_RESTRICT that supposed to restrict F4 values which are shown in BEx parameters screen.

 

Goal

In this article I’d like to show how to control F4 values in BEx query according to some simple logic using this BADI.

 

Implementation

I’d like to follow the next simple scenario: some users are restricted in their authorizations to some planning versions and they want to select in F4 only allowed values.

As a part of the solution there is some DSO (for example ZOMT_F4) that contains links between users ID and allowed planning versions (according to authorizations). Only these values should be shown on F4 according to use ID although there are many other values of planning versions.

Figure 1 – DSO with links between user ID and version

 

The final result should be as shown below (if I logged in as a user Z) – only 3 planning versions (which are linked to user Z in DSO) are shown in the parameter screen.

Figure 2 – F4 Screen

 

First, we need to create some class, for example ZBW_F4_RESTRICTIONS, with two interfaces:  IF_BADI_INTERFACE and IF_RSR_VARIABLE_F4_RESTRICT.

Figure 3-The Class

 

Then, create BADI implementation via SE19.

Figure 4-The Implementation

 

In the implementing class field put ZBW_F4_RESTRICTIONS.

Figure 5-Implementing Class

 

In the filter values put your info object technical name (in our example planning version).

Figure 6-The Filter

 

In the next step go to method GET_RESTRICTION_FLAT and add the following code.

Figure 7-The Code

This code will be executed only for variable “YOUR VARIABLE” and restrict planning version values by user ID according to the values in a DSO, so only these values will be shown at F4 in BEx query.

In addition there are some nice features in the BADI such as possibility to figure out which query/info provider/info object is executed, setting F4 mode (M, A or D), restricting hierarchy nodes etc.

To report this post you need to login first.

3 Comments

You must be Logged on to comment or reply to a post.

  1. R. Lijkwan

    Hi Andrey,

    Thanks for your post. I have implemented the GET_RESTRICTION_NODE method successfully, however, when debugging it seems that the code is run multiple times (i.e. not only when I press F4 or the F4 help button in the variable screen). When opening the query it runs 6 times or so, and when I click on the F4 button it runs 5-6 times as well.

    My implementation works as expected but is giving me a performance issue because of the delay of running it 12 times.

    Do you know why this is?

    Thanks! R

    (0) 

Leave a Reply