Site icon Learn SAP HANA through easy tutorials

SAP HANA Scripted Calculation View – Filters

SAP HANA Scripted Calculation View Filters

Welcome again to the next SAP HANA Scripted Calculation View tutorial series. In this one, we learn how to use SAP HANA Calculation view filters, SAP HANA Variables and SAP HANA Input Parameters. This is the first tutorial in this series and will focus just on SAP HANA Calculation view filters.

Let’s continue with the SAP HANA Scripted calculation view from our previous tutorial. This code joined the VBAK and VBAP table and picked up a few fields from each. But in usual project scenarios, we rarely need all the data for reporting. Usually, there are filters that help us pick up data which is relevant to the report we wish to eventually build. This reduces the size of the output data set thereby increasing the performance of this data model and the reports on top of it.

1

Application of SAP HANA Calculation view filters

As an example, let’s filter the data for Document type = ‘TA’. This field in the table is AUART. So, at the end of the select query, add a where condition to mark this SAP HANA Calculation view filter as shown below.

Save and activate the view.

Execute the view and perform a data preview. Switch to Distinct Values tab and drag DOC_TYPE to the right pane. As seen below, the only values that exist are ‘TA’. Thus our filter has worked.

1

Please note that a field that has not selected in the output of the select statement can also be used as a filtering criterial. For example, the field CMKUA is not in the list of output columns for our SELECT statement but we can still filter on that value so that the join is performed only between the filtered datasets. In this example, we add an AND operator because this is the second filtering condition. Then we write CMKUA != 0. The composite sign != is used to denote the “not equal to” functionality.

Save and activate the calculation view. This SAP HANA Calculation view filter now gets applied.

Help this website grow by sharing this document on social media by using the icons below.

<<Previous Tutorial                                                                                        Next Tutorial>>

Exit mobile version