Filters:Type 1- SAP HANA Constant Filters
SAP standard tables may contain millions of data records and it becomes critical to the report performance that we only pull the data we need from the tables we look at. Without filters in SAP HANA, pulling up excess data can lead to slow reports, put strain on the server, and in some instances crash it too! Unless you wish to be the guy who crashed the server (The stain of which stays on for a long time..), read on to understand the three methods by which you can filter to get only the data that is needed:
- Constant Filters
- Variables
- Input Parameters
All three of them have varied usages which we will try to understand in this and the further tutorials.
To begin, double click and open our SALES_VIEW from the previous tutorial. And then click on the Projection_1 node to open it up on the right pane.
Let’s start applying these filters one by one.
The constant filter in SAP HANA
1
This is the simplest filter condition. Here, the requirement provides constant values for which the filters must be applied. For example, let’s say we only need data from table VBAK where it’s field VBTYP is equal to the value ‘C’. This is a clear constant value which has to be directly applied and once applied, the same filter will run every time. No matter which user does the data preview, this filter would run and the user would have no influence on this value.
To achieve this filter condition as per our example, right click on the VBTYP field and select ‘Apply Filter’ from the context menu.
The filter dialog-box opens up.
Here, you can choose the operator to be applied – Filter when something is equal to some value or not equal to it, or between a range of values and so on. The options here cover every form of constant filter you may need.
In this example, we need the value to be equal to C and hence we choose the below values
Once you press OK, notice that the yellow-orange filter symbol appears on Projection_1 confirming that our effort was successful.
Activate the view (1) and then do a data preview (2) to check the resultant data using the buttons marked below.
As seen from the data preview, the VBTYP is completely filled with value ‘C’ but this can be misleading since data preview usually brings up 200 records only and the overall data set may be much larger. To check how many unique values exist for VBTYP field, let’s switch to the Distinct values tab as marked by the arrow below.
Drag the VBTYP field on to the right pane and you would see the number of unique values this dataset brings. As seen here, there are 11,187 result rows and all of them have a value of C. Thus our constant filter works fine.
1
1
Now, try to apply a filter in the Join node as shown below. Notice that there is no ‘Apply filter’ option. This is just to emphasize the fact that only Projections allow filters. If you need a filter on a join result, you would need to add another projection after the join and filter it there.
I hope this was easy to understand since it was a fairly straightforward topic. In the next tutorial, we take a look at the next type of tutorials – SAP HANA Variables in graphical views.
If you liked the tutorial, please share it on social media using the share buttons below and make sure you subscribe to our newsletter to get the latest updates when new tutorials are added.
<<Previous Tutorial Next Tutorial>>