Академический Документы
Профессиональный Документы
Культура Документы
DMM360
Exercises / Solutions
Las Vegas / Srinivas Rapthadu / SAP Labs US
Las Vegas / Werner Steyn / SAP Labs US
Bangalore / Vaishnavi Dharmaraja / SAP Labs India
Bangalore / Rajesh Panditi / SAP Labs India
Barcelona / Yves Augustin / SAP SE
Barcelona / Christoph Morgen / SAP SE
DMM360
CYCLIST
Exercise 1-1: ATM Alerts (10 Minutes / 33 steps)
Detects unusual high and low bank withdrawal transactions.
Includes the usages of the Debugger, Visualize/Explain plan, SQL expressions, and filters.
Exercise 1-2: ATM Activity (10 Minutes / 32 steps)
Calculates and compares the number of withdrawal vs deposit transactions per month.
2 approaches (Restricted Key Figures vs Union branches), conditional exception-aggregation.
Exercise 1-3: Soccer players (20 Minutes / 45 steps)
Calculates the most valuable soccer player across teams.
Includes the Rank node & Visualize plan.
Exercise 1-4: CO-PA Analyses (30 Minutes / 38 steps)
Showcases Actual vs Planned profitability Analyses.
Includes Union, Star-Join, Text-Join (multi-language support).
Exercise 1-5: Market Basket Analysis (30 Minutes / 20 steps)
Analyze product combinations that frequently co-occur in transactions.
Exception aggregation, multi-level aggregation, currency conversion.
SNOWBOARDER
Exercise 2-1: Data-Column Masking (10 Minutes / 26 steps)
Column level security, obfuscate sensitive column content based on user rights.
Stored procedure, input parameters, expression syntax.
Exercise 2-2: Cumulative Sales & Slowly Changing Dimensions (20 Minutes / 74 steps)
Calculate rolling sales by month and product.
Temporal Join, Dynamic Join, Keep Flag & Transparent filter Flag.
Exercise 2-3: Dynamic Time Based Analysis (20 Minutes / 44 steps)
Current Year Quarter sales vs Previous Year Quarter Sales.
Time series, SQL table functions.
Exercise 2-4: Restricted Regional Sales report (20 Minutes / 53 steps)
Row level security, restrict users to their assigned regional areas.
SQL Analytical Privileges, Roles, debugging authorization errors.
Exercise 2-5: Dilbert HR Org chart (20 Minutes / 59 steps)
Calculates total sales for both managers and their employee.
SQL Analytical Privileges, SQL Hierarchies and SQL-Hierarchy Prompts.
DMM360
ASTRONAUT
Exercise 3-1: Hot vs Cold sales data (20 Minutes / 49 steps)
Model current sales vs historical sales using Smart Data Access design principals.
UNION pruning configuration table, explicit, implicit pruning.
Exercise 3-2: Analyze US presidential State of the Union speeches (15 Minutes / 40 steps)
Calculate linguistic differences by analyzing unstructured text data.
Text Analysis, exception aggregation.
Exercise 3-3: UFO sighting predictions (45 Minutes / 106 steps)
Analyze and predict historic UFO sightings near airports using GEO Spatial capabilities.
Spatial Joins, Spatial expressions, Predictive Analytics.
Exercise 3-4: Inventory Management - FIFO (20 Minutes / 23 steps)
Calculate the profitability by item (cost vs sales) using First-In-First-Out (FIFO) method.
Advanced SQL knowledge, functions, and time series.
Exercise 3-5: Non-cumulative Daily stock balance (20 Minutes / 36 steps)
Calculates the daily stock balance per product based on inflow and outflow.
Advanced SQL knowledge, functions, cross-joins, dynamic exploding and imploding of data.
DMM360
SETUP
Total steps (11) - 5 Minutes
Explanation
Screenshot
DMM360
6. Click Finish
DMM360
DMM360
EXERCISE 1-1
ATM WITHDRAWL ALERTS [10 MINUTES]
In this exercise the solution is already done for you; you will review the model and use the debugger,
visualization and explain plan to look at query execution. The model consists of multiple levels of
aggregation and parallel calculations; the average daily withdrawal and the total daily withdrawal is
calculated per customer followed by the deviation withdrawal that is calculated by subtracts the
average daily withdrawal from the total daily withdrawal. The results show deviations that are both
higher and lower than the average withdrawal amount.
Screenshot
1. Open CvAtmAlertQuery
Within the Navigator view
expand folder dmm360 > sol >
1-1
DMM360
6. TotalWithDrawal is the
aggregated sum of all
withdrawals
DMM360
DMM360
10
DMM360
11
DMM360
12
DMM360
13
DMM360
14
DMM360
EXERCISE 1-2
ATM WITHDRAWL ACTIVITY [10 MINUTES]
This exercise demonstrates how to calculate measures depending on certain dimensional values and
showcases 2 common modeling techniques (Restricted Columns vs Unions). Using the ATM
withdrawal data set from the previous exercise you are tasked to compare the Amount Deposited
against the Amount Withdrawn including the number or Withdrawal and Deposit transactions per
Account.
Screenshot
15
DMM360
16
DMM360
17
DMM360
Attribute
Attribute
Attribute
Measure
18
DMM360
19
DMM360
20
DMM360
21
DMM360
26. Result
22
DMM360
EXERCISE 1-3
SOCCER PLAYER GOALS [20 MINUTES]
In this exercise the Rank node is used to determine the most valuable soccer players. Your
assignment is to display only the 2 most valuable players per team. Additionally you are required to
dynamically direct the execution to a separate model for team prompts and unique team queries.
Screenshot
23
DMM360
24
DMM360
25
DMM360
26
DMM360
16. (Optional) click on the Join
node > over in the Details area
ensure that the GoalsByPlayer
node is defined as the RIGHT
node. If not right click on
GoalsByPlayer > Swap as Left
Table
17. Select the Join node and Join
the 2 branches using TeamID
Hint: Select the TeamID column
on the left branch and drag it to
the TeamID column on the right
branch.
18. Add all the columns of
GoalsByPlayer (except the
PlayerID) to the Output
19. Select the Aggregation Node.
Attribute
Attribute
Attribute
Measure
Measure
Measure
DMM360
28
DMM360
29. Expand Search On Table and
notice the WHERE clause filter
that is pushed down to the
Player Table.
29
DMM360
30
DMM360
31
DMM360
32
DMM360
EXERCISE 1-4
COPA ACTUAL VS PLANNED [30 MINUTES]
This exercise demonstrates the classical ERP CO-PA probability analysis scenario providing multidimensional insights into a companys product profitability. It implements various modeling techniques
such as Star Joins, Text Joins, and Unions to compare Actual and Planned data.
Screenshot
33
DMM360
34
DMM360
35
DMM360
36
DMM360
DMM360
38
DMM360
39
DMM360
EXERCISE 1-5
BASKET ANSLYSIS [30 MINUTES]
This exercise showcases the concept of market basket analysis in which retailers seek to understand
the purchase behavior of customers. The example below answers the question How much is the
average customer order when one of the items ordered are a hand held device? In addition your
assignment is to enable currency conversion for this model.
Screenshot
40
DMM360
41
DMM360
42
DMM360
SELECT CONVERT_CURRENCY(amount=>"Sale",
"SOURCE_UNIT" => 'EUR',
"SCHEMA" => 'DMM360',
"TARGET_UNIT" => 'ZAR',
"REFERENCE_DATE" =>"CreatedOn",
"ERROR_HANDLING"=>'set to null',
"CLIENT" => '000') AS "Sale"
FROM "CvBasketAnalysisQuery
43
DMM360
EXERCISE 2-1
DATA MASKING [30 MINUTES]
In this exercise you are tasked to dynamically mask the users Social Security number and/or Zip code.
Screenshot
5. Execute SQL-2
The procedure determines
when columns should be
flagged
CALL "DMM360"."dmm360.sol.2-1::SpDataMasking"('SOC',?);
// Result = 1
CALL "DMM360"."dmm360.sol.2-1::SpDataMasking"('ZIP',?);
// Result = 0
44
DMM360
45
DMM360
46
DMM360
47
DMM360
EXERCISE 2-2
CUMULATIVE SALES [30 MINUTES]
This exercise showcases sales by month & cumulative slowly changing dimensions. Notice the optical
illusion, even though the Rolling Sales appears to be rising each month the Sales by Month report
exposes the fact that sales are declining each time Granny Smith (Apples) were sold. This solution
uses a helper table for the monthly rolling totals, and temporal join functionality is used for the
changing dimensions. The model also demonstrates how to use the Transparent Filter, Keep flag and
Dynamic Joins.
Screenshot
48
DMM360
Also notice
Product 1 sales January = $40
Product 2 sales January = $10
5. Strictly informational:
Based on the sample dataset
the expected rolling monthly
sales are shown in the
screenshot.
6. Strictly informational:
Based on the sample dataset
the expected rolling monthly
sales by product are shown in
the screenshot.
49
DMM360
-- Month Rolling
select C."Month", M."Month" as "Months"
from "DMM360"."dmm360.db::cds.CumulativeSales" C,
"DMM360"."dmm360.db::cds.CumulativeSales" M
where M."Month"<=C."Month" group by C."Month", M."Month"
50
DMM360
51
DMM360
19.Execute SQL-2
52
DMM360
53
DMM360
54
DMM360
55
DMM360
56
DMM360
57
DMM360
58
DMM360
59.Notice ProductID is
unnecessarily brought into
context. This is a result of the
ProductID being used in the
concatenated join above.
Hint: This can be enhanced by
setting the join to a Dynamic
Join instead.
60.Close the debugger and
proceed to change the model.
61.Double click on any of the Join
lines.
59
DMM360
67.Optional Step
When building Complex Models
the Show Linage (In the
Semantics > Columns) feature
can be used to find column
references easily
60
DMM360
61
DMM360
EXERCISE 2-3
DYNAMIC TIME ANALYSIS [20 MINUTES]
This exercise demonstrates the recommended modeling approach to use Table functions (instead of
the traditional Script based Calculation Models) when SQL is required. The model calculates the
current quarter sales and the previous year quarter sales based on a given date prompt. A table
function is used as a data source and will utilize time series functions to dynamically generate
dimensional time data at runtime without having to rely on a physical time/date table.
Screenshot
62
DMM360
63
DMM360
-- SQL-2
SELECT * FROM
"DMM360"."dmm360.ws#.##::TfQuarterToDateByYear"
('C','2014-05-04') ;
64
DMM360
65
DMM360
66
DMM360
67
DMM360
68
DMM360
69
DMM360
-- SQL-3
SELECT SUM("PreviousSales"), SUM("CurrentSales")
FROM
"_SYS_BIC"."dmm360.ws#.##/CvDynamicTimeBasedAnalys
isQuery"
('PLACEHOLDER' = ('$$IP_DATE$$', '2014-05-04')) ;
44. Result
70
DMM360
EXERCISE 2-4
RESTRICTED SALES REPORT [20 MINUTES]
Your assignment is to implement row level security around a regional sales model and restrict certain
users to USA sales data only. The model is already prepared; however you need to create SQL
Analytical Privileges with the necessary roles and then debug and solve any authorization issues. In
addition you will learn how to create dependent value help lookup prompts.
Power Users
Screenshot
71
DMM360
72
DMM360
73
DMM360
74
DMM360
75
DMM360
role dmm360.ws#.##::CountryAccessRole {
sql object dmm360.ws#.##::CvOrdersQuery :SELECT;
analytic privilege:
dmm360.ws#.##:ApCountry.analyticprivilege;
}
-- SQL-3
CONNECT DMM360_## PASSWORD Welcome16;
CALL "DMM360"."dmm360.db.procs::EXE_24_GrantRoleSelfService"();
76
DMM360
-- SQL-4
CONNECT DMM360_BI PASSWORD Welcome16;
role dmm360.wsX.XX::CountryAccessRole {
sql object dmm360.wsX.XX::CvOrdersQuery :SELECT;
analytic privilege: dmm360.wsX.XX:ApCountry.analyticprivilege;
analytic privilege: dmm360.wsX.XX:ApProductAndOrders.analyticprivilege;
}
77
DMM360
78
DMM360
79
DMM360
EXERCISE 2-5
DILBERT HR ORG CHART [30 MINUTES]
This exercise consists of 3 parts; SQL Analytical Privileges, SQL Hierarchies and SQL-Hierarchical
prompts. Your assignment is to create an employee parent child hierarchy and to ensure that the
Margin is calculated correctly at each level of the hierarchy. In addition you will learn how to
incorporate design time roles and how to debug authorization errors.
Screenshot
80
DMM360
81
DMM360
13. Name:
Type:
Child:
Parent:
OrgHierarchy
Parent-Child
EmployeeID
ManagerID
82
DMM360
83
DMM360
84
DMM360
85
DMM360
Note: At this point you wil not be able to query the Model; SQL
Analytical priveleges require structured privileges which we will
create next.
86
DMM360
44. Result
role dmm360.ws#.##::EmployeeAccessRole {
sql object dmm360.ws#.##::CvSalesSQLHierarchyQuery
:SELECT;
analytic privilege: dmm360.ws#.##:ApSales.analyticprivilege;
}
--SQL-3
CALL "DMM360"."dmm360.db.procs::EXE_25_GrantRoleSelfService"();
87
DMM360
--SQL-4
CONNECT DMM360_BI PASSWORD Welcome16;
--SQL-5
SELECT USER_NAME, STRUCTURED_PRIVILEGE_STATUS,
ROOT_OBJECT_NAME, OBJECT_NAME, EFFECTIVE_FILTER,
STRUCTURED_PRIVILEGE_FILTER
FROM EFFECTIVE_STRUCTURED_PRIVILEGES WHERE
USER_NAME = 'DMM360_BI' AND
ROOT_SCHEMA_NAME = '_SYS_BIC' AND
ROOT_OBJECT_NAME IN (
'dmm360.ws#.##/CvEmployee',
'dmm360.ws#.##/CvSalesSQLHierarchyQuery'
);
analytic privilege:
dmm360.ws#.##:ApEmployee.analyticprivilege;
88
DMM360
89
DMM360
EXERCISE 3-1
HOT VS COLD SALES DATA [20 MINUTES]
In this exercise you will use Smart Data Access to build a sales model that automatically queries hot
data that resides in SAP HANA or the cold data that resides in an external database without having to
expose the technical details of where the data is located to end users. Your assignment is to model
the Union and to implement both explicit and implicit input source pruning.
Screenshot
90
DMM360
91
DMM360
92
DMM360
93
DMM360
94
DMM360
No
Filter
PLACEHOLDER = (
IP_COLD_YEAR,
2014
)
PLACEHOLDER = (
IP_COLD_YEAR, 2014
)
WHERE
"SOURCE" = 'IQ'
WHERE
"SOURCE" = 'HANA'
95
DMM360
96
DMM360
97
DMM360
98
DMM360
EXERCISE 3-2
STATE OF THE UNION SPEECH [15 MINUTES]
In this exercise Text Analysis is used against unstructured data. Your assignment is to analyze State
of the Union speeches and to calculate linguistic differences between US presidents.
Screenshot
99
DMM360
100
DMM360
-- SQL-1
SELECT * FROM
"DMM360"."dmm360.db::opt.Transcripts";
-- SQL-2
101
DMM360
14.Rename TA_TOKEN_1 to
Counter
102
DMM360
103
DMM360
20. Results.
104
DMM360
105
DMM360
106
DMM360
EXERCISE 3-3
UFO SIGHTINGS [45 MINUTES]
In this exercise you will use GEO Spatial capabilities to analyze UFO sightings near US airports and to
predict future sightings. The Models are half done; your assignment is to calculate the amount of
airports within a specific radius of each sighting, you also need to enhance the model to work with
both kilometers and miles. In addition you will finish the predictive model to show how many UFOs to
expect in the future months based on the historical data.
Screenshot
107
DMM360
108
DMM360
109
DMM360
Before starting with the model we can get an idea how far
these sigtings are from the Phoenix International Airport by
manually executing a query and joining the sighing location
on 20080421 with the Phoenix Airport location. See next
step.
110
DMM360
111
DMM360
112
DMM360
113
DMM360
PROCEDURE "DMM360"."dmm360.sol.33::SpConversionUtil" (
IN miles STRING, OUT kilometers STRING)
LANGUAGE SQLSCRIPT SQL SECURITY INVOKER
DEFAULT SCHEMA DMM360 READS SQL DATA AS
BEGIN
kilometers := :miles * 1.60934;
END;
114
DMM360
115
DMM360
116
DMM360
117
DMM360
118
DMM360
119
DMM360
120
DMM360
121
DMM360
122
DMM360
100.
Work on the input
parameters next. Within the
Semantics node > Click on
Parameter mappings.
101.
Select Data Sources from
the type drop down list > Drag
all the input parameters
individually from the left side to
the right side.
102.
Activate!
123
DMM360
103.
Preview
104.
When prompted enter the
following parameter values
IP_YEAR: 2009
IP_ALPHA: 0.06
IP_DELTA: 0.01
105.
Within preview > Analysis >
add the Month, Sightings and
Predicted columns
106.
Change the chart > choose
combo bar-line chart.
Notice: The bars are the
historic sightings and the lines
are the predicted sightings for
each future month.
124
DMM360
EXERCISE 3-4
FIFO INVENTORY [30 MINUTES]
This exercise demonstrates the classical First-In, First-Out (FIFO) method that is used to calculate the
value of inventory on hand at the end of an accounting period and the cost of goods sold during the
period. This method assumes that inventory purchased or manufactured first is sold first and newer
inventory remains unsold. As seen in the example on Feb 15th, 5 apples were sold, of which 3 were
purchased at 10.5 (carry over from Jan 15th sale). The remaining 2 apples were purchased at 13.25.
Screenshot
125
DMM360
4. Execute (SQL-2)
The FIFO method requires
calculations on item level, one
solution is to explode the data.
As a first step we need to find
the maximum Quantity
Purchased.
5. Execute (SQL-3)
Based on the results from the
previous step we can create a
dynamic temporarily (tally) table
at runtime using Series data
functions.
126
DMM360
6. Execute (SQL-4)
The following SQL will explode
the data (as a result of the join
between Purchases and Tally)
i.e. Purchase ID (1) contains a
quantity of 10, this results in 10
records
8. Open FifoPurchases
Review the equivalent SQL
Script
127
DMM360
11.Execute (SQL-6)
Note: The Join between
Purchases and Sales on (Item
and Sequence)
128
DMM360
"Sale" - "Cost"
129
DMM360
EXERCISE 3-5
NON CUMULATIVE MEASURES [30 MINUTES]
Non-cumulative key figures are calculated based on other key figures and characteristics, values are
not stored but are calculated during runtime. Non-cumulative key figures are used in applications
where users want to know the daily stock level or account balance.
In the exercise example the Daily Balance calculation depends on the previous days Daily Balance
calculation and therefore needs to be carried over to the next day.
Source Data
End of Day
Screenshot
130
DMM360
131
DMM360
132
DMM360
133
DMM360
134