Professional Documents
Culture Documents
Lesson: Levels of Modeling
Lesson: Levels of Modeling
Lesson Overview
This lesson looks at the different levels of information models in SAP HANA.
Lesson Objectives
After completing this lesson, you will be able to:
• Describe the levels of modeling in SAP HANA
• Create and display data for an Attribute View
• Create and display data for Analytical View
• Create and display data for an Calculation View
Business Example
You have an understanding about the data you want to create reports on, and you
have decided to create Information Models to base the reports on.
The diagram depicts the process flow for modeling within SAP HANA.
This example focuses on the process of creating Information Models and also
demonstrates how to export these models for easy portability.
Note: When using the copied from option, models can be selected from
any package. One is not limited to only models within the selected
package. Packages simply organize Information Models similar to how
schemas organize physical tables.
2. Select tables
Note: Tables can be selected from multiple schemas and are not limited
to one schema per Attribute View.
When looking for a table from a schema containing many tables, you want to first
filter the list of tables in the schema:
• Right click the “tables” folder within the schema
• Enter a filter string
Note:
The filter string here must be the beginning of the table name.
• Click OK
• The list of tables in the schema is now filtered.
• Expand the “tables” folder to display the filtered list of tables.
• Now you can simply drag a table from the schema into your view.
This is a useful option if you have already found a table you need and for example
have displayed the table definition to make sure its the correct table.
Inner Join:
• The INNER JOIN combines records from the left and right table exactly
when the specified criteria are met. If the criteria are not met, no record
is created in the result set.
Left Outer:
• A record from the left table is always stored in the result set. If a record
from the right table met the criteria, it is combined to the record from the
left table, otherwise the columns are empty (zero).
Right Outer:
• A record from the right table is always stored in the result set. If a record
from the left table met the criteria, it is combined to the record from the right
table, otherwise the columns are empty (zero).
Text Join:
• Used to join a text table to a master data table. This is a requirement for
description mapping. The text join always filters on one language and thus
one needs to specify a language column in the text table. The language is
filtered based on the view settings (which are per default taken from the
user profile of the modeler)
Referential Join:
• Is semantically a inner join that assume that referential integrity is given
which means that the left table always have an corresponding entry on the
right table.
• It could be used in e.g. data foundation for header-item relations where it can
be assumed that for each item a header exists. It can be seen as an optimized
or faster inner join where the right table is not checked if no field from the
right table is requested.
• Referential Joins will be only executed, when fields from both tables are
requested. Therefore, if a field is selected from the right table it will act
similar to inner join, and if no fields from the right table is selected it will act
similar to a left outer join.
• Referential joints should be used with caution since it assumes that referential
integrity is ensured.
If views are displayed via Excel, each Attribute view is represented in Excel as
a Dimension.
In our example, we have modelled the “Product dimension” with attributes
“Product Number” and “Product Category”.
• Product Number is the key
• Product Category is a non-key attribute
Each attribute in the list of output fields has among its properties a setting
“Hierarchy Active”. This setting defaults to “false”. If set to “false” the attribute
will only show up in Excel (via MDX) if it is a key field of the attribute view.
If set to “true”, the attribute will show up in Excel also if it is not a key field.
The data preview functionality is useful for confirming that one has modeled
the data the way he/she intended. It can be done at the Attribute view, or at the
physical tables at the foundation level.
There are three main views one can select from when previewing data:
• Raw Data – table format of data
• Distinct Values – graphical and text format identifying unique values
• Analysis – select fields (attributes and measures) to display in graphical
format
Reporting at this level will not include measures as measures are in Analytic
Views not Attribute Views. To conduct analysis on measures according to the
attributes in this Attribute View one would include this Attribute View in an
Analytic View definition.
Figure 25: Analytical View are the Multidimensional Views that Analyze
Values from Single Fact Table
The analytic view editor helps you to create a fact table by adding and joining the
tables in the Data Foundation node. In addition you can join attribute views to
these tables in the Logical Join node. You use Output view to model various
view elements: Columns, Calculated Columns, Restricted columns and Input
Parameters. In the Semantics node you can classify these Columns and Calculated
Columns as attributes and measures. You can also create variables/input
parameters, and assign variables to the columns in the Semantics node.
2. Select tables
Define join conditions and cardinality. The default settings are “Referential join”
and “n:1”.
Click on the properties tab on the lower section of the screen to change these
settings if necessary.
The data preview functionality can be used for verification of the designed model.
It has three tabs:
• Raw Data – table format of data
• Distinct Values – graphical and text format identifying unique values
• Analysis – select fields (attributes and measures) to display in graphical
format.
You can display the data in a table format or a graph. There are multiple graphs
types available.
Figure 39: EXERCISE – Creating Analytic Views for the CO-PA Scenario
Calculation Views
This editor helps you to build view logic graphically using the tools available in
the Designer view for join, union, projection and aggregation operations. You can
perform these operations on data sources and/or on top of other operations. In the
Details view, you define the output of the selected nodes. You use the Output
• Applications only offload very limited functionality into the database using
SQL, most of the application logic is normally executed in an application
server. SQLScript can be used to push data-intensive application logic into
the database.
• This has the effect that data to be operated upon needs to be copied from the
database into the application server and vice versa. When executing data
intensive logic, this copying of data is very expensive in terms of processor
and data transfer time.
• the SAP HANA database exposes a very sophisticated interface to the
application consisting of many languages. The expressiveness of these
languages far exceeds that attainable with OpenSQL.
Note: SQL Script is covered in more detail in course HA300.
Hint: In order to get the correct data types from existing database tables,
one can
• Right-click the table in the navigator tree and
• Select Definition from the context menu; then
• Right-click into the editor that opens up (the tab displaying the list
of table fields) and
• Select Export SQL from the context menu
Figure 55: Calculation View (Scripting) – Add the SQL Script Code
No part of this publication may be reproduced or transmitted in any form or for any purpose without the express permission of
SAP AG. The information contained herein may be changed without prior notice.
Some software products marketed by SAP AG and its distributors contain proprietary software components of other software
vendors.
Trademarks
Adobe, the Adobe logo, Acrobat, PostScript, and Reader are trademarks or registered trademarks of Adobe Systems Incorporated
in the United States and other countries.
Apple, App Store, FaceTime, iBooks, iPad, iPhone, iPhoto, iPod, iTunes, Multi-Touch, Objective-C, Retina, Safari, Siri, and
Xcode are trademarks or registered trademarks of Apple Inc.
Bluetooth is a registered trademark of Bluetooth SIG Inc.
Citrix, ICA, Program Neighborhood, MetaFrame now XenApp, WinFrame, VideoFrame, and MultiWin are trademarks or
registered trademarks of Citrix Systems Inc.
Computop is a registered trademark of Computop Wirtschaftsinformatik GmbH.
Edgar Online is a registered trademark of EDGAR Online Inc., an R.R. Donnelley & Sons Company. Facebook, the Facebook and
F logo, FB, Face, Poke, Wall, and 32665 are trademarks of Facebook.
Google App Engine, Google Apps, Google Checkout, Google Data API, Google Maps, Google Mobile Ads, Google Mobile
Updater, Google Mobile, Google Store, Google Sync, Google Updater, Google Voice, Google Mail, Gmail, YouTube, Dalvik, and
Android are trademarks or registered trademarks of Google Inc.
HP is a registered trademark of the Hewlett-Packard Development Company L.P.
HTML, XML, XHTML, and W3C are trademarks, registered trademarks, or claimed as generic terms by the Massachusetts
Institute of Technology (MIT), European Research Consortium for Informatics and Mathematics (ERCIM), or Keio University.
IBM, DB2, DB2 Universal Database, System i, System i5, System p, System p5, System x, System z, System z10, z10, z/VM,
z/OS, OS/390, zEnterprise, PowerVM, Power Architecture, Power Systems, POWER7, POWER6+, POWER6, POWER,
PowerHA, pureScale, PowerPC, BladeCenter, System Storage, Storwize, XIV, GPFS, HACMP, RETAIN, DB2 Connect, RACF,
Redbooks,
OS/2, AIX, Intelligent Miner, WebSphere, Tivoli, Informix, and Smarter Planet are trademarks or registered trademarks of IBM
Corporation.
Microsoft, Windows, Excel, Outlook, PowerPoint, Silverlight, and Visual Studio are registered trademarks of Microsoft
Corporation.
INTERMEC is a registered trademark of Intermec Technologies Corporation. IOS is a registered trademark of Cisco Systems Inc.
The Klout name and logos are trademarks of Klout Inc.
Linux is the registered trademark of Linus Torvalds in the United States and other countries. Motorola is a registered trademark of
Motorola Trademark Holdings LLC.
Mozilla and Firefox and their logos are registered trademarks of the Mozilla Foundation. Novell and SUSE Linux Enterprise
Server are registered trademarks of Novell Inc.