Tips and techniques for more effective SAP NetWeaver BW data modeling Jesper Christensen COMERIT © 2012 Wellesley Information Services. All rights reserved. In This Session … Tips and techniques for more effective SAP NetWeaver BW data modeling • This session will cover the top 20 data modeling best practices for an SAP NetWeaver BW landscape. • Explore the benefits of techniques such as semantic partitioning and dimensional modeling, and receive proven strategies for performing them. • Receive best practices for optimizing data models specifically for SAP NetWeaver BW Accelerator. • Examine options for modeling InfoCubes for enhanced system performance, and learn how to improve memory utilization by caching. • Get tips for leveraging system diagnostics to identify and troubleshoot SAP NetWeaver BW performance issues. • Learn how and when to apply new data modeling techniques delivered with SAP Netweaver BW 7.3, such as the Semantic Partitioning Object (SPO) and cube-less SAP NetWeaver BW accelerator indices. • Take home a list of best practices for optimizing InfoCube dimensions. 1 What We’ll Cover … • • • • • Dimensional modeling Enterprise Data Warehouse Modeling Modeling for performance Modeling for in Memory Wrap-up 2 1: Dimensional Modeling – Business requirements • Start with 9 questions about the requirement Describe the business processes and analysis/reporting requirement that define this subject area. What granularity is required What Dimensions are required What Facts/measures What additional information is required (Dimensional Attributes) Define frequency of dimension updates How should the measures be aggregated/summarized How much History is required How frequent should the data be updated 3 1: Dimensional Modeling - ERM • Start the dimensional modeling with an entity relationship model (ERM) based on the 9 decision points Source: SAP 4 1: Dimensional Modeling – ERM (Cont.) • Add more details to the model based data analysis and relationships Source: SAP 5 1: Dimensional Modeling – Star Schema • Turn the ERM into a dimensional model The fact table contains the measures The dimension tables are de-normalised Source: SAP 6 1: Dimensional Modeling – The Info cube model • The SAP Netweaver BW Infocube model is an extended star schema The dimension table link to infoobjects that can have master data, texts and hierarchies maintained that can be used across the EDW Source: SAP 7 What We’ll Cover … • • • • • Dimensional modeling Enterprise Data Warehouse Modeling Modeling for performance Modeling for in Memory Wrap-up 8 Enterprise Data Warehouse modeling • Enterprise data warehouse modeling is all about reusability and modeling based on current and future requirements Reuse master data, texts and hierarchies Reuse transaction data Simple and standard dataflow 9 Dataflow in SAP NetWeaver BW Source: SAP 10 2: Simplify the data flow • • • Denormalise the data during the extraction processing Combine header and item for documents Standardize dataflows to use DSO objects Ensures that data can be easily reloaded Allows for improved flexibility for the future (HANA) An info cube should only be updated from one DSO Simple to identify datasource Allows for simple dataload recovery procedures Enables immediate compression of data 11 3: Counter in DSO objects and cubes • Always add a counter infoobject in all DSO and Info cube infoproviders. This allows for Counting no of documents etc. Definition of process metrics Avoids exception aggregation key figures at very granular level 12 4: Modeling Multi-Provider • • Multi-Provider should always be used for reporting even when only 1 data target is needed for reporting, especially if there is a possibility of logically partitioning the data target. Multi-Providers should be used with multiple data targets when: Business requirements combine loosely related data with different dimensions. This data is also analyzed in separate InfoCubes. the number of data sources have different levels of granularity Keep the # of data targets in a multi-provider to 10 or less. Use Variables on 0INFOPROV or another model specific infoobject to restrict the query to hit a specific underlying data Multi-Provider target. InfoCube 1 InfoCube 2 5: Info object modeling – Business content • • SAP Business Content objects will be used wherever possible to speed up development time for the data warehouse. Attributes should not be deleted from Business Content objects. Time dependency should not be changed on Business Content objects Enhancements should be made to Business Content without making a copy. Changes to length or datatype should be made in a copy of the Business Content. ALPHA conversion routines should not be altered When to create a new custom Info Object When there is no existing active or inactive Info Object with the correct master data 6: Info object - Master Data • • • • • Reference characteristics must be used to limit the amount of redundant master data Example: 0SHIP_TO is referencing 0CUSTOMER Define master data and texts only if needed. Master data and text tables are not needed for info objects like document number, free text info objects like city and keys such as zip code. Texts should always be loaded if available in the source system Attributes should always be loaded if available in the source system Hierarchies should be loaded only when required for reporting Use upper case values for characteristic info objects that have master data, text or hierarchy tables. Time dependent master data, texts, and hierarchies should not be used unless specifically required by the business. 6: Info object - Master Data (Cont.) • • • Analyze the source data and set the Text properties (short, medium and long) Text should be: Marked language dependent if the source systems’ data has language associated with the text. Extracted for English only, unless there is a business requirement to extract text in other languages. Navigational attributes should be limited for performance reasons. If an attribute is marked navigational in Business Content and is not needed, this should be turned off before activating the InfoCube to improve load performance. 7: Info object – F4 help • • To improve query selection filter performance, set the “Query Execution Filter Val. Selectn” for each infoobject as follows: = M (Values in Master Data Table), if master SID records <= 100 = D (Only Values in InfoProvider), if master SID records >100. Make this the default. Note: User can always override to Q at query execution if accuracy is required. 8: Info object – Key Figures • • • • • • • Key Figure data type must be valid according to data in the source system. Use data type of “number” when there is no relation to currency. Limit the use of floating point data type as it can cause problems for BWA and HANA Do not use fixed currencies or unit of measures unless a fixed currency or Unit is determined in a routine Use summation aggregation in order to utilize the aggregate functionality of SAP BW. Use summation for exception aggregation to control the calculation of the key figure value in BEX. If summation is not used in the aggregation or exception aggregation, it is recommended to use the lowest grain of time characteristic of the InfoCube as the reference characteristic. 8: Info object – Key Figures (Cont.) • • All non-cumulative key figure info objects should be approved by the Architect Calculated Key figures: Do not save a key figure as ratios. Instead save numerator and denominator and calculate the ratio in BEx. Most of the time business wants ratio of sum (not sum of ratio). 9: Use Navigational Attributes for Security • Use specific Security InfoObjects in your SAP Netweaver BW system E.g., Do not use 0COMP_CODE, instead create a reference InfoObject (e.g., SECCOMPCD) that you add as a navigational attribute of 0COMP_CODE It has the same values as the base object but can be chosen to be assigned only in the InfoProviders that require security by the object 20 10: Enhancing and changing the data model • Reporting and analytical systems undergo constant change Use SAP Netweaver BW infocubes and DSO (7.3) remodeling tool 21 11: Enhancing and changing the data model - reloads • Use a custom datasource when reloading additional new fields for an existing Logistics datasource to avoid having to load all the data columns and avoid the setup in ECC Example: A custom datasource to reload sales order can be defined as a view across tables VBAK and VBAP. This approach can also be used for other master data reloads Reload Datasource Datasource DSO Cube 22 What We’ll Cover … • • • • • Dimensional modeling Enterprise Data Warehouse Modeling Modeling for performance Modeling for in Memory Wrap-up 23 12: OLAP Cache • OLAP Cache is the first storage that is checked for a query result during query runtime If the result is available in cache it is read from there and results in the best query performance The recommended settings are Read Mode H Cache Mode 5 Set the default cache settings in the infoprovider properties. Additional Cache settings can be maintained in the query and cache monitors t-codes RSRT and RSRCACHE 12: OLAP Cache (Cont.) • • • • • • Note: Only new queries will take these settings made for the Data Target. Settings made for the data target will not affect existing queries; they will continue to have the old settings. To check the current OLAP Cache settings check the system table RSRREPDIR and fields CACHEMODE and PERSISTMODE. If these fields are empty that means that query is not being cached. System transparent tables to hold the OLAP Cache data: RSR_CACHE_DBS_BL for Across systems BLOB table RSR_CACHE_DB_BL for Application server specific BLOB table 13: SAP NetWeaver BW 7.x Statistics • • Define standard measure that can be monitored on a daily, weekly, and monthly basis to evaluate data load performance trends Records processed per minute or Time to process 1 million records Time spent on extraction Time spent in transformations Top 10 long running loads Total time spent for Attribute and Hierarchy change runs Use the standard queries and reports as a starting point 26 13: See Details About Performance in the Monitor • The load monitor transaction code RSMO gives more details about the processing steps InfoPackage details Data Transfer Process (DTP) details 27 14: Use SE30 to Test Performance • Transaction code SE30 ABAP Runtime Analysis gives a detailed view of performance Remember to set the accuracy to Low Run transaction code RSA3 Note: SE30 can also be used for transformations by simulating the DTP run 28 14: Use SE30 to Test Performance (cont.) • Detailed Runtime will show you the bottlenecks Sort descending based on Net Time and you will see your bottleneck on the top 15: Optimize Info cube Dimensions • • • Use as many dimensions as possible Separate common filter characteristics into own dimension Use line-item dimensions for high cardinality characteristics such as document numbers Do not set the high cardinality flag as this changes the index to a b-tree index which can’t be used in star transformation queries Define related characteristics in the same dimension Calculate expected number of dimensional entries Try not to exceed 10% of expected fact table entries 30 15: Optimize Info cube Dimensions (Cont.) • Verify the dimension design after the first dataloads using program SAP_INFOCUBE_DESIGNS Allows for analysis of dimension design 31 15: Checklist for info cubes 1 Are there large dimensions (>100k records) This should be avoided 2 Is the cube partitioned Cubes should always be partitioned by the most used time characteristic (0CALMONTH or 0FISCPER) try to have less than 3M records in each partition 3 Is the cube large (> 30M records) Consider semantic partitioning into smaller cubes by e.g. year or geography 4 Do you have line item dimensions? These should only be used for true line items like document numbers. 5 Do you have high cardinality dimensions Should not be used! 6 All cubes must be designed in a way that they can be compressed without changing the reporting results 32 16: Implement Semantic Partitioning • What is it? An architectural design to enable parallel data loading and query execution Partitioning criteria: Year, Region, or Actual/Plan Source: SAP 33 16: Implement Semantic Partitioning (cont.) • Benefits of semantic partitioning: Reduction in SAP NetWeaver BWA footprint (when partitioned by year) Parallel data loading (when not partitioned by year) Parallel query execution Best case when partitioning criterion is set as constant Almost as good to create variables to filter on 0INFOPROV Archival of a single InfoCube does not impact others Easier DB maintenance Performance benefits are so significant … semantic partitioning should be deployed on virtually every data model! 34 16: Implement Semantic Partitioning (cont.) • Example: Semantic partitioning by year MultiProvider History (Summarized) ALL years Write-Optimized (No SIDs) Ex: Current Current Current Current Current Year Year Year Year Year Current Year – 3 Current Year - 2 Current Year - 1 Current Year Current Year + 1 Current Year – 3 Current Year - 2 Current Year - 1 Current Year Current Year + 1 + 1 = = - 1 = - 2 = - 3 = 2010 2009 2008 2007 2006 DataSource Source: SAP 35 17: SAP Netweaver BW 7.3 SPO • Using the Semantic partitioning object in SAP Netweaver BW 7.3 offers an easy way to maintain semantic partitioning Source: SAP 36 What We’ll Cover … • • • • • Dimensional modeling Enterprise Data Warehouse Modeling Modeling for performance Modeling for in Memory Wrap-up 37 18: Optimal model for SAP Netweaver BWA • • SAP NetWeaver BWA does not support exception aggregation key figure is releases prior to BW 7.30 / BWA 7.20 Ensure that all key figures can be aggregated Calculate exceptions during data loading if possible Ensure that the infocubes can be compressed and archived to minimize the footprint in SAP Netweaver BWA It is good practice to rebuild the BWA indices on a quarterly basis for cubes where the data is changing frequently e.g. Sales orders 38 18: SAP NetWeaver BW Accelerator persistence • • In BW 7.3 it is possible to load data into BWA without building an infocube Requires definition of a hybrid provider based on a DSO The hybrid provider is then defined with all the infoobjects of the DSO and is marked to only store the data in BWA Note: BWA 7.20 is required. Latest BWA revision is recommended for increased stability 39 19: Optimal model for SAP HANA • • • SAP HANA is available as the DBMS for SAP Netweaver BW This allows for additional data modeling options: Model without cubes (Even hybrid provider is not required) An additional info cube model is available with SAP HANA It eliminates the dimension tables and link the fact tables directly to the SID tables of the infoobjects Existing infocubes can be converted using t-code RSMIGRHANADB 40 20: BW Work Spaces in SAP Netweaver 7.3 • BW work spaces are new in BW 7.3 Allows for combining local development with the corporate governed Data Warehouse Local data files can be loaded The work spaces are defined by IT but can be managed and changed by business users Source: SAP 41 20: BW Work Spaces in SAP Netweaver 7.3 (Cont.) • Workspace Designer for key users in business departments Browser-based tool running in SAP NetWeaver Business Client or SAP NetWeaver Portal Easy upload of local flat files, Query results and BW DataSources into Local Provider Merge data of Local Providers with data from SAP NetWeaver BW to create new data models (CompositeProvider) Monitor Workspace with regards Source: SAP to size and number of objects created 42 What We’ll Cover … • • • • • Dimensional modeling Enterprise Data Warehouse Modeling Modeling for performance Modeling for in Memory Wrap-up 43 Additional Resources • • • Data Modeling in SAP NetWeaver BW - Frank K. Wolf, Stefan Yamada http://www.sap-press.com/products/Data-Modeling-in-SAPNetWeaver-BW.html Using Semantic Partitioning http://help.sap.com/saphelp_nw73/helpdata/en/4a/0905c133e00 890e10000000a421937/frameset.htm Multi-Dimensional Modeling with BI http://www.sdn.sap.com/irj/scn/index?rid=/library/uuid/6ce7b0a 4-0b01-0010-52ac-a6e813c35a84 44 7 Key Points to Take Home • • • • • • • Data modeling should be based on business requirements and good analysis of the underlying data Modeling an enterprise data warehouse requires standards and best practices to be applied All reporting should be based on a multiprovider Info Object modeling is very important to an enterprise data warehouse model as they should be reused across all models Use the remodeling tool to change DSO and cube models Review datamodels for performance prior to go live Implement BWA or HANA to increase reporting performance and apply additional time saving modeling options 45 Your Turn! How to contact me: Jesper Moselund Christensen jesper@comerit.com 46 Disclaimer SAP, R/3, mySAP, mySAP.com, SAP NetWeaver®, Duet®, PartnerEdge, and other SAP products and services mentioned herein as well as their respective logos are trademarks or registered trademarks of SAP AG in Germany and in several other countries all over the world. All other product and service names mentioned are the trademarks of their respective companies. Wellesley Information Services is neither owned nor controlled by SAP. 47