Академический Документы
Профессиональный Документы
Культура Документы
Variable
http://saphanatutorial.com/sap-hana-online-training-sap-hana-advanced-modeling/#/
Variables are bound to columns and are used for filtering using WHERE clauses. As such, they can
only contain the values available in the Columns they relate to
Variable filter data at run time.
In modeling whole data will come to semantics and then data will get filtered based on the
selection value of filter
You use variables to filter data at runtime. You assign values to these variables by entering the
value manually, or by selecting it from the drop-down list.
You can also define whether the Variable is Mandatory or if it should have a Default Value.
You can apply variables only in analytic and calculation views.
You can apply variable only to attributes and not to measures
https://sapstudent.com/hana/sap-hana-variables/
Input Parameters(IP)
http://saphanatutorial.com/sap-hana-online-training-sap-hana-advanced-modeling/#
If we have expression and want data for any field at run time input parameter comes in picture
Variable filters data at semantics level while IP filters data at node level(Join,Projection, Aggregation)
If IP has been created and not used anywhere in modeling it won’t ask value at run time
WHERE:
The value of Variable is passed using WHERE clause.
WHERE ("REGION_NAME" IN ('Asia') )
To use IP of child calc view in parent view, there should be mapping between IP of child view to IP of
parent view in manage mapping in semantic node.Check Scenario (States and city),(Child in parent) calc
views
Rank Node
https://www.youtube.com/watch?v=yA3qaTVSFVg/
Rank node is available from SPS-9 only
If you want Rank column in output table than u can’t in SPS 9, it’s available from SPS 10 only.
Threshold value will tell how many rows will come for each ‘partition by’ group in rank node.
Text Join
Use it while joining, Description table with fact table. Better to use Text Join instead of Left Outer
join
https://www.youtube.com/watch?v=ED7Xx78u5Xo/
FOR I IN 1 ..i
DO
End for
IF :MYROWID > 0
THEN
DROP TABLE "DBO"."IDQ_INTEGRITY";
END IF;
COLUMN_NAME,DATA_TYPE_NAME,LENGTH,"DESCRIPTION",
THEN 'MEASURE'
ELSE 'ATTRIBUTE'
END AS TYPE
FROM (SELECT
COLUMN_NAME,DATA_TYPE_NAME,LENGTH,B."DESCRIPTION", C.DIM
FROM "SYS"."TABLE_COLUMNS" as A
FROM "_SYS_BI"."BIMC_ALL_DIMENSIONS"
AND A.TABLE_NAME='INT2'
ORDER BY COLUMN_NAME
Q UE RY = ‘ S EL E CT (
"TOTAL_COUNT"/'||:V_ROW _COUNT||'*100),("TOTAL_COUNT"/'''||:ARY_CO
M P L E T E NE S S _ CO UN T[ : V _I ] | | '''* 1 00)
F RO M " DB O ". "I DQ _ DI S TI NCT _ V A L UE S _ NE W " W HE RE " CO L UM N _ NAM E " =
'''| | : A RY _ CO L UM N_ LI S T[ : V _I ] | | ''' ';
Definer vs Invoker
https://dba.stackexchange.com/questions/59887/what-are-definer-and-invoker-rights-in-database-oracle-
and-mysql/
Let's take a simple example:
You have this procedure using "definer rights" - which is the default in Oracle.
If the procedure has definer rights and another user want to execute it, user should have
EXECUTE privilege and it will execute with privilege of user who define it.
If the procedure has invoker rights and another user want to execute it. It will execute with
privilege of user who is calling it
Analytical Privilege
https://www.guru99.com/sap-hana-analytic-privileges.html/
Note: Referential integrity is the property of database which ensures that each foreign key value in a
table exists as a primary key in the referenced table.
Referential join is performance wise better than inner join, but only be used when you are sure that
referential integrity is maintained.
• Join Engine:
o • Used when querying an Attribute View
o • The join engine is also used, when you run plain SQL.
• OLAP Engine:
o • Used for Analytic view (without calculated columns).
• Calculation Engine:
o • Used for Analytic views with calculated attributes and Calculation views
System Schemas
_SYS_REPO:
Whatever the objects are there in the system is available in repository. This schema contains the list of
Activated objects, Inactive Objects, Package details and Runtime Objects information etc.
Also _SYS_REPO user must have SELECT privilege with grant option on the data schama.
Read more about "GRANT SELECT PRIVILEGE ON _SYS_REPO"
_SYS_REPO is a User
http://saphanatutorial.com/sap-hana-online-training-sap-hana-advanced-modeling/#/
If objects (tables/views) of a schema (say SCHEMA_ABC) are used to build modeling views then it’s
necessary to grant _SYS_REPO the SELECT WITH GRANT privilege on this schema.
The following SQL statement must be executed before activating any such modeling views.
GRANT SELECT ON SCHEMA SCHEMA_ABC TO _SYS_REPO WITH GRANT OPTION
If you miss this step, an error will occur when you activate your views later.
A table type is
o • Similar to a database table but do not have an instance
o • Used to define parameters for a procedure that represent tabular results.
Hierarchy
https://sapstudent.com/hana/level-hierarchy-in-sap-hana/
We can create two types of hierarchies in SAP HANA, they are
Level Hierarchy
Parent-Child Hierarchy
Point to Remember: Hierarchies created in Attribute views are not available in
a Calculation views that reuses the attribute view, however the same will be
available in Analytic View that reuses that attribute view.
Currency conversion
https://blogs.sap.com/2012/04/27/how-to-perform-currency-conversion-in-sap-hana/
While using this option you need to replicate the standard table into SAP HANA that are TCURR,
TCURC, TCURX, TCURF, TCURT, TCURV . If these standard tables are not available then you will
not be able to perform Currency Conversion.
Decision Table
https://sapstudent.com/hana/sap-hana-decision-tables-with-return-values/
To avoid multiple if-else statement we can use decision table
Things to remember:
1. If we assign the actual column (from physical table) as action, then when we execute the decision
table the values for that column will be modified permanently. This is called decision tables with
update values.
2. If we don’t want to modify the actual values and wants to have the result values in a new column,
then we need to add ‘parameter’ as action instead of actual column. This is called decision tables
with return values.
Check why calc view used and not attri and any view anymore
https://www.quora.com/Why-were-the-analytical-view-and-attribute-view-been-removed-in-SAP-HANA/
https://www.youtube.com/watch?v=DYyPrhwQsdY&index=27&list=PLDa15_03h61dluXfRC68nTZp1LUAQ
QOLw
From SPS10, it is always recommended to use calc view with SQL engine default
If we use all 3 views, all 3 engines will be used and data will pass from one to another engine which can
reduce performance.
Data Provisioning TECHNIQUE
SLT (SAP Landscape Transformation Replication Server)
Read PDF of SLT
https://www.guru99.com/slt-sap-landscape-transformation-replication-server-in-sap-hana.html/
BODS
Partitioning
https://www.youtube.com/watch?v=B2AtgeWBNE0/
Table Function
https://www.youtube.com/watch?v=ZIzljhIjH6Q
https://www.youtube.com/watch?v=OK5upVCq9A8
Table function can not have insert update delete query
You must be in SQL Developer mode to create Function from File Menu->New->Other
Table function have 2 types scaler function and tabular function
We can create our custom logic and put it in function to use it N number of times
If there is any logic which is going to use multiple times than we can create function of that logic and use it in
view N number of times
Table function can be used in Calc view while procedure can not
Dynamic Join
https://www.youtube.com/watch?v=bKJ3ao8XaLM/
In you do dynamic join in any field in aggregation and if you don’t use that fiend in data preview than aggregation
won’t take place on that field
Select Country AG1, Company, Product, Sales, Total_Sales AG2 from AG1 INNER JOIN AG2 on AG1.PRODUCT =
AG2.PRODUCT AND AG1.Country = AG2.Country
If dynamic join NOT done on country and if we remove country from data preview, query will be like
Select Company, Product, Sales, Total_Sales AG2 from AG1 INNER JOIN AG2 on AG1.PRODUCT = AG2.PRODUCT
AND AG1.Country = AG2.Country
If dynamic join done on country and if we remove country from data preview, query will be like
Select Company, Product, Sales, Total_Sales AG2 from AG1 INNER JOIN AG2 on AG1.PRODUCT = AG2.PRODUCT
- If we set the KEEP FLAG true for the attribute the aggregation will happen at final level.
- We set KEEP FLAG for the VBELN and NETWR aggregation as MAX , so that NETWR(SUM) will
happen at each level and so it will give correct output.
Example :
How to Debug Calculation View
3) Click on execute , then select any node and execute the query as per req.
Delivery Unit
1. Click on Delivery Unit from Quick launch(login to system then go to help click quick launch)
2. Select system
3. Create delivery Unit and Add require details
4. Click on add in assign packages and add packages which needs to Export and create it
5. Go to Export from quick launch and under “SAP HANA content” click on delivery unit
6. Select system and select your deliver unit from dropdown
7. Select package and click on either export to server or client and select path click finish
1) Developer mode – All repository objects such as roles cannot be transported using Developer
Mode
2) Delivery Unit - All repository objects can be transported using Deliver Units
Finance KPIs
Measures
1) Number of open items
2) Number of Overdue items
3) Amount of Open Items
4) Amount of Overdue Items
5) Overdue item(%)
6) Amount of Overdue Items(%)
Open Items : (Payment karvanu baki che or thyu che to analysis date pachi)
For this date the document is not cleared:
o Clearing date (BSEG-AUGDT > analysis date) OR (BSEG-AUGDT is empty)
For this date the posting date for payment is passed: BSEG-BUDAT <= analysis date(To_Date)
Overdue Items : (Payment karvanu baki che and chelli date vai gai hoy, chelli date analysis period
ni andar hoy)
For this date the document is not cleared: Clearing date (BSEG-AUGDT > analysis date) OR (BSEG-
AUGDT is empty).
For this date the net due date for payment is passed: NETDT < analysis date
o Where the net due date is calculate from the baseline date (BSEG-ZFBDT), then it depends of the
payment terms of the invoice.
NETDT = BSEG-ZFBDT + Max (BSEG-ZBD1T, BSEG-ZBD2T, BSEG-ZBD3T)
183_01 = Number of vendor open items
Formula:
Count document items where a document contains at least one item with
[(BSEG-AUGDT>Analysis Date) OR (BSEG-AUGDT=Blank)] AND (BSEG-BUDAT <=Analysis Date) AND (BSEG- KOART =
K) AND BSEG-SHKZG=’H’
183_02 = Amount of vendor open items
Formula: Sum Amount where
[(BSEG-AUGDT>Analysis Date) OR (BSEG-AUGDT=Blank)] AND (BSEG-BUDAT<=Analysis Date)
For each entry in Filter(List 1) where field BSEG-SHKZG = “H” AND BSEG- KOART = ‘K’ sum the value of field BSEG-
DMBTR.
183_03 = Number of overdue items
Formula:
Select all items of document in which at least 1 vendor item ((BSEG-SHKZG = “H”) AND (BSEG-
KOART=’K’)) of the document has NETDT < Analysis date or if the NETDT is zero
Count document items where a document contains at least one item with
[(BSEG-AUGDT>Analysis Date) OR (BSEG-AUGDT=Blank)] AND (NETDT<Analysis Date) AND (BSEG- KOART = K) AND
BSEG-SHKZG=’H’
183_04 = Amount of overdue items
Select all items of document in which at least 1 Vendor item ((BSEG-SHKZG = “H”) AND (BSEG-
KOART=’K’)) of the document has NETDT < Analysis date or if the NETDT is zero
Formula: Sum amounts where [(BSEG-AUGDT>Analysis Date) OR (BSEG-AUGDT=Blank)] AND (NETDT<Analysis
Date)
For each entry in Filter(List 1) where field BSEG-SHKZG = “H” AND BSEG- KOART = ‘K’, sum the value of field BSEG-
DMBTR.
183_05 = Number of days between the clearing date and the due date
Formula: Sum (Days per item (BSEG-AUGDT - NETDT)
Note than axis Time Gap is not considered for this measure.
183_06 = Overdue Items (%) = number of overdue items x 100 / number of open items
Formula: 183_03 x 100 / 183_01
183_07 = Overdue Invoices (%) = number of overdue invoices x 100 / number of open invoices
Formula: Count documents (BKFP-BELNR) where (BSEG-AUGDT>Analysis Date) OR (BSEG-AUGDT=Blank)] AND
(NETDT<=Analysis Date) x 100 / Count documents where [(BSEG-AUGDT>Analysis Date) OR (BSEG-AUGDT=Blank)]
AND (NETDT<=Analysis Date)
Consider a ‘document’ as a combination (primary key) of following fields :
- BKPF-BUKRS (Company Code)
- BKPF-GJAHR (Fiscal Year)
- BSEG-BELNR (Document Number)
183_08 = Overdue Amount (%) = amount overdue x 100 / amount open invoices
Formula: 183_04 x 100 / 183_02
103_1 : NETWR
103_2 :
For the same combination EKORG-LIFNR-MATNR; calculate the value of PO items with lowest price found:
[Best PO Item Value Material/Vendor] = Lowest unit price Material/Vendor * (MENGE
*UMREZ/UMREN)
Where MENGE*UMREZ/UMREN is the total sum of all MENGE*UMREZ/UMREN purchase item of the
Aggregation for every Purch.Org/Material/Vendor combination.
For each distinct occurrence of the combination of values EKKO-EKORG, RBKP-LIFNR and RSEG-MATNR, where the
lowest unit price is the lowest price for each combination:
W RBTR
LowestUnitPrice
UMREZ
MENGE*
UMREN
In the case that the Purchase Order has not yet been billed, i.e. no invoice exists, then the price from the purchase
order for that material/vendor combination will be taken as the only applicable price in scope of the analysis, so
the Lowest Unit Price will be calculated as:
EKPO NETW R
LowestUnitP rice
UMREZ
EKPO MENGE*
UMREN
One Purchase Order item has no invoice when:
For EKPO-EBELN = RSEG-EBELN and EKPO-EBELP = RSEG-EBELP has no result.
103_3
- Measure 103_01_3(Gain) =
UMREZ
Gain NETWR LowestUnit Pr ice * (MENGE * )
UMREN
Where:
- NETWR is the Purchase Order Item amount (EKPO-NETWR)
- Lowest Unit Price is the lowest unit price for every combination of EKORG/LIFNR/MATNR.
- MENGE is the Purchase Order item quantity in PO units.
- UMREZ and UMREN are the numerator and denominator for the conversion between PO units and the
base unit of the material.
So, Gain = Measure1 – Measure2
Supplier Quantity Reliability performance (145_2)
This indicator measures vendor delivery performance in terms of quantity reliability.
Measures
145_2_01: Sum Value of the Not fully delivered Scheduled Lines (Value)(aatli items haji deliver nai
thai)
145_2_02: Average Rate of Not fully delivered Schedule Lines in % from total docs (Ratio)(Total
amount mathi aatla X% amount ni items haji deliver nai thai)
Where:
- MENGE is the scheduled quantity.
- WEMNG is the delivered quantity.
- UMREZ and UMREN are the
numerator and denominator for the
conversion of the PO quantity from
PO units into base units.
COUNT_SCHEDULE_LINES: Total Number of Schedule Lines NOT fully delivered (Item Level)
This measure indicates the number of Purchase Order (at Item level) not fully delivered.
Predictive Analysis Library
To use PAL algorithm, you must do the following:
1. Generate a procedure that wraps the PAL function
2. Call the procedure, for example, from a SQLScript procedure.
http://saphanatutorial.com/what-is-predictive-analysis/
http://saphanatutorial.com/sap-hana-predictive-analysis-library-pal/
http://saphanatutorial.com/how-to-work-with-hana-pal-library/
http://saphanatutorial.com/run-abc-analysis-using-hana-pal-part-1/
total amount of customer - 100
remaining amount of customer - 50
remaining amount of customer after due date - 20
% remaining amount of customer - 50%
% of amount remaining after Due Date of customer -
% of total remaining amount(20/Total of remaining amount of all customer)(can use to identify risk base
customer)
1. Generate a PAL Procedure
In this step, we need to do following things
Each row contains only one parameter value, either integer, double or string.
After generating a PAL procedure, any user that has the AFL__SYS_AFL_AFLPAL_EXECUTE or
AFL__SYS_AFL_AFLPAL_EXECUTE_WITH_GRANT_OPTION role can call the procedure, using the
syntax below.
CREATE SEQUENCE mySequence START WITH 1000 INCREMENT BY 1;
SELECT mySequence.NEXTVAL FROM DUMMY;
SAP LUMIRa
https://www.guru99.com/sap-hana-reporting.html#4
BW ON HANA
DataStore Object
DataStore Object (DSO) is known as a storage place to keep cleansed and consolidated
transaction or master data at lowest granularity level. This data can be analyzed using BEx
query.
DSO Architecture
DSO component consists of three tables −
Activation Queue
This is used to store the data before it is activated. The key contains request id, package id,
and record number. Once activation is complete, the request is deleted from the activation
queue.
Active Data Table
This table is used to store the current active data and it contains the semantic key defined
for data modeling.
Change Log
When you activate the object, changes to active data are stored in the change log. Change
log is a PSA table and is maintained in Administration Workbench under PSA tree.
InfoCube
InfoCube is defined as a multidimensional dataset, which is used for analysis in a BEx query.
An InfoCube consists of a set of relational tables which are logically joined to implement star
schema.
Composite Providers
Composite Providers are used to combine multiple InfoProviders using Join or Union
operations. When you use SAP BW on HANA, one of the InfoProvider should use in-memory
database and the data in composite providers can be used for reporting and analysis.
DSO: Data is stored in 2-dimensional format like a regular table.
Cube data is stored as star schema (multi dimensional data)
Cube is used mainly used for analytical reports. DSO is used for operational reports.
DSO has the overwrite capability.
Infocube data will get appended.
DSO gives detailed data, Infocube gives aggregated information
DSO can be used as a datastage and of data consolidation
DSO
1 flat file format structure
2 two dimensional
3 overwrite data functionality
4 performance is less as compared to cube
5 detailed form of data
infocube
1 star schema
2 16 dimentional
3 additive data functionality
4 performance is better as compared to DSO
5 summerised form of data