Creating a New InfoCube in SAP BW

Team-Fly

Constructing a custom InfoCube requires a good amount of analysis to identify end users' data analysis and reporting needs.

Before implementing an InfoCube, identify and document the following items:

  • InfoSources

  • Characteristics to Define Dimensions

  • Dimensions Attributes

  • Key Figures for Fact Tables

  • Update Plan for Key Figures

Building an InfoCube

To define a new InfoCube, right-click the InfoArea in the InfoCube tree-in SAP BW 1.2B and BW 2.0A-in which you want to create a new InfoCube and select the Create InfoCube option. The system then asks for the type of InfoCube to create. Depending on the release of SAP BW, you may want to create one or more types of InfoCubes, as shown in Figure 12-5.

click to expand
Figure 12-5: Defining a New InfoCube in SAP BW. The Top Shows the InfoCube Types Available in SAP BW 1.2B, the Middle in BW 2.0A, and the Bottom in BW 2.0B. Note that in SAP W 2.0B, There is No InfoCube Tree. In SAP BW 2.0B, You Will Find a Data Targets Tree, InfoAreas, and Either InfoCube or the ODS Object. SAP BW 2.0B is Discussed in Chapter 17; this is Here for Information Only.

In SAP BW, you can create an InfoCube from scratch or use an existing InfoCube as a template and then customize it for your needs. For example, you can take an existing InfoCube model, Customer or Orders InfoCube, and add or remove a few dimensions or key figures. This is one way to exploit SAP BW generic InfoCubes to define additional custom analytical applications.

Note 

The ASAP methodology for SAP BW has predefined information-gathering templates for the building blocks of InfoCubes. SAP BW methodology guides on data modeling and implementation are available at SAPNet. I recommend that SAP BW designers take advantage of these templates and methodology guides, which are well-suited for SAP infrastructure.

At the time of this writing, most templates and methodology guides were written for the SAP BW 1.2B version. With the implementation of ODS in SAP BW 2.0, the entire data modeling and analytical application design methodology is still missing in ASAP for SAP BW methodology documents and templates. I am sure SAP will update these methodologies before the SAP BW 2.0B GA release.

In SAP BW 2.0A, you have several options to define a new InfoCube, as shown in Figure 12-5. The Basic InfoCube is the same as what was in SAP BW 1.2B. The MultiCube option enables you to construct a new InfoCube that is based on another set of InfoCubes. The Remote Cube option enables you to build a virtual InfoCube that accesses data from an external instance. These new options make SAP BW a powerful and attractive OLAP engine that extends from a simple InfoCube-centric OLAP environment to multi-level InfoCube (data mart) integration.

Constructing an InfoCube consists of two major steps:

  1. Defining InfoCube data structures-characteristics, time, and key figures

  2. Assigning characteristics to dimensions

Defining InfoCube Data Structures

For this discussion, I'll define a simple Sales Analysis InfoCube with three dimensions: Customer, Material, and Distribution Channel with a key figure called Revenue Amount. Because we are defining a Basic Cube, the process of creating an InfoCube is the same in SAP BW 2.0 and BW 1.2B.

After entering the InfoCube name and description, as shown in Figure 12-5, the system displays the InfoCube Characteristics edit window, as shown in Figure 12-6.

click to expand
Figure 12-6: Assigning Characteristics, Dimensions, and Attributes for a New InfoCube using SAP BW 2.0A.

It is here that you select an InfoSource to associate with an InfoCube. Click the InfoSource icon on the right of the InfoObject Catalog option. This displays the available InfoObjects in the window section on the right titled Template. Now select the characteristics needed for the InfoCube. Select Characteristics from the right; copy them in the InfoCube structure to the left by clicking the icon with the left arrow in the middle of the screen, as shown in Figure 12-6. To add time and key figures, click tabstrips Time characteristics and Key figures and select corresponding objects from right to left in the InfoCube structures.

Assigning Characteristics to Dimensions

Click the Dimensions button to create and assign dimensions, as shown in Figure 12-7. After completing dimension assignments, make sure to check the InfoCube structure by clicking the check icon in the application menu bar, and then save this InfoCube definition. You must activate an InfoCube before creating the update rules. After activation, make sure that the InfoCube status in the InfoCube edit window shows saved, active, and executable. Exit this window.

click to expand
Figure 12-7: Creating Dimensions and Assigning Attributes to Them.

At this point, you have the basic structure of an InfoCube. However, the system does not know how to populate the fact and dimensions with the incoming data. To enable it to do so, you need to define the update rules to fill the fact and dimension tables.

Defining Update Rules for an InfoCube

Most often you define update rules for key figures only. Before creating update rules, you must know the business rules that define the measurements and key figures. To create update rules for an InfoCube, right-click the active InfoCube and select Create Update Rules. First you are prompted for the InfoSource name to use for the InfoCube, followed by the InfoCube Update Rule: Change window, as shown in Figure 12-8.

click to expand
Figure 12-8: Defining Update Rules for an InfoCube in SAP BW 2.0A. This Version Supports a Concept of a Startup Routine that was Not Available in SAP BW 1.2B.

To get to the Update Rules window, select one key figure and click the Detail icon on the bottom half of the window. This takes you to another window where you can define the update rules for characteristics and key figures.

The startup routine is an important new functionality in SAP BW 2.0A. For example, you can load reference data from a database for lookup or validation during the update rules. Instead of repeatedly accessing the database for lookups for each characteristic or key figure, you can write a routine to load and calculate all needed data in memory and then do lookups in memory instead of the database when updating the InfoCube. This improves InfoCube data loading time significantly. In earlier SAP BW versions, customers defined their own logic to call function modules in the update rules to develop a similar startup routine like functionality. This required complex ABAP programming to create update rules and programming. With this new functionality, you can simplify update rules.

Figures 12-9 and 12-10 show how to map source values to characteristics and key figures in an InfoCube. For each key figure, you have several options to update its value. If Addition mode is selected, the system looks for a record in which primary keys are the same. If such a record is found in the InfoCube, the new key figure value is set to the total of the old and new values.

click to expand
Figure 12-9: Update Rules Details for Key Figures in an InfoCube. The Top Section Defines How Key Figures are Saved in an InfoCube, the Middle Section Describes Mapping of a Key Figure Value before it is Stored, and the Bottom are the Units for Reference for the Key Figure.

click to expand
Figure 12-10: Defining Update Rules for Characteristics. Five Methods are Available to Map Characteristics and Assign Values: Direct InfoSource, Constant Value, From Master Data, Through an ABAP Routine, or Initial Value.

The update method for a key figure could be a simple move or a very complex logic to compute values. You can define an update routine by selecting the ABAP Routine method icon as shown in Figure 12-9. Then click the Create new routine icon on the right of the Routine method line. You will be asked to enter a routine name. SAP provides an ABAP routine template that will need its structured defined. You simply need to add your logic for key figure calculation.

A sample update code is listed in Appendix B, "SAP BW and SAP R/3 Transactions, Tables, and Code Examples."

Similar methods are applied to characteristics update rules. Here you map InfoObjects from InfoSource to characteristics, as shown in Figure 12-10.

There are five sources for characteristic updates, as shown in Figure 12-10. The InfoSource implies a simple move. A constant value means it is a fixed value. For example, say you are building a data mart-InfoCube-for a specific region-North America-and you do not have its value in the incoming InfoSource; here you can assign a fixed value to sales region characteristics.

The Read master data option allows you to look up values from the master data tables. For example, say you want to store actual descriptions of Sales Organization instead of its code, or you want to standardize product or customer codes based on a predefined master data lookup table.

The ABAP routine option allows you a complex method to evaluate characteristic assignment. For example, for data quality assurance, you can write an ABAP routine that parses the incoming product code to assure that it conforms to defined product codes. Another example for writing an ABAP routine is to verify that the ship-to characteristic-customer-is correct. For example, a customer, say Digital Equipment Corporation, may be written as Digital, Digital Equip. Corp., or DEC. From a data quality perspective, you can write an ABAP routine to assign the ship-to characteristic the correct name of Digital Equipment Corporation.

The Initial value option simply sets the characteristic value to a blank.

After defining all update rules, check the update program by clicking the Check icon on the bottom left of the Update Rule definition window. If no errors are reported, click the Transfer button that has a green check mark and exit this window. Save and activate the update rules.

Note 

To view any error in generating update rules or to view a complete ABAP program that updates the InfoCube, select the Extras menu option and click Display activated program, as shown in Figure 12-11. This ABAP program provides you with all the information you may ever want to know regarding SAP BW populated InfoCubes. A complete listing of InfoCube update programs is included in Appendix B.

click to expand
Figure 12-11: Accessing Error Logs and Generated InfoCube Update ABAP Code.


Team-Fly


Business Information Warehouse for SAP
Business Information Warehouse for SAP (Prima Techs SAP Book Series)
ISBN: 0761523359
EAN: 2147483647
Year: 1999
Pages: 174
Authors: Naeem Hashmi

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net