e04 - sap hana case study tasks 3-5 (view creation) solution

Upload: ivan

Post on 03-Mar-2016

25 views

Category:

Documents


0 download

DESCRIPTION

Caso de estudio SAP hana

TRANSCRIPT

EXERCISE

CASE STUDYSAP HANA Data Modeling Case StudyTasks 3-5 SolutionNOTES: 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.) Create an attribute view for customer dataOpen the modeler perspective in the SAP HANA StudioWindow Open Perspective ModelerCreate a new package to group the views that you will create in the following stepsNOTE: For the workshop, HANA-Course-XXX will be HANA-Course-030.

Navigator View Content Right click on HANA-Course-XXX New PackageEnter the name and description, using gbi-student-XX where XX is your student number.

Your package will appear under HANA-Course-XXX.

In your package, create an attribute view for the customer dataNavigator View Content HANA-Course-XXX Package gbi-student-XX Right click New Attribute ViewComplete the required information using your student number, XX (e.g., CUSTOMER_ATV_XX).

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.

Join the table GBI_DEMO1_COUNTRY with table CUSTOMER_ATTR_XX using a text joinDrag & 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.

Join the table GBI_DEMO1_SALESORG with table CUSTOMER_ATTR_XX using a text joinDrag & 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.

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.

Add all attributes that should be visible in this view to the output structureSelect 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.

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

Perform the description mapping for the fields COUNTRY and SALES_ORGANISATION in the properties of the output structureAdd 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.

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).

Save, validate and activate the viewPress Save and Validate.

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.

Create an attribute view for product dataCreate a new attribute view for product data in your packageNavigator View Content HANA-Course-XXX Package gbi-student-XX Right click New Attribute ViewEnter 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).

Add all relevant attributes to the output structure of the viewSelect all the table fields except PRICE and add them to the Output. Change the properties of PRODUCT to indicate that it is a key.

Save, validate and activate the viewPress 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.

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

Create an analytic viewCreate a new analytic view for the sales data Navigator View Content HANA-Course-XXX Package gbi-student-xx Right click New Analytic ViewEnter 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.

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.

Resulting Output structure:

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

Resulting output field types:

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.

Add net revenue as a calculated measure to the output structure of the viewIn 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.

Save, validate and activate the viewPress 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.

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

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

2008 SAP AG SAP AGPage 8