Introduction

Value helps for selections and navigations are on the one hand very simple but on the other hand could get very complex. One example is implementing context specific filtering. The aim of context filtering is to provide only those values to the users that are meaningful for his or her reporting needs and could speed up users analytics tasks.

Examples for restricted value help are:

  • Restriction to authorized values
  • Restriction to only posted values
  • Cascading filtering
  • Special context-based filtering

A restriction to only authorized values is very helpful especially selecting data that won’t be shown to the user due to lack of authorization. In SAP BW Bex we most likely achieve this with authorization variables.

Restriction to only posted values shows simply only values that also could be found in transactional data the user is currently accessing. In SAP BW Bex we can activate this behavior at least on query level separately.

One step further is cascading filtering. In this case a filter includes indirectly the filter values of another filter for restricting his values. The included filter acts like a prefilter and restricts the value help to a meaningful dataset. For instance, a user is selecting “Austria” in filter one for the “Country” object. Filter two on subobject of filter one “Region” will only show values belonging to that selection in filter one ( Vienna, Styria, Salzburg …). As a matter of fact, filter one acts as a prefilter for filter two in a semantical way. In SAP BW Bex this can be achieved in the data model with compounding of the objects in case or using the same approach as special context filtering is used.

But filtering could get even more complex and reacting on the context of a user including different parameters or prefilters. In special context based filtering, filters react to different logic to provide values. The example out of cascading filtering with object “Country” and subobject “Region” could be enhanced for instance with a pre-selection on the region due to the address of the user stored in the corresponding master data of the user. In SAP BW Bex special context based filtering is implemented most likely with the help of SAP BW Bex Query Variables and an additional implementation of a BAdI for “Refining Input Help in Variable Screen”.

Within the support matrix SAP Analytics Cloud Support Matrix for Live Connectivity to SAP NetWeaver BW and SAP BW/4HANA (https://assets.sapanalytics.cloud/production/help/help-release/en/ba7ee8dc6dcd4069b210ec712be52a31.html ) all functions of SAP BW Bex Query Variables mentioned above are supported.

In this blog I want to focus on the usage of the BAdI for “Refining Input Help in Variable Screen” in context of SAP Analytics Cloud to enable special context-based filtering. In our example I would like to restrict the time and another dimension to values I choose randomly.


Approach

We already implemented a query with input ready variables named “Source System” (CMOOY_SOURCE) for object ZPASOURCE and CXMIMY_CALDAY_YTD named “YTD” for object 0CALDAY.

For these objects we implement a special value help to restrict 0CALDAY to values from 20190101 – 20210101 only and ZPASOURCE to 2 values (Fac, Ads). Value “Ads” in case of ZPASOURCE only exits in master data.


Implementation SAP BW

Let’s have a short look at the implementation of the BAdI.

First implementation of the BAdI in class ZP_BAD_VARIABLE_HELP_CLASS and the implementation in method ~GET_RESTRICTION_FLAT. Filter is already set to the objects ZPASOURCE and 0CALDAY.

Implementation of interface method ~GET_RESTRICTION_FLAT. Only this method needs to be used because the variable provides only flat list for selection.

Finally, the implementation that restricts the variable help to certain values. Within this method you have access to I_T_VAR_RANGE table including already selected values. Also, metadata of the call like query name, object name and access mode are available here.

One changing parameter C_F4_MODE give the possibility to influence the access mode the variable value help is shown. Due to the fact that value “Ads” is not a posted value – so only in master data – this value won’t be shown in case the variable is using posted values. With the help of resetting to “M” this value will be listed independent from the variable setting.

How it works in BW

Checking the implementation in RSRT on query level by executing the query having the variables included.

Checking 0CALDAY variable CXMIMY_CALDAY_YTD value help bring up the following list as expected. The restriction to 20190101 – 20210101 works fine and delivers only those values.

Checking value help for ZPASOURCE variable CMOOY_SOURCE with 2 values (Fac, Ads) and access mode master data is also looking fine.

How it works in SAP Analytics Cloud

In SAP Analytics Cloud we include the SAP BW Bex Query as a new model and consume it via story and expect the same behavior.

We are testing with Version 2021.3.2 and have a first look at the query.

Executing the query without restriction show us the following dataset.

Now we have a look at the value help of the variables.

In case of 0CALDAY variable CXMIMY_CALDAY_YTD value help should come back with values restricted to 20190101 – 20210101. In SAP Analytics Cloud the behavior is different and allows to select almost every value in value help.

In the value help of SAP Analytics Cloud also entries out of 2011 or 2020 are accessible and it is not possible to influence 0CADLAY value help. 0CALDAY is not handled like a normal dimension in that case.

Having a closer look on ZPASOURCE with variable CMOOY_SOURCE with 2 values (Fac, Ads) and access mode master data access show also a different behavior. Compared to SAP BW it came up only with the posted value “Fac” and does not consider master data mode set in badi.

But at least it was considering the values we provided because the posted value “ADW” was not provided any longer in the value help for ZPASOURCE.

Furthermore you have to keep in mind that dimension filtering is not affected by the variable and the BAdI for “Refining Input Help in Variable Screen”. Accessing the value help for the dimension ZPASOURCE will provide a list with all members.

Conclusion

Influencing the variable value help with the help of the BAdI for “Refining Input Help in Variable Screen” is a possibility to help users to select the right values. It could restrict the value help taking many parameters into concern.

Unfortunately, SAP BW Bex and Sap Analytics Cloud behave differently when consuming with the same implementation in SAP BW backend.

Nonetheless the approach cloud be used considering the restrictions like the access of 0CALDAY and the restriction to posted values although master data flag is set.

In a perfect integration both frontend tools would work similar and gain from the functionalities of both worlds. In the meantime we have to keep in mind that not all approached that worked in SAP BW Bex are working the same way in SAP Analytics Cloud.



×