593
HA300 SAP HANA Implementation and Modeling SAP HANA Date Training Center Instructors Education Website Participant Handbook Course Version: 98 Course Duration: 3 Day(s) Material Number: 50116136 An SAP course - use it to learn, reference it for work

HA300 en Col98 Fv Part a4

Embed Size (px)

DESCRIPTION

HA300_EN_Col98_FV_Part_A4.pdf

Citation preview

  • HA300SAP HANA Implementation and

    Modeling

    SAP HANA

    Date

    Training Center

    Instructors

    Education Website

    Participant HandbookCourse Version: 98Course Duration: 3 Day(s)Material Number: 50116136

    An SAP course - use it to learn, reference it for work

  • Copyright

    Copyright 2012 SAP AG. All rights reserved.

    No part of this publication may be reproduced or transmitted in any form or for any purposewithout the express permission of SAP AG. The information contained herein may be changedwithout prior notice.

    Some software products marketed by SAP AG and its distributors contain proprietary softwarecomponents of other software vendors.

    Trademarks

    Microsoft, Windows, Excel, Outlook, PowerPoint, Silverlight, and Visual Studio are registeredtrademarks of Microsoft Corporation.

    IBM, DB2, DB2 Universal Database, System i, System i5, System p, System p5, System x, Systemz, System z10, z10, z/VM, z/OS, OS/390, zEnterprise, PowerVM, Power Architecture, PowerSystems, 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 trademarksor registered trademarks of IBM Corporation.

    Linux is the registered trademark of Linus Torvalds in the United States and other countries.

    Adobe, the Adobe logo, Acrobat, PostScript, and Reader are trademarks or registered trademarks ofAdobe Systems Incorporated in the United States and other countries.

    Oracle and Java are registered trademarks of Oracle and its affiliates.

    UNIX, X/Open, OSF/1, and Motif are registered trademarks of the Open Group.

    Citrix, ICA, Program Neighborhood, MetaFrame, WinFrame, VideoFrame, and MultiWin aretrademarks or registered trademarks of Citrix Systems Inc.

    HTML, XML, XHTML, and W3C are trademarks or registered trademarks of W3C, World WideWeb Consortium, Massachusetts Institute of Technology.

    Apple, App Store, iBooks, iPad, iPhone, iPhoto, iPod, iTunes, Multi-Touch, Objective-C, Retina,Safari, Siri, and Xcode are trademarks or registered trademarks of Apple Inc.

    IOS is a registered trademark of Cisco Systems Inc.

    RIM, BlackBerry, BBM, BlackBerry Curve, BlackBerry Bold, BlackBerry Pearl, BlackBerry Torch,BlackBerry Storm, BlackBerry Storm2, BlackBerry PlayBook, and BlackBerry App World aretrademarks or registered trademarks of Research in Motion Limited.

    Google App Engine, Google Apps, Google Checkout, Google Data API, Google Maps, GoogleMobile Ads, Google Mobile Updater, Google Mobile, Google Store, Google Sync, Google Updater,Google Voice, Google Mail, Gmail, YouTube, Dalvik and Android are trademarks or registeredtrademarks of Google Inc.

    INTERMEC is a registered trademark of Intermec Technologies Corporation.

    Wi-Fi is a registered trademark of Wi-Fi Alliance.

    Bluetooth is a registered trademark of Bluetooth SIG Inc.

    Motorola is a registered trademark of Motorola Trademark Holdings LLC.

    Computop is a registered trademark of Computop Wirtschaftsinformatik GmbH.

    g20130233130

  • SAP, R/3, SAP NetWeaver, Duet, PartnerEdge, ByDesign, SAP BusinessObjects Explorer,StreamWork, SAP HANA, and other SAP products and services mentioned herein as well as theirrespective logos are trademarks or registered trademarks of SAP AG in Germany and other countries.

    Business Objects and the Business Objects logo, BusinessObjects, Crystal Reports, CrystalDecisions, Web Intelligence, Xcelsius, and other Business Objects products and services mentionedherein as well as their respective logos are trademarks or registered trademarks of Business ObjectsSoftware Ltd. Business Objects is an SAP company.

    Sybase and Adaptive Server, iAnywhere, Sybase 365, SQL Anywhere, and other Sybase productsand services mentioned herein as well as their respective logos are trademarks or registeredtrademarks of Sybase Inc. Sybase is an SAP company.

    Crossgate, m@gic EDDY, B2B 360, and B2B 360 Services are registered trademarks of CrossgateAG in Germany and other countries. Crossgate is an SAP company.

    All other product and service names mentioned are the trademarks of their respective companies.Data contained in this document serves informational purposes only. National product specificationsmay vary.

    Disclaimer

    These materials are subject to change without notice. These materials are provided by SAP AG andits affiliated companies (SAP Group) for informational purposes only, without representation orwarranty of any kind, and SAP Group shall not be liable for errors or omissions with respect to thematerials. The only warranties for SAP Group products and services are those that are set forth inthe express warranty statements accompanying such products and services, if any. Nothing hereinshould be construed as constituting an additional warranty.

    g20130233130

  • g20130233130

  • About This HandbookThis handbook is intended to complement the instructor-led presentation of thiscourse, and serve as a source of reference. It is not suitable for self-study.

    Typographic ConventionsAmerican English is the standard used in this handbook. The followingtypographic conventions are also used.

    Type Style Description

    Example text Words or characters that appear on the screen. Theseinclude field names, screen titles, pushbuttons as wellas menu names, paths, and options.

    Also used for cross-references to other documentationboth internal and external.

    Example text Emphasized words or phrases in body text, titles ofgraphics, and tables

    EXAMPLE TEXT Names of elements in the system. These includereport names, program names, transaction codes, tablenames, and individual key words of a programminglanguage, when surrounded by body text, for exampleSELECT and INCLUDE.

    Example text Screen output. This includes file and directory namesand their paths, messages, names of variables andparameters, and passages of the source text of aprogram.

    Example text Exact user entry. These are words and characters thatyou enter in the system exactly as they appear in thedocumentation.

    Variable user entry. Pointed brackets indicate that youreplace these words and characters with appropriateentries.

    2012 2012 SAP AG. All rights reserved. v

  • About This Handbook HA300

    Icons in Body TextThe following icons are used in this handbook.

    Icon Meaning

    For more information, tips, or background

    Note or further explanation of previous point

    Exception or caution

    Procedures

    Indicates that the item is displayed in the instructor'spresentation.

    vi 2012 SAP AG. All rights reserved. 2012

  • Contents

    Course Overview .......................................................... ixCourse Goals .. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ixCourse Objectives ... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ix

    Unit 1: Approaching SAP HANA Modeling........................... 1

    Approaching HANA Modeling ... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .2

    Unit 2: Connecting Tables ..............................................11

    Connecting Tables ... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12

    Unit 3: Advanced Modeling............................................ 27

    Creating Attribute Views ... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30Using Hierarchies ... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 88Creating Restricted & Calculated Columns... . . . . . . . . . . . . . . . . . . . . 112Using Filter Operations... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .137Using Variables... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .151Creating Calculation Views ... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .170SAP HANA SQL Introduction... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .183SQLScript and Procedures ... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .200Using Currency Conversion ... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .249Turning Business Rules into Decision Tables ... . . . . . . . . . . . . . . . . .272

    Unit 4: Full Text Search................................................ 291

    Full Text Search Overview ... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .292Data Types And Fulltext Indexes ... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .298Using Fulltext Search... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .303

    Unit 5: Processing Information Models............................ 315

    Processing Info Models .. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .316

    Unit 6: Managing Modeling Content ................................ 329

    Managing Modeling Content.. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .330

    Unit 7: Security and Authorizations ................................ 351

    User Management and Security .. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .353Types of Privileges... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .372Template Roles... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .396Administrative .. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .399SAP HANA and BI4 authentication ... . . . . . . . . . . . . . . . . . . . . . . . . . . . . .405

    2012 2012 SAP AG. All rights reserved. vii

  • Contents HA300

    Unit 8: Data Provisioning using SLT ............................... 415

    Positioning and Key Concepts .. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .417Data Replication at a Glance ... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .425Administration and Monitoring at a Glance ... . . . . . . . . . . . . . . . . . . . .430SLT based Transformation Concepts and Advanced Replication

    Settings ... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .434Extension of (target) table structure and Partitioning ... . . . . . . . .440Transformation of Data... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .445Filtering and Selective Data Replication ... . . . . . . . . . . . . . . . . . . . . . . .451Appendix Load from SAP Archive & Integration of SLT with SAP

    Solution Manager .. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .460

    Unit 9: Data Acquisition using SAP Data Services ............. 467

    Introduction to SAP Data Services ... . . . . . . . . . . . . . . . . . . . . . . . . . . . . .468Loading Data into SAP HANA.... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .473

    Unit 10: Data Provisioning using Flat File Upload .............. 491

    Introduction to Flat File Upload ... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .492Loading Flat File Data into SAP HANA .... . . . . . . . . . . . . . . . . . . . . . . .494

    Unit 11: Data Provisioning using Direct Extractor Connection.............................................................................. 501

    SAP HANA Direct Extractor Connection Overview... . . . . . . . . . . .502SAP Business Content DataSource Extractors .. . . . . . . . . . . . . . . . .508SAP HANA Direct Extractor Details .. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 511Comparison with other SAP HANA Data Acquisition

    Techniques ... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .515SAP HANA Direct Extractor Connection Setup and

    Configuration... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .519DXC Appendix.. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .539Appendix: DXC Sidecar Variation ... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .543

    Unit 12: Introduction to the Application Function Library ....547

    Application Function Library .. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .548

    viii 2012 SAP AG. All rights reserved. 2012

  • Course OverviewThis course will go into detail in topics such as Modeling, Processing andManaging Information Models.

    You will also gain practical knowledge on HANA Data Provisioning andmaintenance of Security and Authorizations.

    The course will also provide you with an overview on the Application FunctionLibrary (AFL) and the usage of Full Text Search.

    Target Audience

    This course is intended for the following audiences:

    SAP HANA Application Consultants

    Course Prerequisites

    Required Knowledge

    Basic knowledge of SAP HANA is required.

    The course HA100 provides a good basic understanding of SAP HANA andit is mandatory for participants attend this course prior to HA300.

    Recommended Knowledge

    Basic knowledge of row and column table storage is preferable.

    Basic SQL Knowledge

    Basic understanding of SAP Business Objects

    Course GoalsThis course will prepare you to:

    Create data models into SAP HANA Studio

    Replicate data into SAP HANA Database

    Course Objectives

    After completing this course, you will be able to:

    Create data models into SAP HANA

    Understand the difference between SAP HANA views

    Ensure best performance of reporting through an optimized data model

    Replicate data into SAP HANA using SLT technology

    2012 2012 SAP AG. All rights reserved. ix

  • Course Overview HA300

    Load data into SAP HANA using Data Services, DXC technologies or froma flat file

    Use Full Text Search

    Maintain Security and Authorizations in SAP HANA

    Get an overview of the Application Function Library

    x 2012 SAP AG. All rights reserved. 2012

  • Unit 1Approaching SAP HANA Modeling

    Unit OverviewThis module covers the following topics

    Persistency Considerations

    SAP HANA Engine Overview

    Choosing Views for the Information Model

    Unit ObjectivesAfter completing this unit, you will be able to:

    Take into account Persistency Considerations

    Explain the different engine types in the SAP HANA Architecture

    To choose the best views for the Information Model

    To discuss some General Recommendations

    Unit ContentsLesson: Approaching HANA Modeling... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .2

    2012 2012 SAP AG. All rights reserved. 1

  • Unit 1: Approaching SAP HANA Modeling HA300

    Lesson: Approaching HANA Modeling

    Lesson OverviewThis lesson gives an overview of the different types of Information Modelsavailable in HANA and what you need to know about the different enginetypes and persistency considerations in order to choose the right views for yourrequirements.

    Lesson ObjectivesAfter completing this lesson, you will be able to:

    Take into account Persistency Considerations

    Explain the different engine types in the SAP HANA Architecture

    To choose the best views for the Information Model

    To discuss some General Recommendations

    Business ExampleYou have a new SAP HANA Deployment in front of you and you are just aboutto start creating Information Models. You want to understand which types ofInformation Models will be suitable for the requirements you have from thebusiness.

    Figure 1: Persistency Considerations I: Approaching SAP HANA Modeling

    Before start creating tables on HANA database, you should take a little time tothink about your scenarios. Different scenarios have different requirements andfor that also different persistency models.Hereis a small checklist you shouldtake into consideration:

    2 2012 SAP AG. All rights reserved. 2012

  • HA300 Lesson: Approaching HANA Modeling

    Write or read intensive scenarios

    Criteria for storage type

    for write-Intensive scenarios the recommendation is to use the rowstorage

    for read-intensive scenarios the recommendation is to use the columnstorage

    Real-time Data access

    Depending on the scenario requirements, various data replication tools areavailable. The tools can differ from each other by:

    support of table type, data type

    capability of data type transformation

    Authorization

    HANA data content authorization/privilege applies to specific models only(e.g Analytic View, Calculation View, Attribute View)

    Application / Client

    Different clients consume HANA DB differently and might require clientspecific models, some examples:

    Explorer does not support filters in the queries on design time

    Currently only AAO and Excel plan to support hierarchies

    WEBI always retrieves and caches the max result set

    Only Explorer, Excel and AAO do currently consume additional metadata, e.g. for multi language support

    Functionality

    Some complex algorithm can only expressed in L language

    HANA Currency Conversion supported only via Analytic / CalculationView

    UNION only in Calculation View

    Performance

    2012 2012 SAP AG. All rights reserved. 3

  • Unit 1: Approaching SAP HANA Modeling HA300

    Figure 2: Persistency Considerations II: Approaching SAP HANA Modeling

    Figure 3: SAP HANA Engine Overview I: Approaching SAP HANA Modeling

    The SAP HANA architecture provides different types of engines:

    Join Engine

    The Join Engine used to perform all type of joins.

    OLAP Engine

    The OLAP Engine is used for calculation and aggregation based on star schemaor similar.

    Calculation Engine

    4 2012 SAP AG. All rights reserved. 2012

  • HA300 Lesson: Approaching HANA Modeling

    The Calculation Engine is used on top of OLAP engine and/or Join Engine forcomplex calculation which cannot be done by Join Engine or OLAP Engine .

    The SQL Optimizer decides the best way to call the engines dependingon the involved models and queries.

    Figure 4: SAP HANA Engine Overview II: Approaching SAP HANA Modeling

    When building new Information Models, we need to keep in mind which engineis utilized. The Graphic shows, what engine is utilized based on the view thathas been designed.

    It is important to mention that any Analytical View with a calculate attribute or anAttribute view containing a Calculation attribute, will become a Calculation View.This is very important to be taken in consideration during the modeling, because itcan have a big impact regarding the performances of the data model.

    In general this kind of approach creating Calculate Attribute View into AnalyticView or Attribute view must be avoided.

    2012 2012 SAP AG. All rights reserved. 5

  • Unit 1: Approaching SAP HANA Modeling HA300

    Figure 5: General Modeling Principles

    Figure 6: Choosing Views for the Information Model : Approaching SAPHANA Modeling

    When deciding on what views will be most efficient for your Information Model,we recommend to follow the decision tree as a guide to identify the views youneed to create based on the analysis requirements.

    6 2012 SAP AG. All rights reserved. 2012

  • HA300 Lesson: Approaching HANA Modeling

    For the best performances and easier maintenance, it is important to stay on thetop three levels of the decision tree when ever possible.

    2012 2012 SAP AG. All rights reserved. 7

  • Unit 1: Approaching SAP HANA Modeling HA300

    Lesson Summary

    You should now be able to:

    Take into account Persistency Considerations

    Explain the different engine types in the SAP HANA Architecture

    To choose the best views for the Information Model

    To discuss some General Recommendations

    8 2012 SAP AG. All rights reserved. 2012

  • HA300 Unit Summary

    Unit SummaryYou should now be able to:

    Take into account Persistency Considerations

    Explain the different engine types in the SAP HANA Architecture

    To choose the best views for the Information Model

    To discuss some General Recommendations

    2012 2012 SAP AG. All rights reserved. 9

  • Unit Summary HA300

    10 2012 SAP AG. All rights reserved. 2012

  • Unit 2Connecting Tables

    Unit OverviewIn order to create optimal Information Models this unit will help you understandthe different types of joins SAP HANA supports when connecting data tables

    Unit ObjectivesAfter completing this unit, you will be able to:

    Explain differences between Inner Join, Left Outer Join, Right Outer Join,Text Join, Referential Join and Temporal Join when connecting tables.

    Explain how using Standard Union and Union with constant values.

    Unit ContentsLesson: Connecting Tables... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12

    2012 2012 SAP AG. All rights reserved. 11

  • Unit 2: Connecting Tables HA300

    Lesson: Connecting Tables

    Lesson OverviewThis module covers the following topics:

    How to connect tables using

    Inner Join

    Left Outer Join

    Right Outer Join

    Text Join

    Referential Join

    Temporal Join

    Union

    Lesson ObjectivesAfter completing this lesson, you will be able to:

    Explain differences between Inner Join, Left Outer Join, Right Outer Join,Text Join, Referential Join and Temporal Join when connecting tables.

    Explain how using Standard Union and Union with constant values.

    Business ExampleIn source system, the table containing sales orders does not contain customeraddresses or cities. Then we replicate them into SAP HANA and we have to joinseveral tables to obtain expected results.

    12 2012 SAP AG. All rights reserved. 2012

  • HA300 Lesson: Connecting Tables

    Connecting Tables

    Figure 7: Business Example: Connecting Tables

    Order 8 does not have a customer master record.

    Customer TOM does not have any orders.

    State TX does not have a description.

    No customer resides in Alabama.

    Figure 8: Join Types - Definitions and Referential Integrity

    Referential Joins

    2012 2012 SAP AG. All rights reserved. 13

  • Unit 2: Connecting Tables HA300

    Is semantically a inner join that assume that referential integrity is given whichmeans that the left table always have an corresponding entry on the right table. Itcould be used in e.g. data foundation for header-item relations where it can beassumed that for each item a header exists. It can be seen as an optimized or fasterinner join where the right table is not checked if no field from the right table isrequested. That means that the Referential Joins will be only executed, when fieldsfrom both tables are requested. Therefore, if a field is selected from the right tableit will act similar to inner join, and if no fields from the right table is selected itwill act similar to a left outer join. From performance perspective, the Left OuterJoin are almost equally fast as Referential Join, while the Inner Join is usuallyslower due to the fact, that the join is always executed.

    Referential joins should be used with caution since it assumes that referentialintegrity is ensured. The only valid scenario for the Referential Join is that (a) it is100% guaranteed that for each row in one table, there is at least one join partnerin the other table, and (b) that holds true in both directions (c) at all times. Ifthat is not the case then referential joins have the possibility to give incorrectcalculations if the referential integrity is not met meaning if a delivery header iscreated but the items is not processed until a later stage then any calculations thatuse referential joins will be incorrect.

    Figure 9: Inner Join - Attribute View - Connecting Tables

    14 2012 SAP AG. All rights reserved. 2012

  • HA300 Lesson: Connecting Tables

    Figure 10: Inner Join - Analytical View - Connecting Tables

    Figure 11: Inner Join and Design Time Filters - Connecting Tables

    2012 2012 SAP AG. All rights reserved. 15

  • Unit 2: Connecting Tables HA300

    Figure 12: Left Outer Join - Attribute View - Connecting Tables

    Figure 13: Left Outer Join - Analytical View - Connecting Tables

    16 2012 SAP AG. All rights reserved. 2012

  • HA300 Lesson: Connecting Tables

    Figure 14: Left Outer Join and Design Time Filters - Connecting Tables

    Figure 15: Right Outer Join - Attribute View - Connecting Tables

    Right outer join is rarely used, be aware, that the number of records in the resultset is determined by the number of records in the right table. This means that ifthere is a 1:n relationship the number of records can be greater that the number ofrecords in the left table.

    2012 2012 SAP AG. All rights reserved. 17

  • Unit 2: Connecting Tables HA300

    Figure 16: Right Outer Join - Analytical View - Connecting Tables

    Figure 17: Text Join - Connecting Tables

    18 2012 SAP AG. All rights reserved. 2012

  • HA300 Lesson: Connecting Tables

    Figure 18: Join Types - Text Join for multilingual reporting

    Figure 19: Referential Join - Connecting Tables

    Is semantically a inner join that assume that referential integrity is given whichmeans that the left table always have an corresponding entry on the right table. Itcould be used in e.g. data foundation for header-item relations where it can beassumed that for each item a header exists.

    It can be seen as an optimized or faster inner join where the right table is notchecked if no field from the right table is requested.

    That means that the Referential Joins will be only executed, when fields from bothtables are requested. Therefore, if a field is selected from the right table it willact similar to inner join, and if no fields from the right table is selected it willact similar to a left outer join.

    2012 2012 SAP AG. All rights reserved. 19

  • Unit 2: Connecting Tables HA300

    From performance perspective, the Left Outer Join are almost equally fast asReferential Join, while the Inner Join is usually slower due to the fact, that thejoin is always executed.

    Figure 20: Referential Join - Attribute View - Connecting Tables

    Figure 21: Referential Join - Analytical View - Connecting Tables

    20 2012 SAP AG. All rights reserved. 2012

  • HA300 Lesson: Connecting Tables

    Figure 22: Referential Join - Using MDX - Connecting Tables

    Referential joins should be used with caution since it assumes that referentialintegrity is ensured.

    The only valid scenario for the Referential Join is that (a) it is 110% guaranteedthat for each row in one table, there is at least one join partner in the other table,and (b) that holds true in both directions (c) at all times.

    If that is not the case then referential joins have the possibility to give incorrectcalculations if the referential integrity is not met meaning if a delivery header iscreated but the items is not processed until a later stage then any calculations thatuse referential joins will be incorrect.

    Referential Join cannot be used if a filter is set on a field in the right table.

    Figure 23: Temporal Join - Connecting Tables

    2012 2012 SAP AG. All rights reserved. 21

  • Unit 2: Connecting Tables HA300

    Despite an impact on performance, Temporal Join are really useful to manage timedependant AttributeViews (Master Data).

    Figure 24: Calculation View - Join vs. Union - Connecting Tables

    Figure 25: Unions - Connecting Tables

    22 2012 SAP AG. All rights reserved. 2012

  • HA300 Lesson: Connecting Tables

    Figure 26: Standard Union - Connecting Tables

    Figure 27: Union with Constant Values - Connecting Tables

    2012 2012 SAP AG. All rights reserved. 23

  • Unit 2: Connecting Tables HA300

    Lesson Summary

    You should now be able to:

    Explain differences between Inner Join, Left Outer Join, Right Outer Join,Text Join, Referential Join and Temporal Join when connecting tables.

    Explain how using Standard Union and Union with constant values.

    24 2012 SAP AG. All rights reserved. 2012

  • HA300 Unit Summary

    Unit SummaryYou should now be able to:

    Explain differences between Inner Join, Left Outer Join, Right Outer Join,Text Join, Referential Join and Temporal Join when connecting tables.

    Explain how using Standard Union and Union with constant values.

    2012 2012 SAP AG. All rights reserved. 25

  • Unit Summary HA300

    26 2012 SAP AG. All rights reserved. 2012

  • Unit 3Advanced Modeling

    Unit OverviewThis unit will give you a good knowledge base on how to utilize the SAP HANAModeling functionality to create the different types of Information Modelsavailable. It will also help you perform Currency Conversion and use SAP HANASQL Script.

    Unit ObjectivesAfter completing this unit, you will be able to:

    Explain how to create derived attribute views

    Explain how to create shared attribute views

    Explain how to create calculated columns

    Explain how to create time characteristics based attribute views

    Explain how to create stand alone text tables

    Explain how to use base table aliases

    Explain how to include hidden attributes in an attribute view

    Explain how to implement leveled hierarchies

    Explain how to leverage parent / child hierarchies

    Explain how to create attribute based hierarchies

    Understand the benefits of Restricted Columns

    Use Restricted Columns

    Understand when to use Calculated Columns

    Create Calculated Columns

    Explain how to compare constraint filter and WHERE clause

    Explain how to create client dependant views

    Explain how to model domain fix values

    Explain the difference between Variables and Input Parameters

    Create Variables

    Create Input Parameters

    Explain how to create calculated attributes in a calculation view

    2012 2012 SAP AG. All rights reserved. 27

  • Unit 3: Advanced Modeling HA300

    Explain how to create simple calculation views (non aggregate)

    Explain how to use the aggregation node

    Explain how to define unmapped columns in a union node

    Explain the language elements used in SAP HANA SQL statements.

    Explain SQLScript and SQLScript extensions

    Explain SQLScript implementation logic

    Create and call a Procedure

    Explain calculation engine and calculation model

    Explain functionality of Calculation engine operators

    Understand Currency Conversion in SAP HANA

    Apply Currency Conversion in Analytic Views

    Leverage Fixed Currencies

    Leverage Source Currency from Attributes

    Create Target Currency Variables

    Use Currency conversion in Calculation Views

    Understand decision automation using Business Rules on SAP HANA

    Understand how Decision Tables can help driving business agility

    Create Decision Tables

    Consume Decision Tables in Calculation Views

    Unit ContentsLesson: Creating Attribute Views ... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30

    Exercise 1: System Preparation ... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37Exercise 2: Creating Attribute Views... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55

    Lesson: Using Hierarchies... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 88Exercise 3: Using Hierarchies ... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 97

    Lesson: Creating Restricted & Calculated Columns ... . . . . . . . . . . . . . . . . . . . .112Exercise 4: Creating Restricted & Calculated Measures... . . . . . . . . . . .119

    Lesson: Using Filter Operations ... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .137Exercise 5: Using Filter Operations ... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .143

    Lesson: Using Variables ... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .151Exercise 6: Using Variables ... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .159

    Lesson: Creating Calculation Views... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .170Exercise 7: Creating Calculation Views ... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .175

    Lesson: SAP HANA SQL Introduction ... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .183Exercise 8: Working with SQL Statements.. . . . . . . . . . . . . . . . . . . . . . . . . . . . .195

    Lesson: SQLScript and Procedures... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .200Exercise 9: Creating a simple Calculation View of type SQL Script .219Exercise 10: Creating a Calculation View of type SQL Script usingCE_FUNCTIONs ... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .225Exercise 11: Creating Procedures ... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .233

    28 2012 SAP AG. All rights reserved. 2012

  • HA300 Unit 3: Advanced Modeling

    Exercise 12: Creating a Calculation View of type SQL Script usingprocedures... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .241

    Lesson: Using Currency Conversion ... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .249Exercise 13: Currency Conversions in Analytic Views ... . . . . . . . . . . . . .265

    Lesson: Turning Business Rules into Decision Tables... . . . . . . . . . . . . . . . . . .272Exercise 14: Creating Decision Tables ... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .279

    2012 2012 SAP AG. All rights reserved. 29

  • Unit 3: Advanced Modeling HA300

    Lesson: Creating Attribute Views

    Lesson OverviewThis module covers the following topics:

    Derived Attribute Views

    Shared Attribute Views

    Calculated Attributes

    Time Characteristics Based Attribute Views

    Stand Alone Text Tables

    Using Base Table Aliases

    Hidden Attributes

    Lesson ObjectivesAfter completing this lesson, you will be able to:

    Explain how to create derived attribute views

    Explain how to create shared attribute views

    Explain how to create calculated columns

    Explain how to create time characteristics based attribute views

    Explain how to create stand alone text tables

    Explain how to use base table aliases

    Explain how to include hidden attributes in an attribute view

    Business ExampleI need to create a view regrouping my customers informations (for example, name,ID, Country, City, Address, Phone, Customer category, etc.) coming from differenttables. It will become my Master Data Customer or my Attribute View Customer.

    30 2012 SAP AG. All rights reserved. 2012

  • HA300 Lesson: Creating Attribute Views

    Creating Attribute Views

    Figure 28: Concept Attribute views - Creating Attribute Views

    Attribute views are used to give master data tables context. This context isprovided by text tables which give meaning to the master data. For example, if ourfact table or analytic view only contains some numeric ID for elink in informationabout each dealer using an attribute view. We could then display the dealers namesand addresses instead of their IDs thus providing the context for the master ach cardealer then we can 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 todefine 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.

    Figure 29: Derived Attribute Views - Creating Attribute Views

    2012 2012 SAP AG. All rights reserved. 31

  • Unit 3: Advanced Modeling HA300

    In some business cases, it is required touse the same attribute view more thanonce. (Example :Two logical join of different join types but defined on the sameattribute view.)

    In such cases, one can derive an attribute view using the base view which actsas reference to the base attribute view.

    The derived attribute view will be opened in the read only mode. The onlyeditable field will be its description.

    The derived attribute view will act as a reference to its base attribute view.

    Figure 30: Shared Attribute Views - Creating Attribute Views

    Previous, we saw that Attribute views are used to give master data tables context.In according to that statement, Attribute Views are reusable objects. So oneAttribute View can be shared between several Analytic Views.

    For example, Product Attribute View can be used in the Purchase Order AnalyticalView and in the same time in the Sales Order Analytic View.

    32 2012 SAP AG. All rights reserved. 2012

  • HA300 Lesson: Creating Attribute Views

    Figure 31: Calculated Columns - Creating Attribute Views

    Calculated columns are similar to Calculated Measures by behavior. There arebusiness needs where in users would like to derive columns using availablecolumns and calculated columns.

    The existing Calculated Columns behavior are extended to support calculatedcolumns where in users are allowed to use non measure attributes also part ofthe calculation.

    The calculation could be an arithmetic or character manipulation.

    Ideally it is better to classify all calculated attributes in one place. Oncecreated will behave like any other attributes in the whole informationmodeling paradigm.

    Optionally this could be extended to Attribute View and Calculation View.

    2012 2012 SAP AG. All rights reserved. 33

  • Unit 3: Advanced Modeling HA300

    Figure 32: Time Characteristics Attribute View - Creating Attribute Views

    In business, different calendars are used different purposes with different fiscalperiods which need not align with Calendar and Calendar Periods. The analyticswill support information needs in accordance to the calendar that are defined forreporting using fiscal calendars.

    The Calendar Attribute view will be of a new type calendar (Time Type) thatare very similar to Time Attribute Views.

    User will be able to generate different calendars and periods as defined inERP System using ERP Fiscal Calendar tables.

    34 2012 SAP AG. All rights reserved. 2012

  • HA300 Lesson: Creating Attribute Views

    Figure 33: Creating Stand Alone Text Tables - Creating Attribute Views

    In some cases, there is no combination of valuetable and text table that can bejoined with a text join and language field mapping ending up in an Attribute View.

    But still we need to model those in a way that supports dynamic language handlingin terms of the texts.

    Those tables shall be included in an Attribute View with a dynamic filter on thelanguage field ($$language$$).

    In the Analytical View they are used as normal. Don't use the Text Join in theAnalytical View ! Its not supported and will be removed from the drop-downlist box soon.

    2012 2012 SAP AG. All rights reserved. 35

  • Unit 3: Advanced Modeling HA300

    Figure 34: Using Multiple Base Tables Using Aliases - Creating AttributeViews

    By adding the table again, just as when adding it the first time, a prompt box willask you to provide an alias for the new instance of the base table.

    Figure 35: Hidden Attributes - Creating Attribute Views

    36 2012 SAP AG. All rights reserved. 2012

  • HA300 Lesson: Creating Attribute Views

    Exercise 1: System Preparation

    Exercise ObjectivesAfter completing this exercise, you will be able to:

    Prepare your system for the usage of SAP HANA Studio

    Business ExampleYou are at a customer site and need to log in to the SAP HANA Studio and createa connection the SAP HANA Instance.

    Task 1:System Preparation SAP HANA Studio

    1. To Logon to the WTS landscape go to:

    Start-Menu Common-Training

    Remote Desktop into Server

    Create a remote desktop connection to another desktop. (connectioninformation will be given by the instructor)

    Start the Remote Desktop Connection as shown in the screenshot below.

    Use the path: Start Menu Remote Desktop Connection

    Figure 36: Start

    In the next screen you have to choose one of the available remote desktopservers.

    Note: Type the name of the Server specified by your instructor)

    Continued on next page

    2012 2012 SAP AG. All rights reserved. 37

  • Unit 3: Advanced Modeling HA300

    Figure 37: Remote Desktop Connection

    Click Connect.

    In the Remote Desktop Connection dialog box enter user name and passwordgiven by the instructor.

    Figure 38: Log On to Windows

    Open Modeler

    Hint: Hit x to close the overview screen.

    Continued on next page

    38 2012 SAP AG. All rights reserved. 2012

  • HA300 Lesson: Creating Attribute Views

    Figure 39: Studio Preference

    From the Studio preferences option, change the network setting to the Direct.Go to Window Preferences General Network Connections

    Register a new System.

    Right Click Add System... within the Navigator view.

    Continued on next page

    2012 2012 SAP AG. All rights reserved. 39

  • Unit 3: Advanced Modeling HA300

    Figure 40: System

    Enter the Hostname, Instance Number and Description as given by theinstructor.

    Click Next.

    Enter your credentials as given by your instructor.

    Figure 41: System

    Change your initial password

    Continued on next page

    40 2012 SAP AG. All rights reserved. 2012

  • HA300 Lesson: Creating Attribute Views

    Figure 42: System - Change Password

    Minimum 8 characters

    Must contain capital and small letters

    Must contain numbers

    Example: Abcd1234

    Hint: Hint: If prompted for a security fallback for your password,click No.

    Note: If your HANA system is not properly connected to the SAPHANA Studio (status is red), choose Refresh from the context menu.If necessary, close and reopen the SAP HANA Studio.

    Create a new package.

    Figure 43: New Package

    Select the Content folder Right Click New Package.

    Enter studentXX for the package name and description.

    Enter your user ID studentXX for Person Responsible.

    Continued on next page

    2012 2012 SAP AG. All rights reserved. 41

  • Unit 3: Advanced Modeling HA300

    Figure 44: Package Name & Description

    You do not need to assign a Delivery Unit at the moment. This will becovered later in the exercises.

    As a result you will see the newly created package. Please note that thefolder structure is initially empty until you start to create new objects.

    Figure 45: Delivery Unit

    Task 2:System Preparation Resources Perspective

    1. On the top right hand side of the SAP HANA Studio click on the icon andopen the RESOURCES perspective.

    Figure 46: Resources Perspective

    Go to START My Documents Content transport on kpstransfer

    Continued on next page

    42 2012 SAP AG. All rights reserved. 2012

  • HA300 Lesson: Creating Attribute Views

    Figure 47: Content transport on kpstransfer

    Log in using the following credentials:

    Username: training

    Pwd: hanareadonly

    Then navigate to the following directory and copy the path.

    Figure 48: Log In

    In the Resources perspective, right click in Project Explorer and chooseIMPORT from the context menu.

    Paste the path.

    Figure 49: Project Explorer

    On the next screen paste the path to the select root directory and click on thewhite space to choose the project.

    Continued on next page

    2012 2012 SAP AG. All rights reserved. 43

  • Unit 3: Advanced Modeling HA300

    Figure 50: Project

    You should now have all the course files.

    Figure 51: Course Files

    Task 3:Preparation: Display Data from Models

    1. Execute a prepared SQL command to grant SELECT on your schema to_SYS_REPO.

    Now go to the RESOURCES perspective, right click and open the file001_Preparation.sql

    In SAP HANA Studio, on the top right hand side click on the icon to choosea connection.

    Click on the Catalog of the connection and click on OK.

    Change the generic entry STUDENT## to your user ID (where ## representsyour two digit group number, e.g. STUDENT02)

    Execute.

    Use execute icon or press F8

    Continued on next page

    44 2012 SAP AG. All rights reserved. 2012

  • HA300 Lesson: Creating Attribute Views

    Figure 52: Preparation: Display Data from Models

    2012 2012 SAP AG. All rights reserved. 45

  • Unit 3: Advanced Modeling HA300

    Solution 1: System Preparation

    Task 1:System Preparation SAP HANA Studio

    1. To Logon to the WTS landscape go to:

    Start-Menu Common-Training

    Remote Desktop into Server

    Create a remote desktop connection to another desktop. (connectioninformation will be given by the instructor)

    Start the Remote Desktop Connection as shown in the screenshot below.

    Use the path: Start Menu Remote Desktop Connection

    Figure 53: Start

    In the next screen you have to choose one of the available remote desktopservers.

    Note: Type the name of the Server specified by your instructor)

    Continued on next page

    46 2012 SAP AG. All rights reserved. 2012

  • HA300 Lesson: Creating Attribute Views

    Figure 54: Remote Desktop Connection

    Click Connect.

    In the Remote Desktop Connection dialog box enter user name and passwordgiven by the instructor.

    Figure 55: Log On to Windows

    Open Modeler

    Hint: Hit x to close the overview screen.

    Continued on next page

    2012 2012 SAP AG. All rights reserved. 47

  • Unit 3: Advanced Modeling HA300

    Figure 56: Studio Preference

    From the Studio preferences option, change the network setting to the Direct.Go to Window Preferences General Network Connections

    Register a new System.

    Right Click Add System... within the Navigator view.

    Continued on next page

    48 2012 SAP AG. All rights reserved. 2012

  • HA300 Lesson: Creating Attribute Views

    Figure 57: System

    Enter the Hostname, Instance Number and Description as given by theinstructor.

    Click Next.

    Enter your credentials as given by your instructor.

    Figure 58: System

    Change your initial password

    Continued on next page

    2012 2012 SAP AG. All rights reserved. 49

  • Unit 3: Advanced Modeling HA300

    Figure 59: System - Change Password

    Minimum 8 characters

    Must contain capital and small letters

    Must contain numbers

    Example: Abcd1234

    Hint: Hint: If prompted for a security fallback for your password,click No.

    Note: If your HANA system is not properly connected to the SAPHANA Studio (status is red), choose Refresh from the context menu.If necessary, close and reopen the SAP HANA Studio.

    Create a new package.

    Figure 60: New Package

    Select the Content folder Right Click New Package.

    Enter studentXX for the package name and description.

    Enter your user ID studentXX for Person Responsible.

    Continued on next page

    50 2012 SAP AG. All rights reserved. 2012

  • HA300 Lesson: Creating Attribute Views

    Figure 61: Package Name & Description

    You do not need to assign a Delivery Unit at the moment. This will becovered later in the exercises.

    As a result you will see the newly created package. Please note that thefolder structure is initially empty until you start to create new objects.

    Figure 62: Delivery Unit

    a)

    Task 2:System Preparation Resources Perspective

    1. On the top right hand side of the SAP HANA Studio click on the icon andopen the RESOURCES perspective.

    Figure 63: Resources Perspective

    Go to START My Documents Content transport on kpstransfer

    Continued on next page

    2012 2012 SAP AG. All rights reserved. 51

  • Unit 3: Advanced Modeling HA300

    Figure 64: Content transport on kpstransfer

    Log in using the following credentials:

    Username: training

    Pwd: hanareadonly

    Then navigate to the following directory and copy the path.

    Figure 65: Log In

    In the Resources perspective, right click in Project Explorer and chooseIMPORT from the context menu.

    Paste the path.

    Figure 66: Project Explorer

    On the next screen paste the path to the select root directory and click on thewhite space to choose the project.

    Continued on next page

    52 2012 SAP AG. All rights reserved. 2012

  • HA300 Lesson: Creating Attribute Views

    Figure 67: Project

    You should now have all the course files.

    Figure 68: Course Files

    a)

    Task 3:Preparation: Display Data from Models

    1. Execute a prepared SQL command to grant SELECT on your schema to_SYS_REPO.

    Now go to the RESOURCES perspective, right click and open the file001_Preparation.sql

    In SAP HANA Studio, on the top right hand side click on the icon to choosea connection.

    Click on the Catalog of the connection and click on OK.

    Change the generic entry STUDENT## to your user ID (where ## representsyour two digit group number, e.g. STUDENT02)

    Execute.

    Use execute icon or press F8

    Continued on next page

    2012 2012 SAP AG. All rights reserved. 53

  • Unit 3: Advanced Modeling HA300

    Figure 69: Preparation: Display Data from Models

    a)

    54 2012 SAP AG. All rights reserved. 2012

  • HA300 Lesson: Creating Attribute Views

    Exercise 2: Creating Attribute Views

    Exercise ObjectivesAfter completing this exercise, you will be able to:

    Create and Use Derived Attribute Views

    Use Shared Attribute Views

    Create and Use Calculated Attributes in Attribute Views

    Business ExampleYou are at a customer site where EPM data is available. Information of theBusiness Partners is dispatched in several tables. The purpose will be to regroupInformation of the Business Partners and to analyze Purchase Orders by Productand Partners.

    So you have been asked to build Attribute Views and Analytic Views for HANA.

    This section takes you through the process to create the Attribute Views andAnalytical Views to be used for reporting.

    Task 1:Close all open views prior to creating a new attribute view for Business Partners.

    1. Create an attribute view AT_HA300_UNIT3_BP_TRAINXX (xx beingyour student number), with description Business Partners. Use yourpackage STUDENTXX. (If it does not exit, please create a new one.)

    Attribute Type: Standard

    Press Next.

    Add the following tables in the Data Foundation, from the EPM_MODELschema, to define the view and click Finish when done:

    EPM_MODEL.SNWD_BP

    EPM_MODEL.SNWD_BP_PH

    EPM_MODEL.SNWD_CONTACT

    EPM_MODEL.SNWD_BP_EM

    Continued on next page

    2012 2012 SAP AG. All rights reserved. 55

  • Unit 3: Advanced Modeling HA300

    Figure 70: Add tables

    Join tables with a referential join and cardinality 1:1.

    SNWD_BP is considered as the left table, others as right tables.

    Join field CLIENT of the left table to fields CLIENT of each right tables.

    Join field NODE_KEY of the left table to fields PARTNER_GUID foreach right table.

    Figure 71: Creating joins

    Add to Output (right click on the table on the Data Foundation tab) fromtable SNWD_BP:

    BP_ID Key Attribute

    CLIENT Attribute

    NODE KEY Attribute

    Continued on next page

    56 2012 SAP AG. All rights reserved. 2012

  • HA300 Lesson: Creating Attribute Views

    Add to Output from table SNWD_CONTACT as Attributes

    FIRST_NAME

    LAST_NAME

    LANGUAGE

    Add to Output from table SNWD_BP_PH as Attributes:

    PHONE_NUMBER

    PHONE_EXTENSION

    Add to Output from table SNWD_EM as an Attribute:

    EMAIL_ADDRESS

    Figure 72: Add columns to output

    In the Semantics view, define all columns as attributes, making BP_IDa Key Attribute

    Figure 73: Define semantics

    Activate.

    View the logs. Dependent objects that are already active, do not getreactivated.

    From the context menu of AT_HA300_UNIT3_BP_TRAINXX, view theresults by selecting Data Preview.

    Continued on next page

    2012 2012 SAP AG. All rights reserved. 57

  • Unit 3: Advanced Modeling HA300

    In the Data Preview, select the Raw Data tab to see the actual data.

    Close.

    Task 2:Create an attribute view for Products.

    1. Create an attribute view AT_HA300_UNIT3_PD_TRAINXX (XX beingyour student number allocated), with description Products.

    Attribute type: Standard.

    Add table in the Data Foundation tabEPM_MODEL.SNWD_PD.

    Finish.

    Figure 74: Add tables

    Define the following fields (add to Output doing a right click on the tablein the Data Foundation tab):

    PRODUCT_ID Key Attribute.

    CLIENT Attribute.

    NODE_KEY Attribute.

    TYPE_CODE Attribute.

    CATEGORY Attribute.

    SUPPLIER_GUID Attribute.

    Continued on next page

    58 2012 SAP AG. All rights reserved. 2012

  • HA300 Lesson: Creating Attribute Views

    Figure 75: Add columns to output

    In the Semantics view, define all columns as attributes, makingPRODUCT_ID a Key Attribute

    Figure 76: Define semantics

    Save and Activate.

    From the context menu of AT_HA300_UNIT3_PD_TRAINXX, view theresults by selecting Data Preview.

    In the Data Preview, select the Raw Data tab to see the actual data.

    Close.

    Task 3:Create an Analytic View for Purchase Orders.

    1. Create an analytic view AN_HA300_UNIT3_PO_TRAINxx (xx being yourstudent number allocated), with description Purchase Orders. .

    Continued on next page

    2012 2012 SAP AG. All rights reserved. 59

  • Unit 3: Advanced Modeling HA300

    Press Next.

    Add the following tables in the Data Foundation tab:EPM_MODEL.SNWD_PO

    EPM_MODEL.SNWD_PO_I

    Figure 77: Add tables

    Add the following Attribute views from your Package, student##:

    AT_HA300_UNIT3_BP_TRAINXX and

    AT_HA300_UNIT3_PD_TRAINXX

    Click Finish

    Figure 78: Add Attribute Views

    Choose OK.

    Continued on next page

    60 2012 SAP AG. All rights reserved. 2012

  • HA300 Lesson: Creating Attribute Views

    CLIENT and NODE-KEY are fields that are in both of the AttributeViews, so the system sees these as duplicate entities.

    Make further adjustments in the Output section of this Analytic View.

    To manually adjust the proposal we just need to add a unique Alias Name toCLIENT and NODE_KEY in one of the Attribute Views.

    Under the Attribute Views folder of the output pane, selectAT_HA300_UNIT3_PD_TRAINXX.

    From the Properties tab for CLIENT on the Scemantics screen, change thevalue for Alias Name and Description to CLIENT_PD_ALIAS.

    From the Properties tab for NODE_KEY, change the value for Alias Nameand Description to NODE_KEY_PD_ALIAS.

    Save your changes.

    Figure 79: Set properties

    In the DATA FOUNDATION, join the two tables.

    Table SNWD_PO is the left table.

    Join the field CLIENT from SNWD_PO to the CLIENT field inSNWD_PO_I.

    Join the field NODE_KEY (SNWD_PO) with the field PARENT_KEY(SNWD_PO_I).

    For the join properties, select Referential join and a cardinality of 1:n forboth joins in the properties of the join.

    From the table SNWD_PO, define the following fields as Attributes

    CLIENT

    Continued on next page

    2012 2012 SAP AG. All rights reserved. 61

  • Unit 3: Advanced Modeling HA300

    PO_ID

    PARTNER_GUID

    In the Logical View screen in the output, under the Column folder, renameCLIENT (SNWD_PO.CLIENT) to Client_BP, for Business Partner client.

    Figure 80: Set properties

    From the table SNWD_PO_I, define the following fields

    CLIENT, Attribute

    PO_ITEM_POS Attribute

    PRODUCT_GUID Attribute

    GROSS_AMOUNT Measure

    NET_AMOUNT Measure

    In the Logical View screen in the output, under the Column folder, renameCLIENT (SNWD_PO_I.CLIENT) to Client_PD, for Product Client.

    Figure 81: Set properties

    Save your Analytic View.Continued on next page

    62 2012 SAP AG. All rights reserved. 2012

  • HA300 Lesson: Creating Attribute Views

    In the logical view, join the data foundation to the Product view with thefollowing fields. Use referential join and cardinality of n:1

    CLIENT_PD to Client

    PRODUCT_GUID to NODE_KEY ("Product" view)

    Then, join the data foundation to the Business Partner view with thefollowing fields. Use referential join and cardinality of n:1

    CLIENT_BP to Client

    PARTNER_GUID to NODE_KEY ("Partner" view)

    Figure 82: Define joins

    Figure 83: Define joins

    In the Semantics screen, define the column PO_ITEM_POS as an attribute,and the columns GROSS_AMOUNT and NET_AMOUNT as measures.

    Continued on next page

    2012 2012 SAP AG. All rights reserved. 63

  • Unit 3: Advanced Modeling HA300

    Figure 84: Define semantics

    Save and Activate.

    View the Log. From the context menu ofAN_HA300_UNIT3_PO_TRAINxx, select Data Preview to review thecontents.

    Close

    Task 4:Create a derived attribute view from the "Product" view.

    1. Try to add the Attribute View, AT_HA300_UNIT3_PD_TRAINXX , to theanalytic view AN_HA300_UNIT3_PO_TRAINXX again, by dragging theAttribute View from the Navigator to the Logical View of the Analytic View.What is the result? (Not possible).

    Note: To add another Attribute view to an existing Analytic View,just select the Attribute from the Navigator and drag it into theLogical view of the Analytic View. If you try to drag an AttributeView into an Analytic View that already exists in the Analytic View,it will not work.

    If your model requires that you have 2 identical Attribute Views in the sameAnalytical View, you will have to create a Derived Attribute with Aliases.

    Create a new Attribute View, AT_HA300_UNIT3_PD_DERIVED, derivedfrom AT_HA300_UNIT3_PD_TRAINXX.

    Note: To create a Derived Attribute View, choose Subtype: Derivedfrom within the New Information View screen.

    Continued on next page

    64 2012 SAP AG. All rights reserved. 2012

  • HA300 Lesson: Creating Attribute Views

    Figure 85: Create a derived attribute

    Can you modify the derived attribute view?

    Save.

    Activate the Derived Attribute View, AT_HA300_UNIT3_PD_DERIVED.

    Figure 86: A derived attribute view

    Add the new Derived Attribute View to the Analytic View,AN_HA300_UNIT3_PO_Train##, by dragging it from the Navigator to theLogical view in the Analytic View.

    Continued on next page

    2012 2012 SAP AG. All rights reserved. 65

  • Unit 3: Advanced Modeling HA300

    In the Logical View screen (of the previous Analytic View), join it to theData Foundation by mapping the following fields:

    Client_PD to Client

    Product_GUID to Node_Key. (DataFoundation is on the left.)

    Create aliases by adding "DERIVED" to the Alias Name and AliasDescription for each field of the derived attribute view fields in the propertiesof each fields in the Logical View screen of the Analytic View.

    Example, CLIENT:

    Figure 87: Create aliases

    When completed, all fields in the Derived Attribute have aliases:

    Can you modify the join between the data foundation and the derivedattribute view?

    Yes

    Save

    Activate

    Continued on next page

    66 2012 SAP AG. All rights reserved. 2012

  • HA300 Lesson: Creating Attribute Views

    Figure 88: Activate

    View the results

    Close

    Task 5:Create a new Analytic View for Sales Orders and reuse the shared ProductAttribute view.

    1. Create an Analytic View, AN_HA300_UNIT3_SO_TRAINXX, withdescription "Sales Order".

    Next.

    Add the table EPM_MODEL.SNWD_SO_I.

    Finish.

    Add the following fields to output in the Data Foundation screen:

    CLIENT Attribute

    SO_ITEM_POS Attribute

    CURRENCY_CODE Attribute

    PRODUCT_GUID Attribute

    Gross_Amount Measure

    Net_Amount. Measure

    Continued on next page

    2012 2012 SAP AG. All rights reserved. 67

  • Unit 3: Advanced Modeling HA300

    Figure 89: Create an analytic view

    In the Logical View screen, drag the Product Attribute View,AT_HA300_UNIT3_PD_TRAINXX, into the Analytic View. Join witha referential join (cardinality n,1) the Data Foundation (on the left) to theProduct Attribute view with fields the following fields:

    CLIENT to CLIENT (Product Attribute View)

    PRODUCT_GUID to NODE_KEY (Product Attribute View).

    Figure 90: Join Attribute views

    Save. Validate. Activate.

    View the results. Close.

    Task 6:(Optional) Modify the "Partner" view and create a calculated attribute. We want tomerge the phone extension and the phone number.

    1. Open AT_HA300_UNIT3_BP_TRAINxx.

    Create a new calculated attribute and name it PHONE_NUMBER_EX-TENSION with Data type VARCHAR and Length 20.

    Define the following formula:

    Continued on next page

    68 2012 SAP AG. All rights reserved. 2012

  • HA300 Lesson: Creating Attribute Views

    if PHONE_EXTENSION is null, take PHONE_NUMBER, if not, mergePHONE_EXTENSION with PHONE_NUMBER.

    Figure 91: Create a calculated attribute

    Validate. Save. Activate.

    View the result.

    Now open the Attribute View again. Hide the fields PHONE_NUMBERand PHONE_EXTENSION, by setting the Hidden property to True forthese 2 fields in the Data Foundation View screen.

    Continued on next page

    2012 2012 SAP AG. All rights reserved. 69

  • Unit 3: Advanced Modeling HA300

    Figure 92: Hide attributes

    Save and Activate. View the results. Close.

    70 2012 SAP AG. All rights reserved. 2012

  • HA300 Lesson: Creating Attribute Views

    Solution 2: Creating Attribute Views

    Task 1:Close all open views prior to creating a new attribute view for Business Partners.

    1. Create an attribute view AT_HA300_UNIT3_BP_TRAINXX (xx beingyour student number), with description Business Partners. Use yourpackage STUDENTXX. (If it does not exit, please create a new one.)

    Attribute Type: Standard

    Press Next.

    Add the following tables in the Data Foundation, from the EPM_MODELschema, to define the view and click Finish when done:

    EPM_MODEL.SNWD_BP

    EPM_MODEL.SNWD_BP_PH

    EPM_MODEL.SNWD_CONTACT

    EPM_MODEL.SNWD_BP_EM

    Figure 93: Add tables

    Join tables with a referential join and cardinality 1:1.

    SNWD_BP is considered as the left table, others as right tables.

    Join field CLIENT of the left table to fields CLIENT of each right tables.

    Join field NODE_KEY of the left table to fields PARTNER_GUID foreach right table.

    Continued on next page

    2012 2012 SAP AG. All rights reserved. 71

  • Unit 3: Advanced Modeling HA300

    Figure 94: Creating joins

    Add to Output (right click on the table on the Data Foundation tab) fromtable SNWD_BP:

    BP_ID Key Attribute

    CLIENT Attribute

    NODE KEY Attribute

    Add to Output from table SNWD_CONTACT as Attributes

    FIRST_NAME

    LAST_NAME

    LANGUAGE

    Add to Output from table SNWD_BP_PH as Attributes:

    PHONE_NUMBER

    PHONE_EXTENSION

    Add to Output from table SNWD_EM as an Attribute:

    EMAIL_ADDRESS

    Figure 95: Add columns to output

    Continued on next page

    72 2012 SAP AG. All rights reserved. 2012

  • HA300 Lesson: Creating Attribute Views

    In the Semantics view, define all columns as attributes, making BP_IDa Key Attribute

    Figure 96: Define semantics

    Activate.

    View the logs. Dependent objects that are already active, do not getreactivated.

    From the context menu of AT_HA300_UNIT3_BP_TRAINXX, view theresults by selecting Data Preview.

    In the Data Preview, select the Raw Data tab to see the actual data.

    Close.

    Task 2:Create an attribute view for Products.

    1. Create an attribute view AT_HA300_UNIT3_PD_TRAINXX (XX beingyour student number allocated), with description Products.

    Attribute type: Standard.

    Add table in the Data Foundation tabEPM_MODEL.SNWD_PD.

    Finish.

    Continued on next page

    2012 2012 SAP AG. All rights reserved. 73

  • Unit 3: Advanced Modeling HA300

    Figure 97: Add tables

    Define the following fields (add to Output doing a right click on the tablein the Data Foundation tab):

    PRODUCT_ID Key Attribute.

    CLIENT Attribute.

    NODE_KEY Attribute.

    TYPE_CODE Attribute.

    CATEGORY Attribute.

    SUPPLIER_GUID Attribute.

    Continued on next page

    74 2012 SAP AG. All rights reserved. 2012

  • HA300 Lesson: Creating Attribute Views

    Figure 98: Add columns to output

    In the Semantics view, define all columns as attributes, makingPRODUCT_ID a Key Attribute

    Figure 99: Define semantics

    Save and Activate.

    From the context menu of AT_HA300_UNIT3_PD_TRAINXX, view theresults by selecting Data Preview.

    In the Data Preview, select the Raw Data tab to see the actual data.

    Close.

    Task 3:Create an Analytic View for Purchase Orders.

    1. Create an analytic view AN_HA300_UNIT3_PO_TRAINxx (xx being yourstudent number allocated), with description Purchase Orders. .

    Continued on next page

    2012 2012 SAP AG. All rights reserved. 75

  • Unit 3: Advanced Modeling HA300

    Press Next.

    Add the following tables in the Data Foundation tab:EPM_MODEL.SNWD_PO

    EPM_MODEL.SNWD_PO_I

    Figure 100: Add tables

    Add the following Attribute views from your Package, student##:

    AT_HA300_UNIT3_BP_TRAINXX and

    AT_HA300_UNIT3_PD_TRAINXX

    Click Finish

    Figure 101: Add Attribute Views

    Choose OK.

    Continued on next page

    76 2012 SAP AG. All rights reserved. 2012

  • HA300 Lesson: Creating Attribute Views

    CLIENT and NODE-KEY are fields that are in both of the AttributeViews, so the system sees these as duplicate entities.

    Make further adjustments in the Output section of this Analytic View.

    To manually adjust the proposal we just need to add a unique Alias Name toCLIENT and NODE_KEY in one of the Attribute Views.

    Under the Attribute Views folder of the output pane, selectAT_HA300_UNIT3_PD_TRAINXX.

    From the Properties tab for CLIENT on the Scemantics screen, change thevalue for Alias Name and Description to CLIENT_PD_ALIAS.

    From the Properties tab for NODE_KEY, change the value for Alias Nameand Description to NODE_KEY_PD_ALIAS.

    Save your changes.

    Figure 102: Set properties

    In the DATA FOUNDATION, join the two tables.

    Table SNWD_PO is the left table.

    Join the field CLIENT from SNWD_PO to the CLIENT field inSNWD_PO_I.

    Join the field NODE_KEY (SNWD_PO) with the field PARENT_KEY(SNWD_PO_I).

    For the join properties, select Referential join and a cardinality of 1:n forboth joins in the properties of the join.

    From the table SNWD_PO, define the following fields as Attributes

    CLIENT

    Continued on next page

    2012 2012 SAP AG. All rights reserved. 77

  • Unit 3: Advanced Modeling HA300

    PO_ID

    PARTNER_GUID

    In the Logical View screen in the output, under the Column folder, renameCLIENT (SNWD_PO.CLIENT) to Client_BP, for Business Partner client.

    Figure 103: Set properties

    From the table SNWD_PO_I, define the following fields

    CLIENT, Attribute

    PO_ITEM_POS Attribute

    PRODUCT_GUID Attribute

    GROSS_AMOUNT Measure

    NET_AMOUNT Measure

    In the Logical View screen in the output, under the Column folder, renameCLIENT (SNWD_PO_I.CLIENT) to Client_PD, for Product Client.

    Figure 104: Set properties

    Save your Analytic View.Continued on next page

    78 2012 SAP AG. All rights reserved. 2012

  • HA300 Lesson: Creating Attribute Views

    In the logical view, join the data foundation to the Product view with thefollowing fields. Use referential join and cardinality of n:1

    CLIENT_PD to Client

    PRODUCT_GUID to NODE_KEY ("Product" view)

    Then, join the data foundation to the Business Partner view with thefollowing fields. Use referential join and cardinality of n:1

    CLIENT_BP to Client

    PARTNER_GUID to NODE_KEY ("Partner" view)

    Figure 105: Define joins

    Figure 106: Define joins

    In the Semantics screen, define the column PO_ITEM_POS as an attribute,and the columns GROSS_AMOUNT and NET_AMOUNT as measures.

    Continued on next page

    2012 2012 SAP AG. All rights reserved. 79

  • Unit 3: Advanced Modeling HA300

    Figure 107: Define semantics

    Save and Activate.

    View the Log. From the context menu ofAN_HA300_UNIT3_PO_TRAINxx, select Data Preview to review thecontents.

    Close

    Task 4:Create a derived attribute view from the "Product" view.

    1. Try to add the Attribute View, AT_HA300_UNIT3_PD_TRAINXX , to theanalytic view AN_HA300_UNIT3_PO_TRAINXX again, by dragging theAttribute View from the Navigator to the Logical View of the Analytic View.What is the result? (Not possible).

    Note: To add another Attribute view to an existing Analytic View,just select the Attribute from the Navigator and drag it into theLogical view of the Analytic View. If you try to drag an AttributeView into an Analytic View that already exists in the Analytic View,it will not work.

    If your model requires that you have 2 identical Attribute Views in the sameAnalytical View, you will have to create a Derived Attribute with Aliases.

    Create a new Attribute View, AT_HA300_UNIT3_PD_DERIVED, derivedfrom AT_HA300_UNIT3_PD_TRAINXX.

    Note: To create a Derived Attribute View, choose Subtype: Derivedfrom within the New Information View screen.

    Continued on next page

    80 2012 SAP AG. All rights reserved. 2012

  • HA300 Lesson: Creating Attribute Views

    Figure 108: Create a derived attribute

    Can you modify the derived attribute view?

    Save.

    Activate the Derived Attribute View, AT_HA300_UNIT3_PD_DERIVED.

    Figure 109: A derived attribute view

    Add the new Derived Attribute View to the Analytic View,AN_HA300_UNIT3_PO_Train##, by dragging it from the Navigator to theLogical view in the Analytic View.

    Continued on next page

    2012 2012 SAP AG. All rights reserved. 81

  • Unit 3: Advanced Modeling HA300

    In the Logical View screen (of the previous Analytic View), join it to theData Foundation by mapping the following fields:

    Client_PD to Client

    Product_GUID to Node_Key. (DataFoundation is on the left.)

    Create aliases by adding "DERIVED" to the Alias Name and AliasDescription for each field of the derived attribute view fields in the propertiesof each fields in the Logical View screen of the Analytic View.

    Example, CLIENT:

    Figure 110: Create aliases

    When completed, all fields in the Derived Attribute have aliases:

    Can you modify the join between the data foundation and the derivedattribute view?

    Yes

    Save

    Activate

    Continued on next page

    82 2012 SAP AG. All rights reserved. 2012

  • HA300 Lesson: Creating Attribute Views

    Figure 111: Activate

    View the results

    Close

    Task 5:Create a new Analytic View for Sales Orders and reuse the shared ProductAttribute view.

    1. Create an Analytic View, AN_HA300_UNIT3_SO_TRAINXX, withdescription "Sales Order".

    Next.

    Add the table EPM_MODEL.SNWD_SO_I.

    Finish.

    Add the following fields to output in the Data Foundation screen:

    CLIENT Attribute

    SO_ITEM_POS Attribute

    CURRENCY_CODE Attribute

    PRODUCT_GUID Attribute

    Gross_Amount Measure

    Net_Amount. Measure

    Continued on next page

    2012 2012 SAP AG. All rights reserved. 83

  • Unit 3: Advanced Modeling HA300

    Figure 112: Create an analytic view

    In the Logical View screen, drag the Product Attribute View,AT_HA300_UNIT3_PD_TRAINXX, into the Analytic View. Join witha referential join (cardinality n,1) the Data Foundation (on the left) to theProduct Attribute view with fields the following fields:

    CLIENT to CLIENT (Product Attribute View)

    PRODUCT_GUID to NODE_KEY (Product Attribute View).

    Figure 113: Join Attribute views

    Save. Validate. Activate.

    View the results. Close.

    Task 6:(Optional) Modify the "Partner" view and create a calculated attribute. We want tomerge the phone extension and the phone number.

    1. Open AT_HA300_UNIT3_BP_TRAINxx.

    Create a new calculated attribute and name it PHONE_NUMBER_EX-TENSION with Data type VARCHAR and Length 20.

    Define the following formula:

    Continued on next page

    84 2012 SAP AG. All rights reserved. 2012

  • HA300 Lesson: Creating Attribute Views

    if PHONE_EXTENSION is null, take PHONE_NUMBER, if not, mergePHONE_EXTENSION with PHONE_NUMBER.

    Figure 114: Create a calculated attribute

    Validate. Save. Activate.

    View the result.

    Now open the Attribute View again. Hide the fields PHONE_NUMBERand PHONE_EXTENSION, by setting the Hidden property to True forthese 2 fields in the Data Foundation View screen.

    Continued on next page

    2012 2012 SAP AG. All rights reserved. 85

  • Unit 3: Advanced Modeling HA300

    Figure 115: Hide attributes

    Save and Activate. View the results. Close.

    86 2012 SAP AG. All rights reserved. 2012

  • HA300 Lesson: Creating Attribute Views

    Lesson Summary

    You should now be able to:

    Explain how to create derived attribute views

    Explain how to create shared attribute views

    Explain how to create calculated columns

    Explain how to create time characteristics based attribute views

    Explain how to create stand alone text tables

    Explain how to use base table aliases

    Explain how to include hidden attributes in an attribute view

    2012 2012 SAP AG. All rights reserved. 87

  • Unit 3: Advanced Modeling HA300

    Lesson: Using Hierarchies

    Lesson OverviewThis lesson details the hierarchies management in the SAP HANA Studio

    Lesson ObjectivesAfter completing this lesson, you will be able to:

    Explain how to implement leveled hierarchies

    Explain how to leverage parent / child hierarchies

    Explain how to create attribute based hierarchies

    Business ExampleHierarchies are usually used in Business Intelligence reporting to displaycharacteristics through a specific organization. For example, display customersthrough a geographical organization with country and city.

    Hierarchy Concept

    Figure 116: Concept Using Hierarchies - Using Hierarchies

    The definition of hierarchy objects is similar to the definition of conventionalrelational database views: In a CREATE COLUMN VIEW HanaDB-SQLstatement, a source query is defined whose result is the basis of the hierarchytree graph edges.

    88 2012 SAP AG. All rights reserved. 2012

  • HA300 Lesson: Using Hierarchies

    A primary design goal of the hierarchy definition syntax has been flexibility andextensibility, in order to support various source data formats and transformationsin the future.

    At present, the so-called recursive and leveled source transformation types aresupported. The recursive source transformation (also known as parent-child orpred/succ hierarchy) expects hierarchy graph edges as input, defined as pairs ofpredecessor and successor node IDs. Obviously this source type is best suitableto take a single flat table as input whose rows correspond to hierarchy nodes andcontain a node ID and a parent node ID.

    Since any valid SQL query is accepted as source, this source transformationis flexible enough to support also completely different source data as well. Forexample, the recursive source transformation is able to interpret a geographicalhierarchy that is based on multiple independent tables representing hierarchylevels connected by foreign key relations, provided that the source data is suitablypre-transformed via SQL.

    Figure 117: Using Hierarchies - Using Hierarchies

    In order to represent this hierarchy as HanaDB database object, we need a sourceobject providing the hierarchy's node and edge data :

    CREATE COLUMN TABLE h_mini_src ( pred CHAR(2), succ CHAR(2)PRIMARY KEY );

    INSERT INTO h_mini_src VALUES ( null, 'A1' );

    INSERT INTO h_mini_src VALUES ( 'A1', 'B1' );

    INSERT INTO h_mini_src VALUES ( 'A1', 'B2' );

    INSERT INTO h_mini_src VALUES ( 'B1', 'C1' );

    INSERT INTO h_mini_src VALUES ( 'B1', 'C2' );

    INSERT INTO h_mini_src VALUES ( 'B2', 'C3' );

    2012 2012 SAP AG. All rights reserved. 89

  • Unit 3: Advanced Modeling HA300

    INSERT INTO h_mini_src VALUES ( 'B2', 'C4' );

    INSERT INTO h_mini_src VALUES ( 'C3', 'D1' );

    INSERT INTO h_mini_src VALUES ( 'C3', 'D2' );

    INSERT INTO h_mini_src VALUES ( 'C4', 'D3' );

    Now we define a hierarchy view over the source data :

    CREATE COLUMN VIEW h_mini TYPE HIERARCHY WITH PARAMETERS(

    'hierarchyDefinitionType' = 'select',

    'hierarchyDefinition' = '{

    sourceType:recursive,

    nodeType:string,

    runtimeObjectType:blob,

    sourceQuery:SELECT pred, succ FROM h_mini_src }' );

    Congratulations, your first hierarchy view is ready to answer your queries!

    Display all nodes and their columns :

    SELECT & FROM h_mini;

    Display all nodes subordinate to node B2 :

    SELECT result_node FROM h_mini WITH PARAMETERS ( 'expression' ='subtree(B2,1,99)' );

    Figure 118: Implement Leveled Hierarchies - Using Hierarchies (I)

    90 2012 SAP AG. All rights reserved. 2012

  • HA300 Lesson: Using Hierarchies

    Create a table providing some hierarchy source data :

    CREATE COLUMN TABLE t_hierarchy_source (

    id INT PRIMARY KEY,

    level1 VARCHAR(32),

    level2 VARCHAR(32) );

    INSERT INTO t_hierarchy_source VALUES ( 1, 'a1', 'b1');

    INSERT INTO t_hierarchy_source VALUES ( 2, 'a1', 'b2');

    INSERT INTO t_hierarchy_source VALUES ( 3, 'a2', 'b3');

    INSERT INTO t_hierarchy_source VALUES ( 4, 'a2', 'b4');

    Figure 119: Implement Leveled Hierarchies - Using Hierarchies (II)

    2012 2012 SAP AG. All rights reserved. 91

  • Unit 3: Advanced Modeling HA300

    Figure 120: Implement Leveled Hierarchies - Using Hierarchies (III)

    Figure 121: Implement Leveled Hierarchies - Using Hierarchies (IV)

    92 2012 SAP AG. All rights reserved. 2012

  • HA300 Lesson: Using Hierarchies

    Figure 122: Implement Leveled Hierarchies - Using Hierarchies (V)

    Figure 123: Implement Leveled Hierarchies - Using Hierarchies (VI)

    Node Style is only available for level hierarchies.

    2012 2012 SAP AG. All rights reserved. 93

  • Unit 3: Advanced Modeling HA300

    Figure 124: Leverage Parent Child Hierarchies - Using Hierarchies (I)

    Figure 125: Leverage Parent Child Hierarchies - Using Hierarchies (II)

    94 2012 SAP AG. All rights reserved. 2012

  • HA300 Lesson: Using Hierarchies

    Figure 126: Leverage Parent Child Hierarchies - Using Hierarchies (III)

    Figure 127: Hierarchy Active Property - Using Hierarchies (I)

    MDX per default only shows key fields

    This is governed by an output field property of the attribute view in the DataFoundation

    If Hierarchy Active = false for non-key field, -> Field does not showup in Excel

    2012 2012 SAP AG. All rights reserved. 95

  • Unit 3: Advanced Modeling HA300

    Figure 128: Hierarchy Active Property - Using Hierarchies (II)

    Properties Enabling display of non-key fields via MDX

    Set output-field property Hierarchy active to true -> all fields show up infield list for Excel Pivot Table

    96 2012 SAP AG. All rights reserved. 2012

  • HA300 Lesson: Using Hierarchies

    Exercise 3: Using Hierarchies

    Exercise ObjectivesAfter completing this exercise, you will be able to:

    Create and Implement Leveled Hierarchies

    Create and Implement Parent Child Hierarchies

    Business ExampleYou are at a customer site where EPM data is available. Information of theBusiness Partners is dispatched in several tables. The purpose will be to regroupInformation of the Business Partners and to analyze Purchase Orders by Productand Partners.

    So you have been asked to build both a leveled hierarchy for products and a parentchild hierarchy for product types.

    Task 1:Implement a leveled hierarchy.

    1. Create a new attribute view,AT_HA300_UNIT3_PD_LEV_HIE_TRAINXX by copying the firstProduct Attribute view, AT_HA300_UNIT3_PD_TRAINXX..

    Figure 129: Create an attribute view

    Remove the following fields from output

    CLIENT

    Continued on next page

    2012 2012 SAP AG. All rights reserved. 97

  • Unit 3: Advanced Modeling HA300

    NODE_KEY

    SUPPLIER_GUID

    Figure 130: Define output

    Right click on the Hierarchies Folder. Select New Level Hierarchy.

    Name: HIE_LEV_PRODUCT_TRAINXX

    Hierarchy Type: Level Hierarchy

    Define the following in the Hierarchy definition:

    Private Attribute TYPE_CODE as level 1 (REGULAR Level Type),

    Private Attribute CATEGORY as level 2 (REGULAR Level Type)

    Private Attribute PRODUCT_ID as level 3 (REGULAR Level Type).

    Click OK.

    Figure 131: Create a hierarchy

    Continued on next page

    98 2012 SAP AG. All rights reserved. 2012

  • HA300 Lesson: Using Hierarchies

    Save. Activate and view the result. Close.

    Task 2:Implement a parent-child hierarchy.

    1. Create a new attribute view,AT_HA300_UNIT3_PD_PAC_HIE_TRAINXX, by copying the ProductAttribute view, AT_HA300_UNIT3_PD_TRAINXX.

    Remove the following fields

    CLIENT

    NODE_KEY

    SUPPLIER_GUID

    Make sure the Principal Key property of PRODUCT_ID is set to True.

    On the Semantics screen, right click on the Hierarchies Folder. SelectNew Parent Child Hierarchy.

    Name: HIE_PAC_PRODUCT_CATEGORY_TRAINxx. Hierarchy Type:Parent Child Hierarchy

    Define CATEGORY as parent attribute of PRODUCT_ID by selectingPrivate Attribute CATEGORY from the Parent Attribute drop down list.

    Figure 132: Create a parent-child hierarchy

    Save. Activate. Preview the results.

    Go to the Analysis tab of the preview.

    Add CATEGORY and PRODUCT_ID to Label Axis.

    Select Table as the Output Type

    Continued on next page

    2012 2012 SAP AG. All rights reserved. 99

  • Unit 3: Advanced Modeling HA300

    Figure 133: Preview

    Close the preview

    Task 3:Display Hierarchy in MS Excel (Optional)

    1. Open the Attribute View AT_HA300_UNIT3_PD_LEV_HIE_TRAINXX

    On the Data Foundation, add the CLIENT and NODE KEY as output.Set the property Hierarchy Active to 'True' on the property tab of thefield CATEGORY of the Data Foundation of the Attribute View. Save andActivate the Attribute View.

    Figure 134: Set the property Hierarchy Active to 'True'

    Continued on next page

    100 2012 SAP AG. All rights reserved. 2012

  • HA300 Lesson: Using Hierarchies

    Figure 135: Define attribute view

    Create a new Analytic View, AN_HA300_UNIT3_HIER_TRAINXX bycopying the Analytic View, AN_HA300_UNIT3_SO_TRAINXX createdearlier in the previous exercise.

    Figure 136: Create an analytic view

    From the Logical view tab, delete the existing Attribute view,AT_HA300_UNIT3_PD_TRAINXX.

    Drag and drop the Attribute View,AT_HA300_UNIT3_PD_LEV_HIE_TRAINXX

    Continued on next page

    2012 2012 SAP AG. All rights reserved. 101

  • Unit 3: Advanced Modeling HA300

    Join the following fields with referential join and default cardinality fromdata foundation to the attribute view:

    CLIENT to CLIENT

    PRODUCT GUID to NODE KEY

    Figure 137: Logical joins of Analytic view

    Save and Activate the Analytic View

    Start MS Excel by going to START PROGRAMS Microsoft Office Microsoft Excel 2007

    Then click on Insert From Other Sources From Data ConnectionWizard

    Figure 138: MS Excel Data Connection Wizard

    Then click on Insert From Other Sources From Data ConnectionWizard

    On the next screen choose Other/Advanced, then select SAP HANAMDX Driver and add the HANA server and credentials. Use your ownSTUDENTXX and your SAP HANA Password.

    Continued on next page

    102 2012 SAP AG. All rights reserved. 2012

  • HA300 Lesson: Using Hierarchies

    Figure 139: SAP HANA MDX Driver

    On the next screen change the package to your own studentxx package andchoose the AN_HA300_UNIT3_HIER_TRAINXX Analytic view. Acceptall the defaults and display the following level hierarchy that you created.

    Figure 140: Reporting on an Analytic View in MS Excel

    2012 2012 SAP AG. All rights reserved. 103

  • Unit 3: Advanced Modeling HA300

    Solution 3: Using Hierarchies

    Task 1:Implement a leveled hierarchy.

    1. Create a new attribute view,AT_HA300_UNIT3_PD_LEV_HIE_TRAINXX by copying the firstProduct Attribute view, AT_HA300_UNIT3_PD_TRAINXX..

    Figure 141: Create an attribute view

    Remove the following fields from output

    CLIENT

    NODE_KEY

    SUPPLIER_GUID

    Continued on next page

    104 2012 SAP AG. All rights reserved. 2012

  • HA300 Lesson: Using Hierarchies

    Figure 142: Define output

    Right click on the Hierarchies Folder. Select New Level Hierarchy.

    Name: HIE_LEV_PRODUCT_TRAINXX

    Hierarchy Type: Level Hierarchy

    Define the following in the Hierarchy definition:

    Private Attribute TYPE_CODE as level 1 (REGULAR Level Type),

    Private Attribute CATEGORY as level 2 (REGULAR Level Type)

    Private Attribute PRODUCT_ID as level 3 (REGULAR Level Type).

    Click OK.

    Figure 143: Create a hierarchy

    Save. Activate and view the result. Close.

    Continued on next page

    2012 2012 SAP AG. All rights reserved. 105

  • Unit 3: Advanced Modeling HA300

    Task 2:Implement a parent-child hierarchy.

    1. Create a new attribute view,AT_HA300_UNIT3_PD_PAC_HIE_TRAINXX, by copying the ProductAttribute view, AT_HA300_UNIT3_PD_TRAINXX.

    Remove the following fields

    CLIENT

    NODE_KEY

    SUPPLIER_GUID

    Make sure the Principal Key property of PRODUCT_ID is set to True.

    On the Semantics screen, right click on the Hierarchies Folder. SelectNew Parent Child Hierarchy.

    Name: HIE_PAC_PRODUCT_CATEG