Share E-Book

Data Modeling for SAP HANA 2.0 (Anil Bavaraju) (z-library.sk, 1lib.sk, z-lib.sk)

Author

SAP
Language English

No Description

Format PDF
Size 16.6 MB
6
Views
0
Downloads
0.00
Total Donations
(First 20 pages)

Registered users can read the full content for free

Register as a Gaohf Library member to read the complete e-book online for free and enjoy a better reading experience.

Page 1
(This page has no text content)
Page 2
SAP PRESS is a joint initiative of SAP and Rheinwerk Publishing. The know-how offered by SAP specialists combined with the expertise of Rheinwerk Publishing offers the reader expert books in the field. SAP PRESS features first-hand information and expert advice, and provides useful skills for professional decision-making. SAP PRESS offers a variety of books on technical and business-related topics for the SAP user. For further information, please visit our website: http://www.sap-press.com. Jörg Brandeis SQLScript for SAP HANA 2019, 435 pages, hardcover and e-book www.sap-press.com/4862 Colle, Dentzer, Hrastnik Core Data Services for ABAP 2019, 490 pages, hardcover and e-book www.sap-press.com/4822 Erasmus, Rao, Sinha, Wadawadigi SAP Leonardo: An Introduction to the Intelligent Enterprise 2019, 517 pages, hardcover and e-book www.sap-press.com/4787 Stefan Hass, Bince Mathew ABAP Programming Model for SAP Fiori: ABAP Development for SAP S/4HANA 2019, 461 pages, hardcover and e-book www.sap-press.com/4766
Page 3
Anil Bavaraju Data Modeling for SAP HANA® 2.0
Page 4
Dear Reader, Raw, unstructured data is meaningless. Well, it’s nearly meaningless, especially com- pared to the business intelligence power contained in a good data model. Take the Massachusetts Bay Transportation Authority (MBTA). They are flooded with all sorts of raw data: information about service reliability, train performance metrics, track maintenance schedules, vehicle locations, commuter reports, and average travel times. Without a meaningful way to process that data and analyze, say, the number of train derailments along the Red Line and their causes, the MBTA might try and solve the wrong problems. Or worse, invest in bad solutions that only treat symptoms. By modeling the data they collect, the MBTA and the city of Boston can take meaningful action—based on accurate analysis—to improve the quality of life for their commuters. Data models are key to making informed business-decisions, whatever your database. And if you use SAP HANA, this book is your ticket to robust models. What did you think about Data Modeling for SAP HANA 2.0? Your comments and sugges- tions are the most useful tools to help us make our books the best they can be. Please feel free to contact me and share any praise or criticism you may have. Thank you for purchasing a book from SAP PRESS! Will Jobst Editor, SAP PRESS willj@rheinwerk-publishing.com www.sap-press.com Rheinwerk Publishing • Boston, MA
Page 5
Notes on Usage This e-book is protected by copyright. By purchasing this e-book, you have agreed to accept and adhere to the copyrights. You are entitled to use this e-book for personal purposes. You may print and copy it, too, but also only for personal use. Sharing an electronic or printed copy with others, however, is not permitted, neither as a whole nor in parts. Of course, making them available on the Internet or in a company network is illegal as well. For detailed and legally binding usage conditions, please refer to the section Legal Notes. This e-book copy contains a digital watermark, a signature that indicates which person may use this copy:
Page 6
Imprint This e-book is a publication many contributed to, specifically: Editor Will Jobst Acquisitions Editor Hareem Shafi Copyeditor Melinda Rankin Cover Design Graham Geary Photo Credit Shutterstock.com/616904234/© Ireine Production E-Book Hannah Lane Typesetting E-Book SatzPro, Krefeld (Germany) We hope that you liked this e-book. Please share your feedback with us and read the Service Pages to find out how to contact us. ISBN 978-1-4932-1751-9 (print) ISBN 978-1-4932-1752-6 (e-book) ISBN 978-1-4932-1753-3 (print and e-book) © 2019 by Rheinwerk Publishing, Inc., Boston (MA) 1st edition 2019 The Library of Congress has cataloged the printed edition as follows: Names: Bavaraju, Anil, author. Title: Data modeling for SAP HANA 2.0 / Anil Bavaraju. Description: 1st edition. | Bonn ; Boston : Rheinwerk Publishing, 2019. | Includes index. Identifiers: LCCN 2019017645 (print) | LCCN 2019018197 (ebook) | ISBN 9781493217526 | ISBN 9781493217519 (alk. paper) Subjects: LCSH: Computer simulation. | Information visualization. | Databases. | SAP HANA (Electronic resource) Classification: LCC QA76.9.C65 (ebook) | LCC QA76.9.C65 B39 2019 (print) | DDC 003/.3--dc23 LC record available at https://lccn.loc.gov/2019017645
Page 7
Contents Preface ..................................................................................................................................................... 15 1 Introduction to SAP HANA 19 1.1 Evolution of SAP HANA ..................................................................................................... 21 1.2 Architecture ............................................................................................................................ 23 1.2.1 Index Server ............................................................................................................ 24 1.2.2 SAP HANA Multitenant Database Architecture ......................................... 29 1.2.3 SAP HANA XS Advanced Architecture ............................................................ 33 1.3 Comparing SAP HANA 1.0 and SAP HANA 2.0 ........................................................ 34 1.4 Summary ................................................................................................................................. 37 2 General Data Modeling Concepts 39 2.1 What Is a Data Model? ...................................................................................................... 39 2.2 Why Do We Need Data Models? ................................................................................... 40 2.2.1 Conceptual Data Model ..................................................................................... 41 2.2.2 Logical Data Model .............................................................................................. 41 2.2.3 Physical Data Model ............................................................................................ 43 2.3 Components ........................................................................................................................... 44 2.3.1 What Are Dimensions, Measures, and Attributes? ................................... 45 2.3.2 Fact Tables and Entities ...................................................................................... 46 2.3.3 Primary Key and Foreign Key ............................................................................ 47 2.3.4 Hierarchies .............................................................................................................. 48 2.4 Dimensional Schemas ....................................................................................................... 50 2.4.1 Star Schemas .......................................................................................................... 50 2.4.2 Snowflake Schemas ............................................................................................. 517
Page 8
Contents2.5 Joining Tables in a Data Model ..................................................................................... 53 2.6 Summary ................................................................................................................................. 54 3 Data Modeling Tools 55 3.1 Data Modeling with SAP HANA Studio versus SAP Web IDE ........................... 55 3.2 Getting Started with SAP Web IDE .............................................................................. 56 3.2.1 Setting Up Access in SAP HANA XSA ............................................................. 58 3.2.2 Organization and Spaces ................................................................................... 62 3.2.3 Create Organizations and Spaces in SAP HANA XSA ............................... 63 3.2.4 Enabling Spaces .................................................................................................... 66 3.2.5 Launch SAP Web IDE for SAP HANA ............................................................... 67 3.3 Projects and Database Models in SAP Web IDE ..................................................... 70 3.3.1 Connecting SAP Web IDE to the SAP HANA Database ............................ 70 3.3.2 Creating a Project in SAP Web IDE Using a Template .............................. 73 3.4 Summary ................................................................................................................................. 80 4 Information Views 81 4.1 Getting Started with Information Views ................................................................. 81 4.2 Types of Information Views ........................................................................................... 83 4.2.1 Converting All SAP HANA Views to Calculation Views ............................ 85 4.2.2 Graphical Calculation Views ............................................................................ 88 4.2.3 Table Functions ..................................................................................................... 99 4.3 Summary ................................................................................................................................. 101 5 Dimensions and Measures in Calculation Views 103 5.1 Dimension Calculation View .......................................................................................... 104 5.1.1 Create CDS Artifacts ............................................................................................ 1058
Page 9
Contents5.1.2 Create a Dimension Calculation View ........................................................... 120 5.1.3 Cardinality ............................................................................................................... 124 5.1.4 Create a Calculated Attribute in a Calculation View ................................ 129 5.1.5 Time-Based Dimension Calculation View .................................................... 131 5.2 Using Filters in Dimension Calculation Views ........................................................ 139 5.3 Measures in Calculation Views ...................................................................................... 142 5.3.1 Working with Cube Calculation Views .......................................................... 143 5.3.2 Create a Cube Calculation View ...................................................................... 146 5.3.3 Deploy a Cube Calculation View ..................................................................... 154 5.4 Semantic Attributes and Semantic Measures ........................................................ 155 5.5 View Nodes ............................................................................................................................. 158 5.5.1 Joins ........................................................................................................................... 159 5.5.2 Non Equi Join ......................................................................................................... 168 5.5.3 Unions ...................................................................................................................... 172 5.5.4 Intersect ................................................................................................................... 178 5.5.5 Minus ........................................................................................................................ 178 5.5.6 Aggregations .......................................................................................................... 179 5.5.7 Ranks ......................................................................................................................... 182 5.6 Implementing Currency Conversions ......................................................................... 187 5.7 Summary ................................................................................................................................. 199 6 Cube Calculation Views 201 6.1 Working with Star Join Calculation Views ............................................................... 202 6.1.1 Create a Products Dimension Calculation View ........................................ 202 6.1.2 Create a Customer Dimension Calculation View ...................................... 205 6.1.3 Create a Supplier Dimension Calculation View ......................................... 207 6.1.4 Create a Cube Calculation View ...................................................................... 209 6.1.5 Preview Cube Calculation View ....................................................................... 218 6.2 Variables and Input Parameters ................................................................................... 219 6.2.1 Create a Cube Calculation View with Variables ......................................... 219 6.2.2 Create an Input Parameter ................................................................................ 2289
Page 10
Contents6.3 Working with Hierarchies ............................................................................................... 233 6.3.1 Level Hierarchy ...................................................................................................... 233 6.3.2 Parent-Child Hierarchy ....................................................................................... 239 6.3.3 Time-Based Hierarchy ........................................................................................ 243 6.4 Restricted and Calculated Columns ............................................................................ 250 6.4.1 Create Calculated Columns .............................................................................. 251 6.4.2 Create Restricted Columns ............................................................................... 254 6.5 Optimizing Calculation Views ....................................................................................... 258 6.5.1 Performance Analysis Mode ............................................................................. 259 6.5.2 Table Partitioning ................................................................................................ 260 6.5.3 Create a Hash Partition ...................................................................................... 262 6.5.4 Debug Query Mode ............................................................................................. 264 6.6 Summary ................................................................................................................................. 266 7 Table Functions and Procedures 267 7.1 What Is a Table Function? ............................................................................................... 267 7.2 Introduction to SQL Scripts ............................................................................................. 268 7.2.1 SQL Identifiers ....................................................................................................... 269 7.2.2 SQL Data Types ..................................................................................................... 270 7.2.3 SQL Scripts in SAP Web IDE ............................................................................... 271 7.3 Using Table Functions as a Data Source ................................................................... 274 7.3.1 Create a Table Function Using SQL Scripts .................................................. 274 7.3.2 Create a Dimension Calculation View Using Table Functions as a Data Source ................................................................................................... 279 7.4 Procedures .............................................................................................................................. 283 7.4.1 Create a Procedure Using SQL Scripts ........................................................... 283 7.4.2 Calling a Procedure in SAP Web IDE for SAP HANA .................................. 287 7.5 Summary ................................................................................................................................. 28810
Page 11
Contents8 Model Management 289 8.1 Analyzing an SAP HANA Model ..................................................................................... 289 8.1.1 Data Lineage and Impact Analysis .................................................................. 290 8.1.2 Checking the Source of a Field Using Data Lineage .................................. 291 8.1.3 Tracing Dependent Objects Using Data Lineage ....................................... 294 8.1.4 Tracing Dependent Objects Using Impact Analysis .................................. 296 8.1.5 Managing SAP HANA Models in SAP Web IDE ............................................ 298 8.2 SAP HANA Model Migration ........................................................................................... 301 8.2.1 Convert Attribute Views and Analytic Views to Graphical Calculation Views ................................................................................................. 303 8.2.2 Migrate Calculation Views Using SAP HANA XSA Migration Assistant .................................................................................................................. 307 8.2.3 Import Migrated Content to SAP Web IDE ................................................... 308 8.3 Summary ................................................................................................................................. 309 9 SAP HANA Live and SAP S/4HANA Embedded Analytics 311 9.1 SAP HANA Live Architecture ........................................................................................... 311 9.2 Types of Virtual Data Model Views ............................................................................. 313 9.3 SAP HANA Live Views in the SAP HANA Live Browser ......................................... 314 9.3.1 SAP HANA Live Viewer Configuration ........................................................... 315 9.3.2 SAP HANA Live Viewer Features ...................................................................... 315 9.3.3 Consuming SAP HANA Live Views in SAP Analysis for Microsoft Office .................................................................................................... 323 9.4 SAP S/4HANA Embedded Analytics Architecture .................................................. 326 9.5 Core Data Service Views ................................................................................................... 328 9.5.1 Create a CDS View ................................................................................................ 329 9.5.2 Consume CDS Views in SAP Lumira, Designer Edition ............................. 336 9.6 Summary ................................................................................................................................. 34111
Page 12
Contents10 Authorizations in SAP Web IDE for SAP HANA 343 10.1 Object Ownership ............................................................................................................... 343 10.1.1 Ownership Concepts ........................................................................................... 344 10.1.2 Object Ownership Scenario .............................................................................. 346 10.2 Privileges and Roles ........................................................................................................... 347 10.3 Setting Up Access between SAP HANA Deployment Infrastructure and Classic Database ......................................................................................................... 348 10.3.1 Configure SAP HANA Database Role in SAP HANA XSA .......................... 349 10.3.2 Accessing SAP HANA Objects from External SAP HANA Deployment Infrastructure Container .......................................................... 352 10.3.3 Create Synonyms in SAP HANA Deployment Infrastructure Container ................................................................................................................ 360 10.4 Defining Analytic Privileges ........................................................................................... 367 10.4.1 Create Analytic Privileges .................................................................................. 368 10.5 Defining Roles ....................................................................................................................... 373 10.5.1 Create a Role .......................................................................................................... 375 10.5.2 Assign the Role to a User ................................................................................... 377 10.5.3 Test Analytic Privileges ....................................................................................... 378 10.6 Summary ................................................................................................................................. 379 11 Advanced Topics 381 11.1 Working with Predictive Models .................................................................................. 382 11.1.1 Introduction to the Predictive Analysis Library .......................................... 382 11.1.2 Algorithms Supported by the Predictive Analysis Library ...................... 384 11.1.3 Create a Predictive Model Using SAP HANA Predictive Analysis Library Functions .................................................................................................. 385 11.2 SAP HANA Spatial Analysis ............................................................................................. 400 11.2.1 SAP HANA Spatial Processing Architecture ................................................. 401 11.2.2 Working with Spatial Data in SAP HANA ..................................................... 402 11.2.3 Create a Calculation View on Spatial Data ................................................. 407 11.2.4 Create a New Input Parameter ........................................................................ 41112
Page 13
Contents11.3 Graph Processing with SAP HANA ............................................................................... 417 11.3.1 Working with Graph Models in SAP HANA Graph Viewer ...................... 418 11.3.2 Create a Graph Workspace ................................................................................ 421 11.3.3 Execute Graph Workspace ................................................................................ 422 11.4 Summary ................................................................................................................................. 424 The Author ............................................................................................................................................. 425 Index ........................................................................................................................................................ 42713
Page 14
(This page has no text content)
Page 15
0Preface SAP HANA is a platform for data-driven applications, and it’s built from the ground up for all your data needs. SAP HANA is the next-gen- eration data management platform, with no need for data redun- dancy, and it’s designed to run entirely in memory for processing large amounts of data extremely fast. SAP Web IDE for SAP HANA is a tool used for developing SAP HANA data models, like cal- culation views, stored procedures, and more. It applies modern design principles to SAP software and provides a personalized, responsive, and easy-to-use user experience (UX). There are three things a company can do with SAP HANA modeling using SAP Web IDE for SAP HANA: Implement them Enhance them Create them from scratch SAP recommends following the new SAP HANA development infrastructure, which means that going forward all modeling should be done only using SAP Web IDE for SAP HANA and not in SAP HANA Studio. Regardless of what a company does with these SAP HANA models, any form of implementation or development requires knowledge of creating SAP HANA models using SAP Web IDE for SAP HANA. It’s time to take the first step in your SAP HANA modeling journey! In this introduc- tion, we’ll discuss the book’s target audience, lay out its purpose, and provide a struc- tural overview of the topics that lie ahead. Target Audience SAP HANA has a broad appeal, given its wide use in SAP systems and the modeling features it offers. However, because of the technical details involved in data modeling in SAP HANA, this book is primarily focused on the following two audiences:15
Page 16
Preface Developers and administrators at companies that run SAP S/4HANA Consultants hired to develop SAP HANA models for a company running SAP S/4HANA Again, this casts a wide net in terms of readers for this book. However, each chapter will lay out the general knowledge and prerequisites required for building different types of SAP HANA models in SAP Web IDE for SAP HANA. Objective This book is meant to be a complete guide to SAP HANA modeling using SAP Web IDE for SAP HANA. Its purpose therefore is to teach you how to implement, customize, and create SAP HANA models. You will walk away with a complete understanding of how to accomplish all these tasks thanks to step-by-step instructions, screenshots, and example SAP HANA models. Structure of the Book The book takes you on a tour to learn everything you need to know about SAP HANA modeling using SAP Web IDE for SAP HANA. If you’re new to SAP HANA modeling and its concepts, you should take this tour from Chapter 1 to Chapter 11. If you already understand some of the concepts and technologies involved, we did our best to allow you to take detours, start in the middle of things, and jump around if you like: Chapter 1: Introduction to SAP HANA To begin your journey, we’ll look at SAP HANA’s architecture and its components, with a focus on how SAP HANA has changed between release 1.0 and release 2.0. Chapter 2: General Data Modeling Concepts Before any implementation or development of SAP HANA models can begin, you need to understand the concepts of data modeling. Chapter 2 describes the basic concepts of data modeling, outlining the components you can expect to work with in the rest of the book. Chapter 3: Data Modeling Tools SAP Web IDE for SAP HANA is the environment used to develop graphical calcula- tion views and script-based calculation views. Chapter 3 begins by comparing two development tools, SAP HANA Studio and SAP Web IDE for SAP HANA, including16
Page 17
Prefacean overview of SAP Web IDE. After we walk you through the basic concepts, we’ll show you how to set up a user in SAP HANA extended application services, advanced model (SAP HANA XSA) using the SAP HANA XSA administration tool. We conclude the chapter by walking through the process of setting up SAP Web IDE with the SAP HANA database and creating a project in SAP Web IDE using a multitarget application template so that you can follow along with the examples in the book. Chapter 4: Information Views The basic category of SAP HANA data models is known as the information view. In this chapter, you’ll learn about the types of information views and when to use each for data modeling. Chapter 5: Dimensions and Measures in Calculation Views In this first chapter on the development of types of information views, we begin by looking at how to create a dimension calculation view, including time-based calcu- lation views, and how to use filters in a dimension calculation view. Next, we dive into developing a cube calculation view using dimension tables and fact tables. We end the chapter with a discussion of implementing currency conversion, and we’ll show you how to create a calculation view using the currency conversion con- cepts. Chapter 6: Cube Calculation Views There are two types of cube calculation views that you can build in SAP HANA: standard cube calculation views and cube calculation views with star joins. Chap- ter 6 begins by spelling out the necessary implementation prerequisites before diving deep into the tasks necessary to implement a cube calculation view with a star join. At the end of this chapter, we’ll discuss at length how the best in the industry optimize their calculation views. Chapter 7: Table Functions and Procedures SQL scripts play a very important role in creating script-based SAP HANA models like table functions and procedures. Chapter 7 offers a high-level overview of SQL scripts and how they’re used to communicate with the SAP HANA database. You’ll use the steps presented here to create table functions and procedures using SQL scripts. Chapter 8: Model Management In this chapter, you’ll learn to manage data models, including how to migrate depreciated data models from older versions of SAP HANA to SAP HANA 2.0 and SAP Web IDE.17
Page 18
Preface Chapter 9: SAP HANA Live and SAP S/4HANA Embedded Analytics Data modeling plays an important role in the native analytics capabilities of SAP HANA Live (for SAP Business Suite) and SAP S/4HANA embedded analytics. In this chapter, you’ll learn about the virtual data model that enables SAP HANA Live and the core data services (CDS) views that enable SAP S/4HANA embedded analytics. Chapter 10: Authorizations in SAP Web IDE for SAP HANA It’s important to understand the various security mechanisms that can be put in place to prevent the unauthorized use of SAP HANA models. In this chapter, you’ll learn about a few basic SAP HANA security concepts as they relate to data model- ing. We first look at basic authorization entities, like roles and privileges. We then delve into the process of setting up access between SAP HANA deployment infra- structure and the classic database. Finally, we provide an overview of how to man- age users and authorize access using roles. Chapter 11: Advanced Topics This chapter covers advanced data modeling topics like predictive algorithms, graph processing, and geospatial analysis, limiting itself to those topics that are known to be supported in SAP HANA 2.0. Our hope is that this book will provide an understanding of the steps involved in developing SAP HANA models based on your business requirements. Acknowledgments I would like to dedicate this book to my wife, Puja, and my kids, Arjun and Kabir, who supported and encouraged me despite all the endless hours, including evenings and weekends, that I took away from them. I would also like to thank Hareem Shafi for the trust placed in me and for the oppor- tunity to write this book. I would like to extend a heartfelt thanks to my development editor, Will Jobst, who supported me every step of the way, from the ideas in every chapter of this book to its publication, and for providing advice and help always. My final—but very important—thanks goes to the entire SAP PRESS team involved in creating this book. Anil Bavaraju July 201918
Page 19
Chapter 1 Introduction to SAP HANA This chapter will introduce SAP HANA, its architecture, and its compo- nents, paying specific attention to how SAP HANA has changed between release 1.0 and release 2.0. One of the first questions that anyone asks before beginning their journey with SAP HANA is this: What is SAP HANA and why is it important? SAP HANA is an in-memory database, and SAP HANA gets its name because it’s SAP’s high-performance analyti- cal appliance. The most important fact about SAP HANA is that at its core is a relational database, which makes data processing much faster—about 3,600 times faster than any tradi- tional, disk-optimized database. Traditional systems that we had until a decade ago were online transaction process- ing (OLTP) systems, transactional systems (see Figure 1.1) built to handle the transac- tional data such as sales and the like; these systems don’t support any detailed analytical capabilities. On the other hand, we have online analytical processing (OLAP) systems, which are built for analytics and meant to improve on the shortcomings of the OLTP systems. However, as your transaction data grows, these OLAP systems are unable to perform the best possible way. A simple query on a huge dataset might take 30 minutes or more. As a result, customers looked for a better solution, one that can process data faster and that has better performance. For example, say you have a small database and you start tracking your sales orders. This works well until your business and database starts growing, requiring things like complex reporting and analysis and dashboards to view your operations. At this point, you’ll need different kinds of databases to do these things, so you end up cre- ating new databases to separate actual business from the management of the busi- ness. This requires moving data from one system to another system using some extract, transform, load (ETL) tools, and then aggregating or summarizing the data.19
Page 20
1 Introduction to SAP HANABefore long, you will end up maintaining multiple databases and complex ETL pro- cesses, so that means there are no more real-time updates. Figure 1.1 Traditional OLTP and OLAP Systems Most of the data warehouse solutions store data in tables, which are just a logical rep- resentation of data; the actual storage is on hard drives or disks. So when a user runs a query on these tables, data has to be retrieved from the physical hard drive into RAM or memory, and then loaded into the processors and presented to the user via the frontend tools. If you look at this process, you’ll see that most of the delay is in the data retrieval from the physical storage into RAM. By comparison, as shown in Figure 1.2, SAP HANA’s next-generation data management platform has no need for data redun- dancy, and it’s designed to run entirely in memory for processing large amounts of data extremely fast. Figure 1.2 Traditional System versus SAP HANA OLAP Analytics Reports on Data (Poor Performance) Extract, Transform, and Load (ETL) Transaction Data Thrid-Party Data Sources Aggregate or Summarize the Data Streaming Data Sources Traditional OLAP and OLTP Systems Transactions OLTP ETL OLAP Analytics Analytics SAP HANA SAP HANA Platform OLAP and OLTP Transactions20
The above is a preview of the first 20 pages. Register to read the complete e-book.

Recommended for You

Loading recommended books...
Failed to load, please try again later

Tip the Site

Scan the WeChat Pay or Alipay code to tip. No login required.

WeChat Pay
Alipay
Back to List