1. 3 - Creating Modeled Views in SAP HANA Studio
ABAP for HANA Developer Best Practice
Image
Best
Practice
3 - Creating Modeled Views in SAP HANA Studio
Summary Simple Reporting using Modeled Views (Attribtue View, Analytic View) in SAP HANA: In this exercise a simple
reporting model is created using the SAP HANA Studio. The reporting model is used to display the aggregated
gross revenues (field GROSS_AMOUNT from sales order item) per country (from business partner address) and
currency (from sales order item)
Author(s) Ingo Bräuninger, Bertram Ganz
Level Intermediate
Applies to
SAP
NetWeaver
AS ABAP
not applied
Applies to
SAP
HANA DB
SQLScript V2.0, SAP HANA Appliance Software SPS 04
Last
Update
Aug 16, 2012 10:37
Labels -,a4hdevbestpractice puma add label ...
Tiny URL https://wiki.wdf.sap.corp/wiki/x/_geORg
PDF
Export
Export this 'A4H Dev Best-Practice' to PDF
Internal Use Only
The ABAP For HANA Developer Best-Practice and How-to Guides were created as a team effort between the ABAP for HANA
and TIP Core ABAP Development in TIP Core ABAP Platform, SAP HANA Development and theReference Scenarion team
SAP TIP Core Product Management teams. Please do not distribute directly to customers or partners without the express
permission of the SAP TIP Core ABAP Platform Product Management team. These guides are for internal use only at this time!
Future revisions of selected how-to guides will be made publically available via SDN. For additional information contact: Bertram
or .Ganz Jens Weiler
Table of Contents
2. Overview
Procedure Details
Task 1: Create a new attribute view for customer master data
Task 2: Create a new analytic view, which reads the gross revenues from sales or item
Task 3: Check the result in the data preview
Overview
In this exercise a simple reporting model is created using the SAP HANA Studio. The reporting model is used to display the aggregated gross
revenues (field GROSS_AMOUNT from sales order item) per country (from business partner address) and currency (from sales order item).
Create a new attribute view for customer master data
Create a new analytic view, which reads the gross revenues from the sales order item
Check the result in data preview
For simplicity reasons we do not do a currency conversion in this exercise. Therefore we need to include the currency in the output.
Procedure Details
The exercise comprises of the following steps (which are explained below step by step):
Task 1: Create a new attribute view for customer master data
Task 2: Create a new analytic view, which reads the gross revenues from sales or item
Task 3: Check the result in the data preview
Task 1: Create a new attribute view for customer master data
Go to the Modeler perspective in Eclipse. If the Modeler perspective is not available via the toolbar, press the ‘Open perspective’ button.
3. If you are not yet connected to the database server (i.e. the Navigator is empty), add the workshop system via right mouse click (then
choose ‘Add System’).
Find your package test.oia.<W00>.<Wxx> in the Navigator. Hint: path is Content ? test ? oia ? <W00> ? <Wxx>
Create a new attribute view AT_BUYER to display customer master data in your package (hint: view type is ‘Standard’).
The attribute view needs to read data from tables <SAPSID>.SNWD_BPA (business partner) as well as <SAPSID>.SNWD_AD
(addresses). Enter filter strings SNWD_BPA and SNWD_AD to find and then add the two tables to the attribute view.
The following screenshot displays the relationship between the tables as well as the necessary attributes.
4. Create the referential join condition of type 1:1 between the tables by pressing the mouse button and drawing a line from attribute
SNWD_BPA.ADDRESS_GUID to SNWD_AD.NODE_KEY. Repeat this for SNWD_BPA.CLIENT to SNWD_AD.CLIENT.
Add the needed attributes (highlighted in the screenshot). Hint: you need to define at least one key attribute using context menu item
‘Add as Key Attribute’. In the example the key attributes should be CLIENT and NODE_KEY from SNWD_BPA. The other attributes can
be easily added via double mouse clicks.
Validate and activate attribute view AT_BUYER. Afterwards check the result in data preview.
5. Task 2: Create a new analytic view, which reads the gross revenues from sales or item
The analytic view is supposed to display the aggregated gross revenues per country and currency.
Find your package test.oia.<W00>.<Wxx> in the Navigator.
Create a new analytic view AN_GROSS_REVENUES.
The analytic view needs to read data from the tables for sales order header and sales order item. Therefore add the two tables
<SAPSID>.SNWD_SO and <SAPSID>.SNWD_SO_I to the analytic view.
On the next screen add the attribute view AT_BUYER to the view.
In the Data Foundation join the tables for sales order header and sales order item.
6. The join should be a referential join. The left table of the join should be sales order item.
Add the following fields from SNWD_SO as attributes: CLIENT, BUYER_GUID
Add the following fields from SNWD_SO_I as attributes: CURRENCY_CODE
Add the following fields from SNWD_SO_I as measures: GROSS_AMOUNT, NET_AMOUNT, TAX_AMOUNT via context menu item
‘Add as Measure’
The analytic view should now look like this:
7. Maintain also the Logical View. In the logical view you maintain the join conditions between the Data Foundation and attribute view
AT_BUYER.
Validate and activate attribute view AN_GROSS_REVENUES. Afterwards check the result in data preview.
8. Task 3: Check the result in the data preview
Use the data preview to create a simple report (it should look like the above screenshot). Therefore drag and drop the corresponding
fields to the label axis and value axis.
Back to top
Tag this page with matching labels.