This example was created to show how to use an authorization variable for a query. This authorization variable will check the current user that is executing the query and display only the values that he is authorized.
So let's start.
First take a look on all the data inside the InfoCube :
Here you can see that we have values for 2 countries : BR and US. In this example we will make an user only be able to see values for BR and another one for US.
The first step is to create both users. Remember to add the necessary authorizations to be able to execute queries and access transactions like RSRT. For more information on this check this note : 177875
After creating the two users we will need to create the analysis authorization objects that will be assigned to each user. For the first user that will only be able to see country BR we will assign this authorization object ZBL_ACTR :
A good reminder : Even if in your system the objects 0TCAACTVT, 0TCAIPROV and 0TCAVALID are not authorization relevant, edit them to make them authorization relevant and add them in some of the Analisys Authorization object, or else you might face the following error message during query execution :
Message EYE001: You do not have sufficient authorization for InfoProvider XXXXXXX with activity 03
Inside the 0Country we will have only the follwing value :
This analysis authorization object will be added to the first user → ZBLTEST
Now for the second analysis authorization → ZBL_ACTR2
It looks the same as ZBL_ACTR, the difference is the value for 0Country :
And this one will be assigned to our second user → ZBLTEST2
Now, we already have two users and two analysis authorization objects. Let's make our authorization variable in our query.
Since we don't want the user to be able to change this variable in the variable screen, we will set this variable as a Default Value.
So in query designer, go to the Filter tab, add the 0Country, right click and select Restrict.
In the pop up window, select Show → Variables, and click on the icon for create
Give a name to this variable and set Processing By → Authorization and Reference Characteristic → 0Country
Then add this variable to the chosen selections by clicking in the arrow :
Ok, now it is set. Just save the query and let's check the results in transaction RSRT.
If we execute as user ZBLTEST, we will only get values for BR :
If we execute as user ZBLTEST2, we will only get values for US :