Vous êtes sur la page 1sur 18

CASE STUDY

SAP HANA Data Modeling Case Study


Tasks 3-5 Solution
NOTES:
1. Refer to the SAP HANA Case Study.docx in addition to this solution for more
detail.
2. Use your participant number where 'XX' is used in the instructions.
3. Screenshots are intended to facilitate your navigation.
a. Their contents may not match yours exactly.
b. Do not type exactly what you see in the screenshots. (Use the naming
conventions provided in the text above the screenshots.)

3. Create an attribute view for customer data


3.1 Open the modeler perspective in the SAP HANA Studio
Window Open Perspective Modeler

3.2 Create a new package to group the views that you will create in the following
steps
NOTE: For the workshop, HANA-Course-XXX will be HANA-Course-030.
Navigator View Content Right click on HANA-Course-XXX New Package

Enter the name and description, using gbi-student-XX where XX is your student number.

SAP AG

Page

CASE STUDY

Your package will appear under HANA-Course-XXX.

3.3 In your package, create an attribute view for the customer data
Navigator View Content HANA-Course-XXX Package gbi-student-XX Right
click New Attribute View

Complete the required


CUSTOMER_ATV_XX).

SAP AG

information

using

your

student

number,

XX

(e.g.,

Page

CASE STUDY

Right click the Data Foundation and choose Add Objects.

Search for your Customer table and select it, making sure to choose the correct course
(HANA_XXX).

Repeat the process to add the GBI_DEMO1.GBI_DEMO1_COUNTRY and


GBI_DEMO1.GBI_DEMO1_SALESORG tables. Make sure you select tables from the
GBI_DEMO1 schema.

SAP AG

Page

CASE STUDY

3.4 Join the table GBI_DEMO1_COUNTRY with table CUSTOMER_ATTR_XX using


a text join
Drag & drop the field CUSTOMER_ATTR_XX.COUNTRY to field
GBI_DEMO1_COUNTRY.COUNTRY.

Click on the link between the two tables that represents the join. Now you should see
the properties of the join in the bottom. Adjust the properties to match those in the
screenshot.

SAP AG

Page

CASE STUDY

3.5 Join the table GBI_DEMO1_SALESORG with table CUSTOMER_ATTR_XX


using a text join
Drag & drop the field SALES_ORGANIZATION from the customer table to field
SALES_ORGANIZATION of table GBI_DEMO1_SALESORG.

Click on the link between the two tables that represents the join. Now you should see
the properties view for the join in the bottom. Adjust the properties to match those in the
screenshot.

3.6 The view should show only current customers. For current customers, the
valid-to date is equal to 9999-12-31. Add a corresponding filter to your view.
Select the VALID_TO field in the customer table.
Select the option Apply Filter in the context menu if this field.

SAP AG

Page

CASE STUDY

3.7 Add all attributes that should be visible in this view to the output structure
Select the table field that should be visible in the output structure.
Click on Add To Output.

Repeat the process so that the following fields are visible in the output structure.

SAP AG

Page

CASE STUDY

Select True for the property Key Attribute to mark CUSTOMER_NUMBER as a key.

3.8 Perform the description mapping for the fields COUNTRY and
SALES_ORGANISATION in the properties of the output structure
Add the description fields Short Text for both tables to the Output structure.

After adding the description fields to the output, click on the output fields of COUNTRY
and SALES_ORGANISATION and set the Label Column to Short Text and
Short_Text_1, respectively.
SAP AG

Page

CASE STUDY

Rename the output fields with the names SHORT_TEXT and SHORT_TEXT_1
to COUNTRY.description and SALES_ORGANISATION.description (only one
screenshot is provided below since the process is the same).

SAP AG

Page

CASE STUDY

3.9 Save, validate and activate the view


Press Save and Validate.

SAP AG

Page

CASE STUDY

Check the Job Log. In case of an error, the job is highlighted in red.

Once there are no errors, press Save and Activate.

Check the Job Log. In case of an error, the job is highlighted in red.

Right click your attribute view and display the data. Click on Raw Data to view the
individual values.
Note that 24 rows are retrieved although your
CUSTOMER_ATTR_XX table has 25 rows. This is due to the filter you added on
VALID_TO.

4. Create an attribute view for product data


3.10

Create a new attribute view for product data in your package

Navigator View Content HANA-Course-XXX Package gbi-student-XX Right


click New Attribute View
SAP AG

Page 10

CASE STUDY

Enter the name and description, using gbi-student-XX where XX is your student number.

Search for your Product table and add it to the Data Foundation, making sure to choose
the correct course (HANA_XXX).

3.11

Add all relevant attributes to the output structure of the view

Select all the table fields except PRICE and add them to the Output.
properties of PRODUCT to indicate that it is a key.

SAP AG

Change the

Page 11

CASE STUDY

3.12

Save, validate and activate the view

Press Save and Validate.

Check the Job Log. In case of an error, the job is highlighted in red.

If there are no errors, press Save and Activate.

SAP AG

Page 12

CASE STUDY

Check the Job Log. In case of an error, the job is highlighted in red.

5. Create an analytic view


3.13

Create a new analytic view for the sales data

Navigator View Content HANA-Course-XXX Package gbi-student-xx Right


click New Analytic View

Enter the name and description, using gbi-student-XX where XX is your student number.

Add your Sales table to the Data Foundation following steps similar to those you used in
the attribute views.

SAP AG

Page 13

CASE STUDY

Add your Customer and Product attribute views to the Logical Join.

On the Data Foundation component, add all fields except DAY, ORDER_NUMBER
and ORDER_ITEM to the output structure.

SAP AG

Page 14

CASE STUDY

Resulting Output structure:

Select the Semantics component to change the type of the output fields.

Resulting output field types:

SAP AG

Page 15

CASE STUDY

3.14 Join the sales table with the product and customer view, using a referential
join
Switch to the Logical Join component.
Drag & drop field DATAFOUNDATION.CUSTOMER_NUMBER_1 to field
CUSTOMER_ATV_XX.CUSTOMER_NUMBER.
Drag & drop field DATAFOUNDATION.PRODUCT_1 to field
PRODUCT_ATV_XX.PRODUCT.
If you click on either join, you will notice in the properties that the default join type is
referential so there is no need to change it.

3.15

Add net revenue as a calculated measure to the output structure of the view

In the output structure of the analytic view, select the folder Calculated Columns and
choose New from the context menu. Enter the details as indicated in the screenshots.

Hint:
You need to select the Calculate Before Aggregation check box before the
SUM Aggregation Type appears.

SAP AG

Page 16

CASE STUDY

3.16

Save, validate and activate the view

Press Save and Validate.

SAP AG

Page 17

CASE STUDY

Check the Job Log. In case of an error, the job is highlighted in red.

If there are no errors, press Save and Activate.

Check the Job Log. In case of an error, the job is highlighted in red.

3.17

Open the data preview for your analytic view and check the data

Open the data preview for your analytic view and check the data, especially the values
for the Net Revenue calculated column.

SAP AG

Page 18

Vous aimerez peut-être aussi