HTA - WORKBOOK - SP5 - A4 - Short Version
HTA - WORKBOOK - SP5 - A4 - Short Version
No part of this publication may be reproduced or transmitted in Citrix, ICA, Program Neighborhood, MetaFrame, WinFrame,
any form or for any purpose without the express permission of VideoFrame, and MultiWin are trademarks or registered
SAP AG. The information contained herein may be changed trademarks of Citrix Systems, Inc.
without prior notice.
HTML, XML, XHTML and W3C are trademarks or registered
Some software products marketed by SAP AG and its ®
trademarks of W3C , World Wide Web Consortium,
distributors contain proprietary software components of other Massachusetts Institute of Technology.
software vendors.
SAP, R/3, SAP NetWeaver, Duet, PartnerEdge, ByDesign, SAP
Microsoft, Windows, Excel, Outlook, and PowerPoint are BusinessObjects Explorer, StreamWork, and other SAP
registered trademarks of Microsoft Corporation. products and services mentioned herein as well as their
respective logos are trademarks or registered trademarks of SAP
IBM, DB2, DB2 Universal Database, System i, System i5, AG in Germany and other countries.
System p, System p5, System x, System z, System z10, System
z9, z10, z9, iSeries, pSeries, xSeries, zSeries, eServer, z/VM, Business Objects and the Business Objects logo,
z/OS, i5/OS, S/390, OS/390, OS/400, AS/400, S/390 Parallel BusinessObjects, Crystal Reports, Crystal Decisions, Web
Enterprise Server, PowerVM, Power Architecture, POWER6+, Intelligence, Xcelsius, and other Business Objects products and
POWER6, POWER5+, POWER5, POWER, OpenPower, services mentioned herein as well as their respective logos are
PowerPC, BatchPipes, BladeCenter, System Storage, GPFS, trademarks or registered trademarks of Business Objects
HACMP, RETAIN, DB2 Connect, RACF, Redbooks, OS/2, Software Ltd. Business Objects is an SAP company.
Parallel Sysplex, MVS/ESA, AIX, Intelligent Miner,
WebSphere, Netfinity, Tivoli and Informix are trademarks or
Sybase and Adaptive Server, iAnywhere, Sybase 365, SQL
registered trademarks of IBM Corporation.
Anywhere, and other Sybase products and services mentioned
herein as well as their respective logos are trademarks or
Linux is the registered trademark of Linus Torvalds in the U.S. registered trademarks of Sybase, Inc. Sybase is an SAP
and other countries. company.
Adobe, the Adobe logo, Acrobat, PostScript, and Reader are All other product and service names mentioned are the
either trademarks or registered trademarks of Adobe Systems trademarks of their respective companies. Data contained in this
Incorporated in the United States and/or other countries. document serves informational purposes only. National product
specifications may vary.
Oracle and Java are registered trademarks of Oracle and/or its
affiliates. The information in this document is proprietary to SAP. No part
of this document may be reproduced, copied, or transmitted in
UNIX, X/Open, OSF/1, and Motif are registered trademarks of any form or for any purpose without the express prior written
the Open Group. permission of SAP AG.
Contents
SAP HANA Hands-on Workshop ................................................................................................................... 3
SAP HANA Introduction .............................................................................................................................. 4
What is SAP HANA database? .................................................................................................................. 4
About SAP HANA studio .......................................................................................................................... 6
Hands-on Labs ....................................................................................................................................... 6
Connect to HANA Studio ......................................................................................................................... 6
Modeling HANA Views .......................................................................................................................... 11
Attribute Views................................................................................................................................... 11
Hands-on Labs ..................................................................................................................................... 11
Analytic Views.................................................................................................................................... 19
Hands-on Labs ..................................................................................................................................... 20
Calculation Views .............................................................................................................................. 33
Hands-on Labs ..................................................................................................................................... 34
Reporting from SAP HANA with SAP Lumira......................................................................................... 56
SAP Lumira Overview............................................................................................................................ 56
Appendix ................................................................................................................................................ 71
TPC-H ERD Diagram .............................................................................................................................. 71
Weblinks ............................................................................................................................................. 71
SAP HANA is a modern platform for real-time analytics and applications. It enables
organizations to analyze business operations based on large volume and variety of detailed
data in real-time, without any delays.
HANA offers endless opportunity for business innovation within all industries and lines of
business. The following three dimensions represent a model for understanding the potential of
HANA:
The SAP HANA database is a relational database that has been optimized to leverage state of
the art hardware. It provides all of the SQL features of a standard relational database along with
a feature rich set of analytical capabilities and an SAP specific programming language f or
stored procedures called SQL Script. With these facilities the SAP HANA database is capable
of embedding application logic within the database itself. This allows complex queries to be
executed directly inside the database, thus reducing the requirement of data transfer to and
from the database. This enables SAP HANA based applications to process vast amounts of
data whilst operating in a responsive, real-time manner.
From the administrators perspective the SAP HANA Database is conceptually about leveraging
modern hardware system landscapes to increase database performance and reliability.
Traditionally databases have been designed to operate in a situation where there are limited
memory and CPU resources. Currently however, servers can provide in excess of 1TB of
memory and up to 80 CPU cores on a single system.
To better understand how the SAP HANA database improves on the traditional database
concepts, in the next section we will compare and contrast the two approaches to database
systems.
Computer architecture has changed in recent years. Now multi-core CPUs (multiple CPUs on
one chip or in one package) are standard, with fast communication between processor cores
enabling parallel processing. Main memory is no-longer a limited resource, modern servers can
have 1 TB of system memory and this allows complete databases to be held in RAM. Currently
server processors have up to 80 cores, and 128 cores will soon be available. With the
increasing number of cores, CPUs are able to process increased data per time interval. This
shifts the performance bottleneck from disk I/O to the data transfer between CPU cache and
main memory (see figure. 1).
In-memory database. All relevant data should be available in main memory, which
characteristically avoids the performance penalty of disk I/O. To use the advantages of in-
memory computation a cache-conscious implementation of data structures and algorithms is
necessary.
The administration console of the SAP HANA studio allows technical users to manage the SAP
HANA database as well as to create and manage user authorizations.
The information modeler allows technical users to create new or modify existing models of data.
Hands-on Labs
A Windows-based image that contains the client tools used during the workshop labs. (We will
only be connecting to this image directly today)
A Linux-based image that houses the SAP HANA database environment.
Open the Remote Desktop Connection program (In Windows 7 got to Start => All Programs =>
Accessories => Remote Desktop Connection), enter the computer name provided by the instructor (it will
be in the format as shown below) and then click Connect.
Start SAP HANA studio by double clicking on the hdbstudio.exe shortcut on the Windows desktop
Once SAP HANA studio starts it will look like below with the Navigator on the left panel and the Quick
Launch panel on the right. The Navigator shows the systems available at the highest level of the
hierarchy. Our environment only shows one SAP HANA system instance setup called HDB. If you
7 SAP HANA Introduction | SAP
expand HDB you will see the Catalog, which includes such items as authorization information, schemas
and schema objects and data. Also under HDB will be Content, which includes the information models
(such as Attribute Views and Analytic Views) that we will use to access the HANA database.
The Quick Launch panel is a good place to find the various objects you can create and actions you can
perform on your SAP HANA instance. Before you start creating objects let’s take a look at some of the
administrative features that SAP HANA studio provides.
The panel to the right will show an overview of the SAP HANA instance.
The Performance tab shows current load on such metrics as CPU, Memory, Disk usage, Network etc.
The Configuration tab is where you can change the various settings of the environment without having to
log into the Linux server to modify OS (Operating System) level configuration files. If you like check the
other tabs on this panel before proceeding.
As we learned earlier Catalog contains the Authorization/Security information and the Schemas/Data.
Attribute Views
Attribute views are used to give master data tables context. This context is provided by text tables which
give meaning to the master data. For example, if our fact table or analytic view only contains some
numeric ID for each car dealer then we can link in information about each dealer using an attribute view.
We could then display the dealers’ names and addresses instead of their IDs thus providing the context
for the master data table.
Attribute views are used to select a subset of columns and rows from a data table. As it is of little use to
sum up attributes from master data tables there is no need to define measures or aggregates for
attribute views.
You can also use attribute views to join master data tables to each other, e. g. joining “Plant” to
“Material”.
Hands-on Labs
For Information Models we need to expand the IM2 instance => Content. Under Content are collections
of views, privileges and procedures called Packages. Expand the hanahandson Package => Attribute
Views. Right click on Attribute Views and choose New => Attribute View
Now join the tables by clicking on the key field and dragging to the corresponding keys. So in this
example from Region.R_Region_Key => Nation.N_Region_Key; Nation.N_Nationkey =>
Customer.C_Nationkey.
We will now specify the Key Attributes of our View. Select Customer.C_Custkey and right click ‘Add To
Output’.
The attribute is visible in the Output panel and we now want to make this attribute a key attribute by first
selecting it in the columns folder and then in the properties tab selecting the drop down menu and
selecting True:
Add the remaining attributes in the same manner as the above: Nation.N_Name; Customer.C_Name;
Customer.C_Address; Customer.C_Phone; Customer.C_Acctbal; Customer.C_Mktsegment;
Customer.C_Comment. You should now have the below:
When the validation completes you will see the results in the Validation Log window at the bottom.
The next step is to activate the View for users to access it. You will notice that the My_Customer
Attribute View has a diamond in its icon in the Navigator Panel. This indicates that you haven’t activated
the view.
You should now see the data that your attribute view produces in the Raw Data tab.
In the Distinct values tab we can see further details on the attributes stored in the SAP HANA database
such as the; data type, column display size, java type and row count.
Analytic Views
Analytic views are used to build a data foundation based on transactional tables. You can create a
selection of measures (sometimes referred to as key figures), add attributes and join attribute views.
Analytic views can contain two types of attributes (or columns), so-called measures and normal
attributes. Measures are attributes for which an aggregation must be defined. Normal attributes can be
handled as regular columns and there is no need for aggregation.
Hands-on Labs
Now we will create an Analytic View. Right click on Analytic View under the hanahandson Package and
choose New => Analytic View
From the HANA_TPCH schema add the Orders and LINEITEM tables to your view by select either one
by one or holding CTRL and then dragging them into the Data Foundation area on the canvas.
You should now have the below showing tables: ORDERS and LINEITEM:
We should now see the following (notice currently the Data Foundation is unpopulated):
Now add the attributes to the output from Orders: O_Orderkey, O_Custkey, O_Orderstatus,
O_Orderdate, O_Orderpriority, O_Clerk, O_Shippriority, O_Comment
Now we are going to define the attribute type. First select the Semantic level in our scenario:
To change the type we will select the attribute and then a dropdown menu will appear prompting us to
either select the field as an Attribute or Measure. Repeat this for the remainder (or alternatively for a
faster way we could select multiple attributes by holding the shift key and select the relevant icon
marked in the small red box). The fields: L_TAX, L_QUANTITY,L_DISCOUNT and
L_EXTENDEDPRICE are to be selected as measures.
Join the Attribute Views to the Data Foundation: Customer.C_Custkey Data Foundation.O_Custkey;
Supplier_Part.PS_Partkey Data Foundation.L_Partkey; Supplier_Part.PS_Suppkey Data
Foundation.L_Suppkey:
Call the new column L_LINETOTAL and use a SUM Aggregation type, by selecting the ‘Calculate before
Aggregation’ check box and ensure the ‘Hidden’ box kept unchecked.
Then expand the Columns folder in the Elements box and click on L_Discount to add it to the
expression.
Once you have the below written correctly, check to validate it by selecting the validate icon:
Test your view by previewing the data. Right click My_Order_Warehouse Data Preview
We can do some analysis on the data by selecting the Analysis tab. Click and drag C_MKTSEGMENT
into the label axis and repeat the same for L_LINEITEM then drag the numeric attribute into the Value
axis:
Calculation views are defined as either graphical views or scripted views depending on how they are
created. They can be used in the same way as analytic views, however, in contrast to analytic views it is
possible to join several fact tables in a calculation view. Calculation views always have at least one
measure.
Graphical views can be modeled using the graphical modeling features of the SAP HANA Information
Modeler. Scripted views are created as sequences of SQLScript statements. In essence they are
SQLScript procedures with certain properties.
Name it MY_ORDERS_CY_PY. We will be making this as a graphical view so make sure that Graphical
is the View Type. Click Next.
Link the Customer_Order to the Projection. Mouse over Customer_order and click and hold Create
Connection and drag to the Projection component
Apply a filter to O_Year so that Year = 1998. Right click on Customer_Order. O_Year Apply Filter
Create another Calculated Column for the Prior Year. Right click on Calculation Column New
Select the new Projection Component and add the following fields to the output: R_Name, N_Name,
C_Mktsegment, C_Name, O_Year, O_Month, O_Totalprice:
Name it CY_Orders, Data Type Decimal Length 10 Scale 2 and add the number 0 to the Expression
Editor.
Name it PY_Orders, Data Type Decimal Length 10 Scale 2, and add O_Totalprice to the Expression
Editor:
Select the Union Component and add all fields with the exception to O_Year and O_Totalprice from the
Projection 1.
Test the Calculation View by seeing the Data Preview – Right click the view and select Data Preview:
As you can see from the above some object names could be clearer and more meaningful so let’s
change one.
Ensure you have the properties tab opened and then click on the C_MKTSEGMENT object on the right
from the attributes folder:
Go to the Data Preview and the Analysis tab. You will now see the change you made to
C_MKTSEGMENT:
SAP Lumira is the latest innovation in the SAP BusinessObjects Explorer solution family. It is a desktop-
based visualization and data manipulation solution that allows business analysts to acquire data from a
variety of corporate and personal data sources and manipulate without scripting. SAP Lumira produces
beautiful visualizations and allows users to analyze data and quickly discover unique insight that can be
easily shared throughout the organization.
Despite not carrying the portfolio brand BusinessObjects, SAP Lumira is part of the SAP
BusinessObjects portfolio and extends the value of SAP BusinessObjects Explorer. With the web and
mobile experiences of Explorer, business users can quickly explore their data and build their own
dashboards. SAP Lumira complements these two experiences while offering Business Analysts the
ability to perform more advanced data transformation and analysis.
For business analysts: SAP Lumira is the fastest, most engaging way to find answers from data. With
its engaging and easy-to-use interface, SAP Lumira redefines the notion of self-service information
allowing users to bring together corporate information, their own personal data and enriched semantics
from SAP to create new ways of viewing the business.
For IT: SAP Lumira allows IT to provide analysts a data discovery solution, enabling business users to
work with both corporate information and personal data sources to answer the questions they are asked
everyday without assistance from IT.
Further, SAP Lumira enables users to perform these functions without having to create predefined
query, report, or dashboard and with the ability to manage SAP Lumira as part of their enterprise BI
standard. From powerful data discovery to beautiful visual analytics, SAP Lumira is about bringing life to
your data, finding the key information for better decisions.
Hands-On Lab:
In Visual Intelligence select New Document and choose option “HANA Online”:
Then select Analytical View “MY_ORDER_WAREHOUSE” using following log in information, once
selected click the connect button.
Select option “Split” so you can see all facets as well as the work area:
L_QUANTTITY = QUANTITY
L_EXTENDED PRICE = EXTENDEDPRICE
L_DISCOUNT = DISCOUNT
Select QUANTITY, EXTENDEDPRICE, DISCOUNT measures and drag and drop them one by one to
Measures - Y Axis 1.
Create a filter for Region. Start by selecting Region in the attributes pane on the left and then select the
small arrow to the right of the name:
Select Nation and Market Segment and drag and drop these to the Dimensions area:
Create a calculated column which displays Percentage of Total for Quantity. Select the Quantity
measure in Y Axis 1, select the triangle icon and choose Add calculation Percentage.
The new calculation should now be added below the exisiting measures:
Then select the Pie Chart Icon and enlarge the window by hiding the left pane:
You should now see the below pie chart with the attributes arranged in alphabetical order:
Now we are going to undo this to return to the previous state by selecting the undo icon:
Select the Split Icon to see a more detailed view and expand the left pane by selecting the right pointing
arrow:
Switch to the Line Chart by selecting the icon and Combined Column and Line Chart with Dual Value
Axes option.
You can also double click on each data bar to zoom in to detail chart for each Country and Market
Segment.
Rename your chart by double clicking on the title. Type “Order Analysis by Country and Market
Segment”:
Create a geographic visual map by categorizing geographic dimension first. Select “Country” attribute
and click on the arrow to the right. Click on “Create a Geographic hierarchy”:
Confirm the elements identified are correct - This will create the geographic dimension. Click OK:
Select “Country” under hierarchies and drag it to Geography (if it is not there).
Select “Market Segment” under attributes and drag it over to Overlay data.
Click Save.
Weblinks
http://www.saphana.com
http://www.sap.com/hana
http://www.sap.com/pc/tech/in-memory-computing-hana.html
http://www.sdn.sap.com/irj/sdn/in-memory
http://help.sap.com/hana
71 Appendix | SAP