20 Data Models Stored Procedures
20 Data Models Stored Procedures
www.saphana.com/startupfocus
Agenda
Overview & Introduction
Modeling:
Attributes
Analytics
Complex Modeling
Stored Procedures:
SQLScript
CE Functions
Overview: Creating an Application
access control
data model
(DB)
Join Types
Referential
Inner
LeftOuter
rightOuter
TextJoin
Cardinality
1:1
N:1
1:N
Language Column (for text join)
Note: the direction in which you
draw the join matters (left table first)
Data Preview
Column Store
Activate
Projection
Projection
Analytical View
Union
Attribute View
Analytical View
Calculation View
UNION UNION
Combining multiple Analytical Views 2.. N (Input Sources)
Use Union with Constant values when working with Multiple (2..N) Analytical Views / fact tables
Analytical View
Projection
Union
SQLScript is the major programming language in DB layer and there are two ways
to implement:
SQLScript based calculation views
Stored procedures
SQLScript is also the interface to invoke some other programming options in SAP
HANA:
R Integration
BFL(Business Function Library)
BEGIN
...
Products
-- Query 1
product_ids = select "ProductId", "Category", "DescId"
from "SAP_HANA_EPM_DEMO"."sap.hana.democontent.epm.data::products"
where "Category" = 'Notebooks'
or "Category" = 'PC';
-- Query 2 Q1
product_texts = select "ProductId", "Category", "DescId", "Text"
from :product_ids as prod_ids
inner join "SAP_HANA_EPM_DEMO"."sap.hana.democontent.epm.data::texts"
as texts on prod_ids."DescId" = texts."TextId";
-- Query 3
out_notebook_count = select count(*) as cnt from
:product_texts where "Category" = 'Notebooks'; Q2
-- Query 4
out_pc_count = select count(*) as cnt from
:product_texts where "Category" = 'PC';
...
Q3 Q4
END;
Notebooks PCs
bp_addresses =
select a."PartnerId", a."PartnerRole", a."EmailAddress", a."CompanyName",
a."AddressId", b."City", b."PostalCode", b."Street"
from "SAP_HANA_EPM_DEMO"."sap.hana.democontent.epm.data::businessPartner" as a
inner join "SAP_HANA_EPM_DEMO"."sap.hana.democontent.epm.data::addresses" as b
on a."AddressId" = b."AddressId" where a."PartnerRole" = :partnerrole;
SQL
lt_bp = CE_COLUMN_TABLE("SAP_HANA_EPM_DEMO"."sap.hana.democontent.epm.data::businessPartner",
["PartnerId", "PartnerRole", "EmailAddress", "CompanyName", "AddressId" ]);
lt_address = CE_COLUMN_TABLE("SAP_HANA_EPM_DEMO"."sap.hana.democontent.epm.data::addresses", CE
["AddressId", "City", "PostalCode", "Street"]);