Skip to Content
Technical Articles

Tips For Using SAP Hana Calculation Views

SAP HANA calculation views give the user (that’s us) an unprecedented level of control over our data. The catch is, this level of control isn’t intuitive and requires a bit of understanding and a sprinkling of programming know-how to truly unlock the level of control that we would like to have. The aim here is to explore the things we can do with SAP HANA Calculation Views if set up properly. Let’s dive right in.

Initial Setup

The first thing we’re going to do is enter SAP HANA Development perspective, allowing us to create new hdb procedures. We should be presented with the plain graphical view of the initial window. We’re going to create a new Calculation View by right-clicking on our development package, and selecting New then Calculation View. In the resulting dialog box, we’re going to enter whatever name we desire for the technical name for this new calculation view, leaving the default type (Graphical) selected. We’ll then hit Finish. The system should create two objects, one a Semantics object and the second an Aggregation object. In the left-hand pane we should find access to the design objects we can use. We’re going to select projection and then mouse-over the newly created object until the green “+” sign appears, then click on the sign. This should open up a dialog that allows you to locate data to add to this projection. The search box will allow you to iterate through the available objects, filtered by particular words or phrases. The detail pane will reveal the structure of the selected object with the bullet-shaped symbols on the left side of each item being used to add that particular item to the output. Once selected, the bullet-shaped icon turns orange and the item’s name is highlighted in orange as well.

Moving About in SAP to Get a Better View

The Administration Workbench offers us a useful tool in the “Change View” option for viewing SID objects. By using this, we can immediately switch the way we see InfoObjects, since this allows us to simply display the parent objects and any text elements contained therein easily and quickly. To connect the previously created projection to the system, we’re going to click and drag from the circle along the top of the Projection object to the bottom circle in the Aggregation object. An arrow should show up confirming the connection as well as a sub-object within the Aggregation object showing the connection. If we select the Aggregation object, we get a detail view of the fields inside this particular projection.

Activating the View

The next step is Activation, which can be done by clicking the Activation icon (a green arrow pointing forward) from the Eclipse top menu. Once the Calculation View becomes active, we can display individual object data through a simple right click, and selecting Data Preview in the context menu.

Joining Objects

If we consider that objects in SAP are basically tabular information, then a JOIN command should be similar in other SQL languages, allowing us to preserve the veracity of both objects under a single banner (the Joint Table). To create a join, we must first have two projections (see previous sections on details of how to add Projections to the Calculation View) which will then be combined under our Join command which is useful if you’re a mortgage broker calculating mortgages. In order to preserve any mapping we may have previously set up (like the arrow to the Aggregation object), simply drag in the second Projection from the right side directly onto the arrow that connects the first Projection to the Aggregation system. A Join should be automatically created that combines both objects. Next we select the Join object and define the fields that will be affected by the Join command. The fields will have similar bullet-shaped icons that you can select (orange) and deselect (grey) to your leisure. Only the relevant fields that don’t exist in the first projection need to be turned on in the second projection (to avoid duplicates). If we right-click on the join position between the Projections we can choose to Swap the Projections, or Edit the join conditions and their cardinality. Unlike ABAP joins, this particular system doesn’t allow for extremely complex processing. Alternatively, coding can be used to develop the join through SQL scripting. To create a new join procedure through script, we can right-click the package, select New and then other, select Stored Procedure, and create a name and a target schema to suit the projection. Finally, you would enter your script code here for the join.

Be the first to leave a comment
You must be Logged on to comment or reply to a post.