Use the @Variable function in an SQL expression (usually in the WHERE clause) to retrieve the value assigned to a system variable or user attribute.
The syntax of the @Variable function is:
- @Variable('<Variable name>')
- <Variable name> must be in single quotes.
The @Variable function is allowed in the following expressions:
- Joins
- Calculated columns
- Derived tables
- Object definitions in the business layer
- BEGIN_SQL and END_SQL statements
Business Example: Motors
As the developer of the Motors universe, you have a new business requirement to ensure that users can only see data for the specific countries they are authorized to view.
For example, the user train-01 is only authorized to view sales data for French customers.
Prepare the Security Table in the Database
To meet this requirement, your database administrator (DBA) creates a security table to map user IDs to specific regions. A best practice is to use numeric IDs for relationships instead of text fields. This improves performance and data integrity.
Let's call the table COUNTRY_AUTHORIZATIONS.
| USER_ID | COUNTRY_ID | COUNTRY_NAME |
|---|---|---|
| TRAIN-01 | 1 | FRANCE |
| TRAIN-02 | 33 | USA |
| TRAIN-03 | 49 | GERMANY |
Update the Data Foundation
In the data foundation, an alias of the COUNTRY table named COUNTRY_CLIENT has already been created. Your objective is to link the new security mapping table to the is existing alias to enable filtered access
Insert the COUNTRY_AUTHORIZATIONS table. Locate the existing alias table named COUNTRY_CLIENT. Create a join between the COUNTRY_CLIENT alias and the COUNTRY_AUTHORIZATIONS table: COUNTRY_CLIENT.COUNTRY_ID = COUNTRY_AUTHORIZATIONS.COUNTRY_ID.

Create the Restricted Dimension Object
Create a secured dimension in the business layer using the COUNTRY_CLIENT alias and the COUNTRY_AUTHORIZATIONS table. This setup makes sure security is always applied when you access the data.
You create this dimension object as follows:
- Name: Client Country
- Type: Dimension
- Select: COUNTRY_CLIENT.COUNTRY_NAME
- Where: COUNTRY_AUTHORIZATIONS.USER_ID = @variable('BOUSER')
The @variable('BOUSER') function dynamically retrieves the User ID that the person used to log into the SAP BusinessObjects BI Launch Pad. When a query runs, SAP BusinessObjects replaces @variable('BOUSER') with your actual User ID, such as train-01.

Testing the Result in a Report
The user train-01 logs into the BI Launch Pad and opens a reporting application like Web Intelligence. He creates a new query using the Motors universe and drags the Client country object and other objects (like Client name or Sales revenue) into the query.
Because the Client country object includes a specific WHERE clause referencing the security table, the generated SQL statement will automatically include the security join path.
For user train-01, the system generates a condition similar to the following:
WHERE COUNTRY_AUTHORIZATIONS.USER_ID = 'train-01'
Through the join between COUNTRY_CLIENT and COUNTRY_AUTHORIZATIONS, this filter restricts all data coming from the COUNTRY_CLIENT context. As a result, the user train-01 will only see data related to French customers, exactly as required.
Note
Let's Summarize What You've Learned
- Dynamic Filtering: The @Variable function allows you to inject system-level information directly into SQL for personalized data delivery.
- Row-Level Security: By joining a security table and using @Variable('BOUSER'), you ensure users only see data they are authorized to view. .
- Object-Based Enforcement: Adding security logic to the WHERE clause of a dimension object ensures that security is consistently applied across all reports.