tzh300_en_col96

365
SAP HANA Implementation and Modeling TZH300 Implementation and Modeling Collection 096 Rev 14 V1

Upload: sharib-tasneem

Post on 09-Aug-2015

43 views

Category:

Software


0 download

TRANSCRIPT

SAP HANA Implementation pand ModelingTZH300 Implementation and Modelingp g

Collection 096 Rev 14 V1

Agendag

SAP HANA Implementation and Modeling• Unit 1: Data Provisioning using SLT• Unit 2: Approaching SAP HANA ModelingUnit 2: Approaching SAP HANA Modeling• Unit 3: Connecting Tables• Unit 4: Advanced Modeling• Unit 5: Processing Information Models• Unit 6: Managing Modeling Content• Unit 7: Security and Authorizations• Unit 7: Security and Authorizations

© 2012 SAP AG. All rights reserved. 2

Positioning and Key Concepts

Unit 1: Data Provisioning using SLT

Data Replication at a GlanceOverview on Configuration Aspects

SLT based transformation concepts

Transformation of Data

SLT based transformation conceptsSelective Data Replication

Extension of (target) table structure

Specific Considerations

ObjectivesPositioning and Key ConceptsPositioning and Key Concepts

At the end of this Lesson you will be able to:At the end of this Lesson you will be able to:

• Explain the positioning of SAP LT Replication ServerServer

• Describe the key concepts and features• List the prerequisites and how to set up the

SAP LT Replication Server• Name the benefits of the trigger-based replication

approach

© 2012 SAP AG. All rights reserved. 4

OverviewPositioning and Key ConceptsPositioning and Key Concepts

This module covers the following topics:This module covers the following topics:

• Product name, positioning and key benefitsC i l t d ft hi t• Commercial aspects and software shipment

• Overview on key concepts, features and user interfaces• Overview on key installation and configuration stepsy g p

© 2012 SAP AG. All rights reserved. 5

Product Name

SAP LandscapeSAP LandscapeTransformationTransformation

Replication Server pfor SAP HANA

© 2012 SAP AG. All rights reserved. 6

SAP LT Replication Server for SAP HANA Leverages Proven SLO TechnologiesProven SLO Technologies

Application Lifecycle ManagementSLO* t h l i h b d Application Lifecycle Management SLO* technologies have been used

since more than 10 years in hundred of projects per year

K ff i f t SAP‘ Key offerings foster SAP‘s Application Lifecycle Management concept

SAP LT R li ti S SAP LT Replication Server - as a new use case - leverages several SLO technologies

© 2012 SAP AG. All rights reserved. 7

*) System Landscape Optimization

Positioning and Key Benefits of SAP LT Replication Server for SAP HANAfor SAP HANA

Key Benefits of the Trigger-Based Approach:• Allows real-time (and scheduled) data replication, replicating only

relevant data into HANA• Ability to migrate data into HANA format while replicating data in real-

time• „Unlimited“ release coverage (from SAP R/3 4.6C onwards) sourcing

data from SAP ERP (and other ABAP based SAP applications)• Leverages proven SLO technology (Near Zero Downtime, TDMS, SAP

LT)• Simple and fast set-up of LT replicator (initial installation and

fi ti i l th 1d ) d f ll i t t d ith HANA d lconfiguration in less than 1day) and fully integrated with HANA modeler UI

SAP LT Replication Server is the ideal solution for all HANA customers who need real-time or scheduled data replication

© 2012 SAP AG. All rights reserved. 8

sourcing from SAP and NON-SAP sources

Commercial Aspects and Software Shipmentp p

Commercial AspectsSAP LT Replication Server for SAP HANA will be part of SAP HANA software license modelpart of SAP HANA software license model

Software ShipmentSoftware Shipment SAP LT Replication Server for SAP HANA will be part of SAP HANA software shipment and fully integrated into the SAP HANA modeler UIintegrated into the SAP HANA modeler UI

© 2012 SAP AG. All rights reserved. 9

Overview - Trigger-Based Approach Positioning and Key ConceptsPositioning and Key Concepts

SAP LT Replication Server does not have to be a separate SAP system and can run on any SAP system with SAPSAP system and can run on any SAP system with SAP 

NetWeaver 7.02 ABAP stack (Kernel 7.20EXT)  

HANA Studio

Application Table

Trigger BasedDelta Recording

Replication Engine

RFCConnection

DBConnection

Replication Configuration

SAP HANA systemSAP source system SAP LT Replication Server

Application Table

yy p

Connection(s) between source system and SAP HANA system are defined as “Configuration” on the SAP LT Replication Server

Data load and replication are triggered via SAP HANA Studio

© 2012 SAP AG. All rights reserved. 10

Architecture and Key Building BlocksPositioning and Key ConceptsPositioning and Key Concepts

Read module Structure mapping & Transformation

RFCConnection

Application table Logging table

DB trigger

Application table

Write module DBConnection

SAP HANA systemSAP LT Replication ServerSAP source system

Efficient initialization of data replication based on DB trigger

Flexible and reliable replication process, incl. data migration

Fast data replication via DB connectLT replication functionality is fully

© 2012 SAP AG. All rights reserved. 11

and delta logging concept(as with NearZero downtime approach)

process, incl. data migration (as used for TDMS and SAP LT)

LT replication functionality is fully integrated with HANA Modeler UI

Architecture for Non-SAP Source Replication Positioning and Key ConceptsPositioning and Key Concepts

Read module

Structure mapping & T f ti

DBConnection

Application table Logging table

DB trigger

Transformation

Application table

Write moduleDB

Connection

SAP HANA systemSAP LT Replication ServerNon SAP source system

In a first step, SAP LT Replication Server transfers all metadata table definitions from the non-SAPsource system to the HANA system. From the HANA Studio perspective, non-SAP source replicationworks as for SAP sources. When a table replication is started, SAP LT Replication Server createslogging tables within the source system. As a difference, the read modules are created in the SAP LT

© 2012 SAP AG. All rights reserved. 12

logging tables within the source system. As a difference, the read modules are created in the SAP LTReplication Server. The connection the non-SAP source system is established as a database connection.

Multi System Support Positioning and Key ConceptsPositioning and Key Concepts

System A

System B

Schema 1Schema 2

Source systems are connected to separate HANA schema on the same HANA System

SAP HANA systemSource systemsy

Source systems are

SAP HANA tS t

System A

System B

Schema 1

Schema 1

Source systems are connected to separate

HANA systems. Schema name can be

equal or differentSAP HANA systemSource systems equal or different

Source systems are

SAP HANA systemSource systems

System A

System BSchema 1

Source systems are connected to same HANA system and

also the same schema

© 2012 SAP AG. All rights reserved. 13

SAP HANA systemSource systems schema

Set-up of LT Replication Server Positioning and Key ConceptsPositioning and Key Concepts

Installation aspectsSource system(s): use respective DMIS add-on LT replication server: use add-on DMIS_2010_1_700 with SP05;

other system requirements (NW 7.02; SAP Kernel 7.20EXT) apply Apply SPS03 for SAP HANA 1 0

Configuration steps for SAP LT Replication Server

Apply SPS03 for SAP HANA 1.0

Define a schema for each source system Define connection to source systemDefine DB connection into SAP HANA Define replication frequency (real-time; frequency for scheduled replication)Define maximum number of background jobs for data replication

Set-up of data replication in SAP HANASelect relevant source system Start (initial load only and / or continuous replication)

© 2012 SAP AG. All rights reserved. 14

Key Configuration StepsPositioning and Key ConceptsPositioning and Key Concepts

Call SAP LT Replication Server Configuration (Transaction: LTR)

Define configuration data

© 2012 SAP AG. All rights reserved. 15

Starting the Data ReplicationPositioning and Key ConceptsPositioning and Key Concepts

Choose data provisioning to launch SAP HANA Modeler UI

1. 1. Select source system as defined in SAP1. 1. Select source system as defined in SAP LT Replication Server; related system information and schema will be displayed

2. 2. Use button Load and / or Replicate to set th d t li tiup the data replication

3. 3. Use button Stop Replication to finish replication

4 U b tt S d t li ti4. 4. Use button Suspend to pause replication

5. 5. Use button Resume to continue replication

© 2012 SAP AG. All rights reserved. 16

Database - Supportability Matrix SAP LT Replication Server for SAP HANASAP LT Replication Server for SAP HANA

D t bTechnical availability

Database SAP Sources Non SAP Sources (*)

MSFT SQL Server Enterprise Edition OK OK

Oracle Enterprise Edition OK OK

IBM DB2 LUW/ UDB (DB6) OK OK

IBM DB/2 zSeries OK OK

IBM DB2 iSeries (former AS/400) OK Not yet supported

IBM Informix Planned for HANA SPS4 Not supportedo pp

SAP MaxDB OK OK

Sybase ASE Available until End of January 2012 Planned for HANA SPS4

For non-SAP source systems, the customer database license needs to cover a permanent database connection with 3rd party products like SAP LT Replication Server.

© 2012 SAP AG. All rights reserved. 17

(*) Since a DB connection from SAP LT replication server to a non-SAP system is required, the OS/DB restrictions of SAP NetWeaver 7.02 apply (see at http://service.sap.com/pam)

Roadmap at a GlanceSAP LT Replication ServerSAP LT Replication Server

• Several conceptual enhancements in alignment with SAP HANA development

• Replication of tables into multiple HANA systems

• User experience and usability • More integrated monitoring capabilities, e.g.

status and replication logs in SAP HANA andstatus and replication logs in SAP HANA and SAP Solution Manager

• Improved operations aspects R li ti it• Replication repository

• Transactional integrity

© 2012 SAP AG. All rights reserved. 18

SummaryPositioning and Key ConceptsPositioning and Key Concepts

You should now be able to:You should now be able to:

• Explain the positioning of SAP LT Replication ServerServer

• Describe the key concepts and features• List the prerequisites and how to set up the

SAP LT Replication Server• Name the benefits of the trigger-based replication

approach

© 2012 SAP AG. All rights reserved. 19

Positioning and Key Concepts

Unit 1: Data Provisioning using SLT

Data Replication at a GlanceOverview on Configuration Aspects

SLT based transformation concepts

Transformation of Data

SLT based transformation conceptsSelective Data Replication

Extension of (target) table structure

Specific Considerations

ObjectivesOverview on configuration aspectsOverview on configuration aspects

At the end of this Lesson you will be able to:At the end of this Lesson you will be able to:

• Describe the set-up of a configuration on the SAP LT Replication ServerSAP LT Replication Server

• Explain the impact of the configuration set-up on the data replication

© 2012 SAP AG. All rights reserved. 21

Concept: Define Configuration / SchemaOverview on configuration aspectsOverview on configuration aspects

Schema 1

Trigger-baseddelta recording

Replication engine

RFCConnection

Replication Configuration

DBConnection

SAP HANA systemSAP source system SAP LT Replication Server yy p

A new configuration can be created in the LT Configuration and Monitoring Dashboard. In that step, the connection between the source and the HANA system is established and the target schema will be created (if it doesn’t exist already). Also replication control tables are created and table lists are replicated from the source system. In addition, the required

l d GRANT / REVOKE d d

© 2012 SAP AG. All rights reserved. 22

roles and GRANT / REVOKE procedures are generated.

Creating a New Configuration for SAP Sources Overview on configuration aspectsOverview on configuration aspects

General DataD fi th li ti t t S h N i th HANADefine the replication target Schema Name in the HANA

system (if schema does not exist, it will be created automatically)

Define the Number of Replay Jobs used for data load and replicationand replication

Connection to the source systemSAP Source System: Use previously defined RFC

destination to source systemyNon SAP Source System: Select the source database

system and set the required fields (see also next slides)

Connection to HANA systemy•Define the User Name and Password which can be used to connect to the HANA system (see also next slide)•Define the Host Name and Instance Number of the target HANA system

Table space assignmentp gOptional: define table space for logging tables. If no table space is defined, logging table will be created in the same table space

as the original table. Own table space is recommended for easier monitoring of the table sizes of the logging tables

Replication Mode

© 2012 SAP AG. All rights reserved. 23

pReplication can be executed in Real-time mode or in Scheduled mode

Creating a New Configuration for Non-SAP Sources Overview on configuration aspects

To replicate from non-SAP source system select Legacy and the affected database systemaffected database system.

Depending on the database system, dditi l i d i f ti dadditional required information needs

to be specified (e.g. for DB2 specify the DB connection and the table space name).

© 2012 SAP AG. All rights reserved. 24

space name).

Start with transaction LTR

Results of Creating a New Configuration Overview on configuration aspectsOverview on configuration aspects

When the popup to create a new configuration is closed by pressing the OK button the following actions are performedpressing the OK button, the following actions are performed automatically: Configuration settings are saved on the LT Replication Server

New user and schema are created on the HANA system with the defined t t h ( t f d if i ti h i d)target schema name (not performed if an existing schema is reused)

Replication control tables (RS_* tables) are created in target schema

User roles for the target schema are created: <target_schema>_DATA_PROV -> Role to manage data provisioning <target_schema>_POWER_USER -> Contains all SQL privileges of the target

schema <target_schema>_USER_ADMIN -> Role to execute authority procedures (see

below)

A procedure to grant (RS GRANT ACCESS) or revoke A procedure to grant (RS_GRANT_ACCESS) or revoke (RS_REVOKE_ACCESS) are created in the target schema

Replication of tables DD02L (stores the table list) and DD02T (stores the table short descriptions) is started automatically. Once those tables are replicated , the HANA studio knows which tables are available in the source p ,system

SYS_REPL and table RS_REPLICATION_COMPONENTS are created(if they don’t exist already based on a previous configuration)

Replication is registered in table RS REPLICATION COMPONENTS

© 2012 SAP AG. All rights reserved. 25

Replication is registered in table RS_REPLICATION_COMPONENTS

SummaryOverview on configuration aspectsOverview on configuration aspects

You should now be able to:You should now be able to:

• Describe the set-up of a configuration on the SAP LT Replication ServerSAP LT Replication Server

• Explain the impact of the configuration set-up on the data replication

© 2012 SAP AG. All rights reserved. 26

Positioning and Key Concepts

Unit 1: Data Provisioning using SLT

Data Replication at a GlanceOverview on Configuration Aspects

SLT based transformation concepts

Transformation of Data

SLT based transformation conceptsSelective Data Replication

Extension of (target) table structure

Specific Considerations

ObjectivesData Replication at a GlanceData Replication at a Glance

At the end of this Lesson you will be able to:At the end of this Lesson you will be able to:

• Explain the different option for data replication and the related implicationsrelated implications

© 2012 SAP AG. All rights reserved. 28

OverviewData provisioning at a glanceData provisioning at a glance

This module covers the following topics:This module covers the following topics:

• Load and replicate data

• Suspend and resume data replication

• Status monitoring in HANA Studio

© 2012 SAP AG. All rights reserved. 29

Launch Data Provisioning UI Data provisioning at a glanceData provisioning at a glance

All further data provisioning steps t d f th HANAare executed from the HANA

Studio. Therefore, switch to the HANA Studio, choose the perspective Information Modelerp pand start the quick launch.

Select your system and start the Data Provisioning via the link in gsection DATA.

If you cannot enter this screen or do not see any data, verify if a data provisioning role was assigned to

© 2012 SAP AG. All rights reserved. 30

your user.

Start Load / Replication Data provisioning at a glanceData provisioning at a glance

Press the respective button to Replication includes load and delta replication

Load the current data of a table from the source system

Replicate a table includes the load of the current data and the replication of all changesin the source system

and delta replication

Choose a table from the list or enter a search string to search for a specific table.

Use the button AddUse the button Addto select the table.

Once all relevant tables are selected, load / replication is triggered when popup is closed via button Finish.

© 2012 SAP AG. All rights reserved. 31

Start Load/Replication - Executed ActivitiesData provisioning at a glanceData provisioning at a glance

Read module Structure mapping & transformation

RFCConnection

HANA Studio

Application Table Logging Table

DB Trigger

Application Table

Write module DBConnection

SAP HANA systemSAP LT Replication ServerSAP source system

Data provisioning can be managed via the HANA Studio modeler view using the data provisioning. If a table is started for load or replication, the LT runtime objects (reader, mapping and transformation and writer modules) are generated in the respective systems. If tables are selected for replication, also the

© 2012 SAP AG. All rights reserved. 32

delta recording (logging table and DB trigger) is activated on the source system.

Stop / Suspend ReplicationData provisioning at a glanceData provisioning at a glance

Press the respective button toStop the replication and also to stop delta recording for that table (deletes DB trigger!)

Suspend data replication but keep delta recording active

Resume a previously suspended data replicationp y p p

The table selection popup will look similar as for Load and Replication. In case of Stop Replication or Suspend, only those tables can be selected which are already in replication mode. In case of Resume only those tables can be selected which are in suspend mode.

Please be aware that in case a replication is stopped and started again, the corresponding table will be dropped. The initial load must be repeated as delta recording was deactivated for a certain time and changes might not be recorded.So in case you only want to pause the delta replication use the mode Suspend andSo in case you only want to pause the delta replication, use the mode Suspend and Resume as delta recording is not deactivated and the replication can be continued without a need of a new initial data load.

© 2012 SAP AG. All rights reserved. 33

Stop/Suspend Replication - Executed Activities Data provisioning at a glanceData provisioning at a glance

Stop data replication

Delete trigger & Log. tab.Application Table Logging Table

DB Trigger Application table

Stop replicationSAP HANA systemSAP LT Replication ServerSAP source system

Stop data replicationApplication table Logging table

DB TriggerApplication table

Suspend replicationSAP HANA systemSAP LT Replication ServerSAP source system

SAP HANA systemSAP LT Replication ServerSAP source system

Continue data replicationApplication table Logging table

DB TriggerApplication table

© 2012 SAP AG. All rights reserved. 34

Resume replicationSAP HANA systemSAP LT Replication ServerSAP source system

Status Monitoring in HANA Studio Data provisioning at a glanceData provisioning at a glance

The load / replication status can be monitored in the Data Load Managementithi th d t i i i t l I thi ti th t t t f llscreen within the data provisioning tool. In this section, the current status of all

relevant tables of the selected source system / target schema is displayed.

© 2012 SAP AG. All rights reserved. 35

SummaryData provisioning at a glanceData provisioning at a glance

You should now be able to:You should now be able to:

• Explain the different option for data replication and the related implicationsreplication and the related implications

© 2012 SAP AG. All rights reserved. 36

Positioning and Key Concepts

Unit 1: Data Provisioning using SLT

Data Replication at a GlanceOverview on Configuration Aspects

SLT based transformation concepts

Transformation of Data

SLT based transformation conceptsSelective Data Replication

Extension of (target) table structure

Specific Considerations

ObjectivesSLT based transformation conceptsSLT based transformation concepts

At the end of this Lesson you will be able to:At the end of this Lesson you will be able to:

• Explain the basics of the SLT based transformation conceptsconcepts

• Leverage the data processing and transformation process• Explain which tables and fields has to be specify for a

transformation rule

© 2012 SAP AG. All rights reserved. 38

OverviewSLT based transformation conceptsSLT based transformation concepts

This module covers the following topics:This module covers the following topics:

• Details on the basic concept of SLT based transformationO f f f• Overview on key tables and field to be specified for a transformation

• Naming conventions to be used for a transformation rule• Trigger conditions in detail

© 2012 SAP AG. All rights reserved. 39

ConceptSLT based transformation conceptsSLT based transformation concepts

The main purpose of SAP HANA is reporting data of particular ERP content. Generally this will be done with an one-to-one replication of ERP table into the new database.

Depending on the customer-specific requirement, it’s sometimes necessary to filter, to change, or to extend the original data within the load process into HANA.

Key Use Cases:y

• Conversion Change data and/or table-structure within datag

replication/loading• Filtering

Reduce number of records to be replicated

© 2012 SAP AG. All rights reserved. 40

ConceptSLT based transformation conceptsSLT based transformation concepts

Currently, transformation & filtering topics are only provided by project base.

(Only for SAP lead projects)

© 2012 SAP AG. All rights reserved. 41

Concept - Data ProcessingSLT based transformation conceptsSLT based transformation concepts

Start of Replication CycleGet next portion from source

12

RFCConnection

…Loop through portion

43

Map fields of a record to sender structure

DBConnection

S t SAP LT R li ti S

Data Portions

5 Add record to sender portion

SAP HANA t

Data Portions

Source system SAP LT Replication Server SAP HANA system

The data for transformation will be split into portions (default: load: 10,000 lines, replication: 5,000 lines)

The portions will be processed successively, mapped, and transferred to sender

Extension of functionality (for example data conversion) is possible at several points of the process using ABAP includes Transformation rules

© 2012 SAP AG. All rights reserved. 42

Implementation of these rules by maintaining table IUUC_ASS_RUL_MAP of the LT Replication Server

Implementation of Rules within Transformation Process SLT based transformation conceptsProcess SLT based transformation concepts

Steps of implementation:p p

1. Create ABAP include containing the coding to change fields Usage of naming convention for parameter and table fields to

h d t t b li t dchange data to be replicated

2. Maintain table IUUC_ASS_RUL_MAP to use the defined rule Generally there are two types of transformations rules Generally, there are two types of transformations rules

Event-based rulesMore flexible than parameter-based rules

Knowledge of data processing within the SAP LT Replication Server needed to select the right event for the specific business scenario

Parameter-based rulesLess flexible than event-based rules

Easy to create by using parameters

© 2012 SAP AG. All rights reserved. 43

Fields of IUUC_ASS_RUL_MAPSLT based transformation conceptsSLT based transformation concepts

Fields of table IUUC_ASS_RUL_MAP (residing on SAP LT Replication Server)

MT_ID The scheme name has a corresponding mass transfer ID. Enter “SAP” if you want to create a template for all mass transfer IDs created in future or enter an existing mass transfer ID if you want to restrict the settings to a specific mass transfer.To get the MT_ID for your schema name (=”Mass transfer XXX”), use Transaction: LTR

TABNAME Name of the table of sender system

BASISVERSION Enter the Basis Release of Source System (for example: 620, 700, … ). You can obtain it from: S t St t Cli k ‘C t I f ti ’ SAP BASIS l )System Status Click on ‘Component Information’ SAP_BASIS release). For non-Sap sources, use the SAP_BASIS release of the SLT system.

EVENT (not used for parameter rules)Enter event (BOP, BOT etc.) for event-based rule.

FIELDNAME (not used for event-based rules)Enter the name of the receiver field the mapping rule should be assigned to

IMP_PARAM_1..3 (not used for event-based rules)Use those columns to define the import parameters you need. You can either set a sender field p p yname into this column or a literal (use quotes for literals, for example, ‘1000’)If no parameter has to be used within the rule, IMP_PARAM_1 has to be set to ‘DUMMY’!

INCLUDE Name of the include containing the mapping rule. Name can be defined individually. Recommended naming convention: ZIUUC_<tab_name>_<fieldname> (that is,

© 2012 SAP AG. All rights reserved. 44

ZIUUC_DD03L_AS4LOL)

Event-Based RulesSLT based transformation conceptsSLT based transformation conceptsStart Load / Replication

BOP – Begin of Processing

BOP (Begin of Processing):

Processed only once, before the data transfer really starts. BOP – Begin of Processing

DO

Get next portion from source system

BOT – Begin of Block

y , y

Can be used to initialize certain global fields that might be used in subsequent events (for example, fill internal mapping tables)

EOP (End of Processing):

Processed only once after the data transfer is completedBOT Begin of Block

LOOP AT source

BOL – Begin of Loop

MOVE-CORRESPONDING

Processed only once, after the data transfer is completed.

BOT (Begin of Block):

Access to all data records of a portion read from the sender system

EOT (End of Block):

source TO target

BOR – Begin of Record

individual field mapping

Access to all data records immediately before they are passed to the receiver system

BOL (Begin of Loop):

Like BOT if only one table is included in the conversion object; in case of objects f

EOR – End of Record

EOL – End of Loop

ENDLOOP

with multiple tables, it can be applied to each specific table

EOL (End of Loop):

Like EOT if only one table is included in the conversion object; in case of objects with multiple tables, it can be applied to each specific table

Write to target system

EOT – End of Block

ENDDO

BOR (Begin of Record):

This event is processed before the field mapping of the individual fields is started.

EOR (End of Record):

This event is processed after the field mapping of the individual fields of a certain

© 2012 SAP AG. All rights reserved. 45

EOP – End of processingp pp g

data record has finished.

Parameters and Field Variables within Includes SLT based transformation conceptsSLT based transformation concepts

Parameter Rules:Sender (source) field:Sender (source) field:

Defined as import parameters in table IUUC_ASS_RUL_MAP fields IMP_PARAM_1/2/3 Addressed in the include using the following name:

IMP_PARAM_1: i_<fieldname>_1 (for example, i_mandt_1)IMP PARAM 2: i <fieldname> 2IMP_PARAM_2: i_<fieldname>_2 IMP_PARAM_3: i_<fieldname>_3

If you have defined a literal the technical name will be:IMP_PARAM_1: i_p1IMP PARAM 2 i 2IMP_PARAM_2: i_p2IMP_PARAM_3: i_p3

Receiver (target) field:Defined in table IUUC_ASS_RUL_MAP field FIELDNAME Add d i h i l d i h f ll i

SKIP_RECORD can be used in the code

Addressed in the include using the following name:

e_<fieldname> (for example, e_mandt).

Event based Rules and Parameter RulesFields can be directly addressed using field symbols (event BOL and EOL only)

Sender (source) field of the table: <wa_s_(tab_name)>-<field> (for example, <wa_s_mara>-mandt)

Receiver (target) field of the table:

© 2012 SAP AG. All rights reserved. 46

( g )

<wa_r_(tab_name)>-<field> (for example, <wa_r_mara>-mandt)

Define the Trigger ConditionSLT based transformation conceptsSLT based transformation concepts

Trigger condition has to be defined in the table IUUC_SPC_PROCOPT. Based on the database of the source system, different syntaxes are adapted.

Field ActionField ActionMT_ID If you want to create a template for all mass transfer IDs created in future, enter

“SAP” or enter an existing mass transfer ID if you want to restrict the settings to a specific mass transfer.

TABNAME Enter the name of the table in the sender system here.yDBSYS Enter the database type of the source system.LINE_NO You can specify multiple lines if the condition is too complex to be filled in only one

line.LINE Enter the trigger condition here. Only when the data change fulfills the condition , it gg y g

will be recorded into the logging table for the SLT replication.

DBSYS Syntax SampleADABAS D fi ld1 ' l 0' AND fi ld2 IN ( ' l 1' ' l 2' ) AS4LOCAL 'N'ADABAS D field1 = 'value0' AND field2 IN ( 'value1', 'value2' ) AS4LOCAL = 'N'DB2 ___."field1" = 'value0' AND ___."field2" IN ( 'value1', 'value2' ) ___."AS4LOCAL" = 'N'DB6 ___.field1 = 'value0' AND ___.field2 IN ( 'value1', 'value2' ) ___.AS4LOCAL = 'N'MSSQL field1 = 'value0' AND field2 IN ( 'value1', 'value2' ) AS4LOCAL = 'N'

© 2012 SAP AG. All rights reserved. 47

ORACLE :___.field1 = 'value0' AND :___.field2 IN ( 'value1', 'value2' ) :___. AS4LOCAL = 'N'

Define the Trigger ConditionSLT based transformation conceptsSLT based transformation concepts

In this example, we want to customize the trigger directly in the source system in a way that only changes to the data with AS4LOCAL = ‘N’ will be

d drecorded.

© 2012 SAP AG. All rights reserved. 48

Define the Trigger ConditionSLT based transformation conceptsSLT based transformation concepts

Another example, filtering will be done based on Company Code (BUKRS field). Only company codes with the value ‘1000’ will be replicated to the HANA tHANA system

Please note: trigger filtering will only work for replication phase. If it is required to filter the table during the initial load phase, an additional event (or parameter) filter is also necessary!

© 2012 SAP AG. All rights reserved. 49

SummarySLT based transformation conceptsSLT based transformation concepts

You should now be able to:You should now be able to:

• Explain the basics of the SLT based transformation concepts

• Leverage the data processing and transformation process

• Explain which tables and fields has to be specify for a transformation ruletransformation rule

© 2012 SAP AG. All rights reserved. 50

Positioning and Key Concepts

Unit 1: Data Provisioning using SLT

Data Replication at a GlanceOverview on Configuration Aspects

SLT based transformation concepts

Transformation of Data

SLT based transformation conceptsSelective Data Replication

Extension of (target) table structure

Specific Considerations

ObjectivesSelective data replicationSelective data replication

At the end of this Lesson you will be able to:At the end of this Lesson you will be able to:

• Explain the benefit of filtering

• Explain the concept of filtering within SLT

• Specify your own filtering rule

© 2012 SAP AG. All rights reserved. 52

Business Example Selective data replication / filteringSelective data replication / filtering

Reduce Number of Records to Be Replicated by Filter

DBRFC

Reduce Number of Records to Be Replicated by Filter

ConnectionConnection

SAP HANA systemSAP LT Replication ServerSource system SAP HANA systemSAP LT Replication ServerSource system

ImplementationScenarios Implementation• Either by trigger adjustment in source system or by

rules (event-based or parameter-based)

Scenarios Replicating certain data only

Only data of specific years should be used in HANA,for instance

© 2012 SAP AG. All rights reserved. 53

for instanceReplication of data active tables as they are in DDIC tables DD02l, DD03l etc.

OverviewSelective data replicationSelective data replication

This module covers the following topics:This module covers the following topics:

• The concept of filtering data for replication

D il d l f diff fil i• Detailed examples of different filtering use cases

• Examples for parameter and event-based rules

© 2012 SAP AG. All rights reserved. 54

Concept - FilteringSelective data replicationSelective data replication

Conditional filter (in SLT) by parameter-based or event-based rules To skip a record from load and replication macro SKIP_RECORD can be used in the code of the include.

In fact, all data (means not filtered data) will be transferred from the source system to SAP LT Replication Server but not forwarded to HANAReplication Server, but not forwarded to HANA means SLT system will read all data from the source and write only relevant data into HANA.

No database-specific knowledge neededValid for both initial load and replicationp

Selected delta replication (“Trigger Adjustments”)Done by trigger adjustment directly of data base of the source systemWill be implemented using table IUUC_SPC_PROCOPT.

For experts onlyDatabase specificDatabase-specificWill be implemented in source systemDecreases the total amount of data to be extracted from source systemPerformance advantages because of reduction of triggered and transferred data

© 2012 SAP AG. All rights reserved. 55

Only valid for replication data; it is not working for initial load.

Example: Filtering by Company Code Selective data replicationdata replication

Realized with a event-based rule

RESULT: Only records where MJAHR(Fi lY ) 1998‘MJAHR(FiscalYear ) = ‚1998‘ were transferred to HANA:

© 2012 SAP AG. All rights reserved. 56

Example: Filtering by Fiscal Year Selective data replicationreplication

Realized with a t lparameter rule

RESULT: Only records where MANDT = ‚800‘ and BUKRS = ‚3000‘ were transferred to HANA:

© 2012 SAP AG. All rights reserved. 57

Example: Filter by Event-Based Rule (1) Selective data replicationreplication

Task: Filter and only load/replicate data with AS4LOCAL = ‘N’.

© 2012 SAP AG. All rights reserved. 58

Example: Filter by Event-Based Rule (2) Selective data replicationreplication

For an event-based rule, “FIELDNAME” in table IUUC_ASS_RUL_MAP must be left blank In addition you do not need to specify the import parametersblank. In addition, you do not need to specify the import parameters.

© 2012 SAP AG. All rights reserved. 59

SummarySelective data replication / filteringSelective data replication / filtering

You should now be able to:You should now be able to:

• Explain the benefit of filtering

• Explain the concept of filtering within SLT

• Specify your own filtering rule

© 2012 SAP AG. All rights reserved. 60

Positioning and Key Concepts

Unit 1: Data Provisioning using SLT

Data Replication at a GlanceOverview on Configuration Aspects

SLT based transformation concepts

Transformation of Data

SLT based transformation conceptsSelective Data Replication

Extension of (target) table structure

Specific Considerations

ObjectivesTransformation of dataTransformation of data

At the end of this Lesson you will be able to:At the end of this Lesson you will be able to:

• Describe the benefit of the transformation of fields

• Explain the concept of transforming data within SLT

• Specify your own transformation rule

© 2012 SAP AG. All rights reserved. 62

Business ExampleTransformation dataTransformation data

Reduce Number of Records to Be Replicated by Filterp y

DBConnection

RFCConnection ConnectionConnection

SAP HANA SystemLT Replication ServerSource System

Transformation of Data

Scenarios Implementation1. Create ABAP includes to define transformation rules

2. Maintain table IUUC_ASS_RUL_MAP

Scenarios To make certain fields anonymous HR reporting

To fill initial fields

To con ert nits or c rrenc and recalc late amo nts

© 2012 SAP AG. All rights reserved. 63

3. Start data load / replication from HANA Studio To convert units or currency and recalculate amounts and values

OverviewTransformation of dataTransformation of data

This module covers the following topics:This module covers the following topics:

• The concept of transforming data for replication

D il d l f diff i h f i• Detailed examples of different use cases with transformation needs

• Examples for parameter and event-based rules p p

© 2012 SAP AG. All rights reserved. 64

Example: Make Certain Fields Anonymous (1)Transformation of dataTransformation of data

Scenario: Within the example, the field ‘name’ of a table should be filled by ‘xxxx’. This could be

done by parameter rules or event-based rules. Since each table of a sender system can only be replicated into one target table of

HANA, two identical tables in the source system were created to show the usage of both kind of rules

Include of parameter rules: Z_Ex_1_PAR Incl de of e ent based r les Z E 1 EVENTInclude of event-based rules Z_Ex_1_EVENT

1.PARTNR MATNR NAME AMOUNT CURRENCY DATE0000000001 1000Mr. ABC 100USD 201002010000000001 2000Mr. ABC 200USD 201102010000000002 1000Mr. XYZ 100USD 20110201

PARTNR MATNR NAME AMOUNT CURRENCY DATE0000000001 1000XXXX 100USD 201002010000000001 2000XXXX 200USD 201102010000000002 1000XXXX 100USD 20110201

SAP HANA SystemSource System

0000000002 2000Mr. XYZ 200USD 201103010000000002 3000Mr. XYZ 300 EUR 20100301

0000000002 1000XXXX 100USD 201102010000000002 2000XXXX 200USD 201103010000000002 3000XXXX 300EUR 20100301

© 2012 SAP AG. All rights reserved. 65

SAP HANA SystemSource System

Example: Make Certain Fields Anonymous (2) Transformation of dataTransformation of data

Define Include for Event-Based Rule

Create include by T-Code SE38Enter program name and press Create

Popup:Enter title

Choose type INCLUDE Program

Choose status Test Program

© 2012 SAP AG. All rights reserved. 66

Example: Make Certain Fields Anonymous (3) Transformation dataTransformation data

Event-based rule:

© 2012 SAP AG. All rights reserved. 67

Example: Make Certain Fields Anonymous (4) Transformation without changing table structure (scrambling of data)The according Parameter rule would be:

© 2012 SAP AG. All rights reserved. 68

Example: Make Certain Fields Anonymous (5) Transformation dataTransformation data

Resulting data in HANA:

Parameter rule:

Event-based rule:

© 2012 SAP AG. All rights reserved. 69

SummaryTransformation dataTransformation data

You should now be able to:You should now be able to:

• Describe the benefit of the transformation of fields

• Explain the concept of transforming data within SLT

• Specify your own transformation rule

© 2012 SAP AG. All rights reserved. 70

Positioning and Key Concepts

Unit 1: Data Provisioning using SLT

Data Replication at a GlanceOverview on Configuration Aspects

SLT based transformation concepts

Transformation of Data

SLT based transformation conceptsSelective Data Replication

Extension of (target) table structureSpecific Considerations

ObjectivesExtension of (target) table structureExtension of (target) table structure

At the end of this Lesson you will be able to:At the end of this Lesson you will be able to:

• Describe the benefit of extending target table structures

• Explain the concept of extending a table

• Specify your own extended structures

© 2012 SAP AG. All rights reserved. 72

Business ExampleExtension of (target) table structureExtension of (target) table structure

Extension of Table Structures within Transformation

DBConnection

RFCConnection

SAP HANA systemSAP LT Replication ServerSource system

ScenariosT k t i fi ld HR ti

ImplementationD fi t bl f t t t t To make certain fields anonymous HR reporting

To fill initial fields or new fields of target table

To convert units or currency and recalculate amounts and values

1. Define tables of target structure

2. Maintain table IUUC_REPL_TABSTG

3. Create ABAP includes to define transformation rules

4 Maintain table IUUC ASS RUL MAP

© 2012 SAP AG. All rights reserved. 73

4. Maintain table IUUC_ASS_RUL_MAP

5. Start data load / replication from HANA Studio

OverviewExtension of (target) table structureExtension of (target) table structure

This module covers the following topics:This module covers the following topics:

• The concept of extending target table structures

D il d l f diff i h i d• Detailed examples of different use cases with extension needs

• Examples for parameter and event-based rules

© 2012 SAP AG. All rights reserved. 74

ConceptExtension of (target) table structureExtension of (target) table structure

Use case:

Due to the fact that the main purpose of HANA is reporting, it could be required that the data in HANA has to be enriched (that is, unified reporting currency) within the transformation from sender system to HANAwithin the transformation from sender system to HANA.

Prerequisites

• Definition of table strucure to be used in HANA by maintaining table IUUC_REPL_TABSTG

• Definition of rules to fill up the new tables fields done by event-based rules or parameter rules

© 2012 SAP AG. All rights reserved. 75

ConceptExtension of (target) table structureExtension of (target) table structure

Steps to extend the table structure:

1. Create table of required structure either in sender system or in SLT system acting as a template for HANA

M i t i t bl IUUC REPL TABSTG f th SAP LT R li ti S2. Maintain table IUUC_REPL_TABSTG of the SAP LT Replication Server:MT_ID same MT_ID like in IUUC_ASS_RUL_MAPTABNAME name of table in sender system to be replicatedTARGET TYPE name of table with structure to be used as template for tableTARGET_TYPE name of table with structure to be used as template for table

to be created in HANATARGET_TYPE_LCL ‘X’: table of target type was created in LT-Replication Server

‚ ‚ : table of target type was created in sender system TARGET NAME name of table to be created and used for replication in HANATARGET_NAME name of table to be created and used for replication in HANANO_DROP data in HANA will not be deleted before the replicationROW_STORE target table in HANA will be created as row table instead of column tableRD_PORTION_SIZE no of records per portion; empty means default value_ _ p p p y

© 2012 SAP AG. All rights reserved. 76

Example: Calculate Field of Extended Structure (1)Extension of (target) table structure and calculation of valuesScenario:Within the example the field ‘AMOUNT_IN_EUR’ of the extended table should be calculated by a fixed exchange rate from field amountThe name of table, which reflects the target type is ZIUUC_EX_2_TRGTBoth rules can be used to calculate the new amount

Include of parameter rules: Z_Ex_2_AMOUNT_IN_EUR_PAR Include of event-based rules Z_Ex_1_AMOUNT_IN_EUR_EVENT

PARTNR MATNR NAME AMOUNT CURRENCY DATE NAME AMOUNT CURRENCY Amount_in_EUR1.PARTNR MATNR NAME AMOUNT CURRENCY DATE0000000001 1000Mr. ABC 100USD 201002010000000001 2000Mr. ABC 200USD 201102010000000002 1000Mr. XYZ 100USD 201102010000000002 2000Mr. XYZ 200USD 20110301

Mr. ABC 100USD 150Mr. ABC 200USD 300Mr. XYZ 100USD 150Mr. XYZ 200USD 300

SAP HANA SystemSource System

0000000002 3000Mr. XYZ 300 EUR 20100301 Mr. XYZ 300 EUR 300

© 2012 SAP AG. All rights reserved. 77

Example: Calculate Field of Extended Structure (2)Extension of (target) table structureExtension of (target) table structure

Create table of target structure

Maintained table IUUC_REPL_TABSTG of LT Replication Server

© 2012 SAP AG. All rights reserved. 78

Example: Calculate Field of Extended Structure (3)Extension of (target) table structureExtension of (target) table structure

Event-based rule:

© 2012 SAP AG. All rights reserved. 79

Example: Calculate Field of Extended Structure (4)Extension of (target) table structureExtension of (target) table structure

Parameter rule

© 2012 SAP AG. All rights reserved. 80

Example: Calculate Field of Extended Structure (5)Extension of (target) table structureExtension of (target) table structure

Resulting data in HANA:

Parameter rule:Table ZIUUC_EX_2_PMOD

Event-based rule:T bl ZIUUC EX 2 EMODTable ZIUUC_EX_2_EMOD

© 2012 SAP AG. All rights reserved. 81

SummaryExtension of (target) table structureExtension of (target) table structure

You should now be able to:You should now be able to:

• Describe the benefit of extending target table structures

• Explain the concept of extending a table

• Specify your own extended structures

© 2012 SAP AG. All rights reserved. 82

Positioning and Key Concepts

Unit 1: Data Provisioning using SLT

Data Replication at a GlanceOverview on Configuration Aspects

SLT based transformation concepts

Transformation of Data

SLT based transformation conceptsSelective Data Replication

Extension of (target) table structure

Specific Considerations

Transformation Rules for Cluster TablesSpecific considerationsSpecific considerations

Apply SAP note 1662438 at first.

After implementing the note, you should follow the steps (table BSEG as an example): ( p )

1. For initial load, you should create one entry in IUUC_ASS_RUL_MAP for BSEG and include program for BSEG table

2. For replication, you should create an addition entry in IUUC_ASS_RUL_MAPfor RFBLG and include program for RFBLG table

© 2012 SAP AG. All rights reserved. 84

Date Field Format - Changes Specific considerationsSpecific considerations

Table Setting : IUUC_ASS_RUL_MAP

Include : ZIUUC_ZGRPA_THOC

Records in source table Replicated records in HANA table

© 2012 SAP AG. All rights reserved. 85

A di– Client Specific vs. Cross Client Load / ReplicationAppendix

– Type mapping from source system to HANA system– Mapping multiple sources into one target HANA DB schemapp g p g

Cli t S ifiClient Specific vs. Cross Client Load / ReplicationCross Client Load / Replication

ObjectivesClient Specific vs Cross Client Load / ReplicationClient Specific vs. Cross Client Load / Replication

At the end of this Lesson you will be able to:At the end of this Lesson you will be able to:

• Specify client specific or cross client load or replication for your business modelyour business model

© 2012 SAP AG. All rights reserved. 88

OverviewClient Specific vs Cross Client Load / ReplicationClient Specific vs. Cross Client Load / Replication

This module covers the following topics:This module covers the following topics:

• The client specific load / replication procedure

Th li t l d / li ti d• The cross client load / replication procedure

• The advantage of client specific load

© 2012 SAP AG. All rights reserved. 89

ConceptClient Specific vs Cross Client Load / Replication

Per default, the SAP LT Replication Server loads and replicates all data of the defined tables

Client Specific vs. Cross Client Load / Replication

and replicates all data of the defined tables.

Client specific tables are also loaded and replicated completely and not restricted to a certain client.

Data load can be restricted by define some filter rules (described in the following slides) or by activating the client specific load and replication.

Advantages of client specific load

• Trigger is restricted automatically to the relevant client

• Data load can be restricted to a smaller amount of data without manual defining filter rules

• If the first key field after the client field is selective enough to be used in an access plan calculationenough to be used in an access plan calculation, reading type 1 can be used without adding an additional index.

© 2012 SAP AG. All rights reserved. 90

U it 2Unit 2: Approaching SAP HANA ModelingApproaching SAP HANA Modeling

ObjectivesApproaching SAP HANA ModelingApproaching SAP HANA Modeling

At the end of this Lesson you will be able to:At the end of this Lesson you will be able to:

Take into account Persistency Considerations Explain the different engine types in the p g yp

SAP HANA Architecture To choose the best views for the Information Model To discuss some General Recommendations

© 2012 SAP AG. All rights reserved. 92

OverviewApproaching SAP HANA ModelingApproaching SAP HANA Modeling

This module covers the following topics:This module covers the following topics:

Persistency Considerations SAP HANA Engine Overviewg Choosing Views for the Information Model

© 2012 SAP AG. All rights reserved. 93

Persistency Considerations IApproaching SAP HANA ModelingApproaching SAP HANA Modeling

Before start creating tables on HANA database you should take a little time toBefore start creating tables on HANA database, you should take a little time to think about your scenarios. Different scenarios have different requirements and for that also different persistency models. Here is a small checklist you should take into consideration:

© 2012 SAP AG. All rights reserved. 94

take into consideration:

Persistency Considerations IIApproaching SAP HANA ModelingApproaching SAP HANA Modeling

1: Column Table 2: Analytical View 3: Calculation View (SQL)

4: Calculation View (CE Functions)View (SQL) (CE Functions)

U

Good for quick start with HANA. Shall be used for i l li ti

Most recommended for analytical purpose, where read

ti

Good for quick build of scenarios with complex

l l ti Th

Recommended for analytical purpose using complex calculation,

hi h t bUsage simple applications and showcases.

operations on mass data is required.

calculations. The model is usually simple and contains only a few fields.

which can not be expressed in an analytic view.

Pros

No additional modeling required. For most clients easy to consume.

Very high performance on SELECT. Supported by modeling. Well optimized

Building calculation views via SQL syntax is easy.

Client queries can be well optimized and parallelized. Usually better performance results than SQL.

optimized.

No support for analytical privileges, multi language and

Limitations in regards to functions.

Client queries can be less optimized and could

Syntax is different compared to well-known SQL Language

Consmulti language and client handling. Complex calculation and logic shifted to client side. In general low

and could significantly be slower compared to other models.

SQL Language.

© 2012 SAP AG. All rights reserved. 95

general low performance.

SAP HANA Engine Overview IApproaching SAP HANA ModelingApproaching SAP HANA Modeling

SQL OptimizerSQL Optimizer

Calculation EngineCalculation Engine

OLAPEngineOLAPEngine

JoinEngine

JoinEngine Row Store EngineRow Store Engine

Column StoreColumn Store Row StoreRow Store

© 2012 SAP AG. All rights reserved. 96

SAP HANA Engine Overview IIApproaching SAP HANA ModelingApproaching SAP HANA Modeling

CalculationViewsViews

OLAPOLAP J iJ i

Calculation EngineCalculation Engine

A l ti Att ib tOLAPEngineOLAPEngine

JoinEngine

JoinEngine

Analytic Views

Attribute Views

© 2012 SAP AG. All rights reserved. 97

General RecommendationsApproaching SAP HANA ModelingApproaching SAP HANA Modeling

1. Avoid transfer of large result sets Client ApplicationClient Application

A G Y Zbetween the SAP HANA DB and client (e.g. by HAVING, TOP, LIMIT, …)

2 Do calculation after aggregation

1

23

Calculation EngineCalculation EngineA G Y

2. Do calculation after aggregation

3. Avoid complex expressions (IF, CASES…)

4 Reduce data transfer between the

4

5

OLAPE iOLAPE i

JoinE i

JoinE i

A B C D G Y

4. Reduce data transfer between the engines

5. Do aggregate data records(e.g. using GROUP BY, reducing

5

6 7EngineEngine EngineEnginecolumns)

6. Join on Key Columns

7. Avoid calculation before

6 7

Column Store

Column Store

Row StoreRow Store

A B C D D Gaggregation on line item level

8. Filter data amounts as early as possible in the lower layers(CONSTRAINTS

88

© 2012 SAP AG. All rights reserved. 98

(CONSTRAINTS, WHERE clause…)

8

Choosing Views for the Information Model Approaching SAP HANA ModelingApproaching SAP HANA Modeling

Analyze Data inAnalyze Data in HANA DB

Use Star-Use Staschema or

Aggregation?

Use Only Joins and

Calculated

Yes No

NoAnalytic View Expressions?

Try Graphical Calculation

ViewUse

Attribute View

YesNo

OKNot enoughView

Use CalcScenario or

Scripted CalcView with CE F ti

Use Graphical

Calculation View

OK

OKNot enough

CE-FunctionsUse

CalcScenario or using CE-Functions

Use Scripted

Calculation View or Procedures

© 2012 SAP AG. All rights reserved. 99

Procedures

SummaryApproaching SAP HANA ModelingApproaching SAP HANA Modeling

You should now be able to:You should now be able to:

Take into account Persistency Considerations Explain the different engine types in the p g yp

SAP HANA Architecture To choose the best views for the Information Model To discuss some General Recommendations

© 2012 SAP AG. All rights reserved. 100

U it 3Unit 3: Connecting TablesConnecting Tables

ObjectivesConnecting TablesConnecting Tables

At the end of this Lesson you will be able to:At the end of this Lesson you will be able to:

• Explain differences between Inner Join, Left Outer Join, Right Outer Join, Full Outer Join, Text Join and referential Join when connecting tables.

• Explain how using Standard Union and Union with constant values.constant values.

© 2012 SAP AG. All rights reserved. 102

Business ExampleConnecting TablesConnecting Tables

Sales Order Customer

State

We want to connect the Sales Order table to the Customer table linked to the State table.the State table.

© 2012 SAP AG. All rights reserved. 103

OverviewConnecting TablesConnecting Tables

This module covers the following topics:This module covers the following topics:

How to connect tables using

• Inner Join• Inner Join

• Left Outer Join

• Right Outer Joing

• Full Outer Join

• Text Join

• Referential Join

• Union

© 2012 SAP AG. All rights reserved. 104

Inner Join – Attribute ViewConnecting Tables

Inner Join returns rows when there is at least one match in both sides of the join.

Connecting Tables

Inner is used even if it’s not added.

STATE SNAMEAL ALABAMA

1 WERNER 10 MI MI MICHIGAN2 MARK 11 MI3 TOM 12 TX4 BOB 13 TX

C_ID CNAME AGE STATE

Attribute ViewCustomer (3 & 4) is not

returned due to no corresponding entry (TX) in the t t t bl

state table.

© 2012 SAP AG. All rights reserved. 105

Inner Join – Analytical ViewConnecting TablesConnecting Tables

Analytical ViewAnalytical View

AMOUNT ORDER_ID C_ID100 4 4100 8 77 STATE SNAME100 1 1 AL ALABAMA

Be aware that Inner Joins lose facts with fragmented

100 1 1 AL ALABAMA100 2 1 1 WERNER 10 MI MI MICHIGAN100 3 2 2 MARK 11 MI

3 TOM 12 TX4 BOB 13 TX

dimensions. Order (4 & 77) lost due to no corresponding customer and state record

© 2012 SAP AG. All rights reserved. 106

4 BOB 13 TXC_ID CNAME AGE STATE

state record

Inner Join and Design Time FiltersConnecting TablesConnecting Tables

Design time filter applied (AGE < 13) of left/central table

Design time filter applied to (STATE = MI) on right table

Both design time filters are applied first before the join is executedbefore the join is executed

© 2012 SAP AG. All rights reserved. 107

Left Outer Join – Attribute ViewConnecting Tables

Attribute View

Connecting Tables

• Left Outer Join returns all rows from the left table even if there are no matches in the right Attribute Viewtable even if there are no matches in the right table.

• This join is popular in Analytical Views whereby h A ib i i j i d h f blthe Attribute view is joined to the fact table.

STATE SNAMEAL ALABAMA

1 WERNER 10 MI MI MICHIGAN2 MARK 11 MI2 MARK 11 MI3 TOM 12 TX4 BOB 13 TX

C_ID CNAME AGE STATE

© 2012 SAP AG. All rights reserved. 108

No matches for TX in the right table.

Left Outer Join – Analytical ViewConnecting TablesConnecting Tables

Analytical ViewAnalytical View

AMOUNT ORDER_ID C_ID STATE SNAME100 1 1 C ID CNAME AGE STATE AL ALABAMA

Customer (TOM) is 100 1 1 C_ID CNAME AGE STATE AL ALABAMA100 2 1 1 WERNER 10 MI MI MICHIGAN100 3 2 2 MARK 11 MI

3 TOM 12 TX100 4 4 4 BOB 13 TX

not returned due to no corresponding sale item record in sales order table

© 2012 SAP AG. All rights reserved. 109

100 4 4 4 BOB 13 TX100 8 77

table.

Left Outer Join and Design Time FiltersConnecting TablesConnecting Tables

Design time filter applied (AGE < 13) of left/central table

Design time filter applied to (STATE = MI) on right table

Filters are applied to both tables and thenFilters are applied to both tables and then afterwards the join is executed. Due to the left outer join TOM will be included in the result set even though he resides in TX

© 2012 SAP AG. All rights reserved. 110

g

Right Outer Join – Attribute ViewConnecting TablesConnecting Tables

• Right Outer Join returns all the rows from the right table even if there are no matches in the Attribute Viewright table, even if there are no matches in the left table.

Attribute View

STATE SNAMEAL ALABAMA

1 WERNER 10 MI MI MICHIGAN

Alabama is included in the result set, though there is no match in the left table.

2 MARK 11 MI3 TOM 12 TX4 BOB 13 TX

C_ID CNAME AGE STATE

© 2012 SAP AG. All rights reserved. 111

Right Outer Join – Analytical ViewConnecting TablesConnecting Tables

Analytical ViewAnalytical View

AMOUNT ORDER_ID C_ID100 4 4100 8 77 STATE SNAME? ? ? ? ? ? AL ALABAMA

Right Outer Join results in NULL measure.

? ? ? ? ? ? AL ALABAMA100 1 1100 2 1 1 WERNER 10 MI MI MICHIGAN100 3 2 2 MARK 11 MI

3 TOM 12 TX

© 2012 SAP AG. All rights reserved. 112

3 TOM 12 TX4 BOB 13 TX

C_ID CNAME AGE STATE

Full Outer JoinConnecting TablesConnecting Tables

• Full Outer Join is neither left nor right it's both It includes all the rows- it's both. It includes all the rows

from both of the tables or result sets participating in the Join.

• When no matching rows exist for rows on the left side or right side of the Join, you see NULL values.

• Full Outer Join is supported only in Attribute Views and NOT within Analytical Views.

STATE SNAME? ? ? ? AL ALABAMA? ? ? ? AL ALABAMA1 WERNER 10 MI MI MICHIGAN2 MARK 11 MI MI MICHIGAN3 TOM 12 TX ? ?4 BOB 13 TX ? ?

© 2012 SAP AG. All rights reserved. 113

4 BOB 13 TX ? ?C_ID CNAME AGE STATE

Text JoinConnecting Tables

• Text Join are used to join a text table to a master data table

Connecting Tables

table to a master data table.

• Text Joins acts as a Left Outer join and can be used with SAP tables where the language column (SPRAS) is present.

• For each attribute it is possible toFor each attribute it is possible to define a description mapping that will be specific to the end users language.

© 2012 SAP AG. All rights reserved. 114

Referential JoinConnecting TablesConnecting Tables

Relies on Referential Integrity Each entry in the left table MUST have di t i th i ht t bla corresponding entry in the right table

Optimized for performance Join is only performed if at least one field from the right table is requested.

Like an Inner Join when join is executed

When field from both tables are requested an inner Join is performed.

Only available in OLAP engine Referential join is a feature available only in OLAP engine, when testing Attribute Views outside the context of a Analytical view then the Join EngineAnalytical view then the Join Engine will perform a Inner Join.

© 2012 SAP AG. All rights reserved. 115

Referential Join – Attribute ViewConnecting TablesConnecting Tables

*** Referential join is a feature available only in OLAP engine, when testing Attribute Views outside the context of a Analytical view then the Join Engine will perform a Inner Join. As a result TOM and BOM will not be returned.

© 2012 SAP AG. All rights reserved. 116

Referential Join – Analytical ViewConnecting TablesConnecting Tables

*** Customer 77, TOM and BOB are not returned since C_ID is a Joined key field resulting in an Inner Join. BOB has no corresponding Texas description and TOM has no corresponding facts.

*** TOM is not returned due to no corresponding facts in the sales tablecorresponding facts in the sales table

*** The Amount includes all facts including Customer 77 and BOBs order even through master records do not exist reason is when only non-key fields are selected from the left table, all joins to other tables will be omitted

© 2012 SAP AG. All rights reserved. 117

tables will be omitted

Referential Join – Using MDXConnecting TablesConnecting Tables

Like Inner Join

No referential integrityof data in both tables

No Join processed

© 2012 SAP AG. All rights reserved. 118

p

Calculation View- Join vs. UnionConnecting TablesConnecting Tables

Caution!! Do not JOIN Analytical Views, this could lead to performance i li ti I t d U i ith t t l h ki ithimplications. Instead use Union with constant values when working with

multiple fact tables

© 2012 SAP AG. All rights reserved. 119

UnionsConnecting TablesConnecting Tables

• Unions are used to combine the result-set of two or more SELECT statements.

• The Union operation is popular for combining plan and actual values in CO-PA.

• Note that Unions are not supported in modeled artifacts (Attribute Views or Analytical Views) d l b li d i C l l ti Viand can only be realized in Calculation Views.

• Refrain from Joining Analytical views; rather use Unions with Constant values.

• Unions with Constant values are supported within Graphical Calculation Views and the UNION operator can accept 1..N input sources.

• Whereas a Script Based calculation view’s comparable CE UNION ALL function can onlyWhereas a Script Based calculation view s comparable CE_UNION_ALL function can only accept 2 input sources at a given time.

© 2012 SAP AG. All rights reserved. 120

Standard UnionConnecting TablesConnecting Tables

© 2012 SAP AG. All rights reserved. 121

Union with Constant ValuesConnecting TablesConnecting Tables

© 2012 SAP AG. All rights reserved. 122

SummaryConnecting TablesConnecting Tables

You should now be able to:You should now be able to:

• Explain differences between Inner Join, Left Outer Join, Right Outer Join, Full Outer Join, Text Join and referential Join when connecting tables.

• Explain how using Standard Union and Union with constant valuesconstant values.

© 2012 SAP AG. All rights reserved. 123

Creating Attribute Views

Unit 4: Advanced Modeling

Creating Restricted & Calculated MeasuresUsing Hierarchies

Using Filter Operations

SAP HANA SQL - Introduction

Using Filter OperationsUsing Variables

SQLScript and Procedures

Using Currency Conversion

ObjectivesCreating Attribute ViewsCreating Attribute Views

At the end of this Lesson you will be able to:At the end of this Lesson you will be able to:

Explain how to create derived attribute views, Explain how to create shared attribute views,p , Explain how to create calculated attributes, Explain how to create time characteristics based attribute views, Explain how to create stand alone text tables.Explain how to create stand alone text tables.

© 2012 SAP AG. All rights reserved. 125125

OverviewCreating Attribute ViewsCreating Attribute Views

This module covers the following topics:This module covers the following topics:

Derived Attribute Views, Shared Attribute Views Calculated Attributes Time Characteristics Based Attribute Views Stand Alone Text TablesStand Alone Text Tables

© 2012 SAP AG. All rights reserved. 126126

Concept Attribute viewsCreating Attribute ViewsCreating Attribute Views

CalculationViews

Calculation EngineCalculation Engine

OLAPOLAP JoinJoin

Calculation EngineCalculation Engine

Analytic AttributeEngineEngine EngineEngine

a y cViews

Attribute Views

© 2012 SAP AG. All rights reserved. 127127

Derived Attribute ViewsCreating Attribute ViewsCreating Attribute Views

© 2012 SAP AG. All rights reserved. 128© 2012 SAP AG. All rights reserved. 128

Shared Attribute ViewsCreating Attribute ViewsCreating Attribute Views

© 2012 SAP AG. All rights reserved. 129© 2012 SAP AG. All rights reserved. 129

Calculated AttributesCreating Attribute ViewsCreating Attribute Views

© 2012 SAP AG. All rights reserved. 130© 2012 SAP AG. All rights reserved. 130

Time Characteristics Attribute ViewCreating Attribute ViewsCreating Attribute Views

© 2012 SAP AG. All rights reserved. 131© 2012 SAP AG. All rights reserved. 131

Creating Stand Alone Text TablesCreating Attribute ViewsCreating Attribute Views

© 2012 SAP AG. All rights reserved. 132© 2012 SAP AG. All rights reserved. 132

SummaryCreating Attribute ViewsCreating Attribute Views

You should now be able to:You should now be able to:

Explain how to create derived attribute views, Explain how to create shared attribute views,p , Explain how to create calculated attributes, Explain how to create time characteristics based attribute views, Explain how to create stand alone text tables.Explain how to create stand alone text tables.

© 2012 SAP AG. All rights reserved. 133133

Creating Attribute Views

Unit 4: Advanced Modeling

Creating Restricted & Calculated MeasuresUsing Hierarchies

Using Filter Operations

SAP HANA SQL - Introduction

Using Filter OperationsUsing Variables

SQLScript and Procedures

Using Currency Conversion

ObjectivesUsing HierarchiesUsing Hierarchies

At the end of this Lesson you will be able to:At the end of this Lesson you will be able to:

Explain how to implement leveled hierarchies, Explain how to leverage parent / child hierarchies,Explain how to leverage parent / child hierarchies, Explain how to create attribute based hierarchies.

© 2012 SAP AG. All rights reserved. 135135

OverviewUsing HierarchiesUsing Hierarchies

This module covers the following topics:This module covers the following topics:

Implement Leveled Hierarchies Leverage Parent Child HierarchiesLeverage Parent Child Hierarchies Create Attribute Based Hierarchies

© 2012 SAP AG. All rights reserved. 136136

Concept Using HierarchiesUsing HierarchiesUsing Hierarchies

For example, consider the TIME attribute view with YEAR, QUARTER, and

Hierarchies in HANA could only

p , , ,MONTH attributes. You can use these YEAR, QUARTER, and MONTH attributes to define a hierarchy for the TIME attribute view as follows:Hierarchies in HANA could only be used by reporting tools using MDX connectivity

© 2012 SAP AG. All rights reserved. 137137

Using HierarchiesUsing HierarchiesUsing Hierarchies

Let's have a look at the following hierarchy, a minimal example :

Hierarchies in HANA could only

g y p

Hierarchies in HANA could only be used by reporting tools using MDX connectivity

© 2012 SAP AG. All rights reserved. 138138

Implement Leveled HierarchiesUsing HierarchiesUsing Hierarchies

Level Hierarchies are hierarchies that are rigid in nature, where the root and the g ,child nodes can be accessed only in the defined order. For example, organizational structures, and so on.

This page describes step-by-step how to create a SAP HANA Database hierarchy view byDatabase hierarchy view by means of the SAP Hana Modeler.

Create a table providing some p ghierarchy source data :

© 2012 SAP AG. All rights reserved. 139© 2012 SAP AG. All rights reserved. 139

Implement Leveled HierarchiesUsing HierarchiesUsing Hierarchies

If necessary, create a y,package in the Modeler.

Create an attribute view in the Modeler :

© 2012 SAP AG. All rights reserved. 140© 2012 SAP AG. All rights reserved. 140

Implement Leveled HierarchiesUsing HierarchiesUsing Hierarchies

Select the source table as basis for the view :

© 2012 SAP AG. All rights reserved. 141© 2012 SAP AG. All rights reserved. 141

Implement Leveled HierarchiesUsing HierarchiesUsing Hierarchies

Select the attributes that should be part of the source view :

© 2012 SAP AG. All rights reserved. 142© 2012 SAP AG. All rights reserved. 142

Implement Leveled HierarchiesUsing HierarchiesUsing Hierarchies

Switch to the Hierarchies tab, press the Create button and define hierarchy name and structure type, currently leveled :

© 2012 SAP AG. All rights reserved. 143© 2012 SAP AG. All rights reserved. 143

Implement Leveled HierarchiesUsing HierarchiesUsing Hierarchies

Add the source attributes to the hierarchy. For a leveled hierarchy, add the attributes to the hierarchy in the correct level order from top to bottom :

© 2012 SAP AG. All rights reserved. 144© 2012 SAP AG. All rights reserved. 144

Implement Leveled HierarchiesUsing HierarchiesUsing Hierarchies

Validate the hierarchy, y,close, and save. And then activate the attribute view :

© 2012 SAP AG. All rights reserved. 145© 2012 SAP AG. All rights reserved. 145

Leverage Parent Child HierarchiesUsing HierarchiesUsing Hierarchies

Value hierarchies are hierarchies that are very similar to BOM (parent and child) and Employee Master(Employee and Manager). The hierarchy can be explored based on a selected parent, and there are cases where the child can be a parent. This hierarchy is derived based on the value.

If you want to create a parent-child hierarchy, set the child/successor attribute's property "Principal Key" to True :

© 2012 SAP AG. All rights reserved. 146© 2012 SAP AG. All rights reserved. 146

Leverage Parent Child HierarchiesUsing HierarchiesUsing Hierarchies

Switch to the Hierarchies tab, press the Create button and define hierarchy name and structure type, currently parent-child :

© 2012 SAP AG. All rights reserved. 147© 2012 SAP AG. All rights reserved. 147

Leverage Parent Child HierarchiesUsing HierarchiesUsing Hierarchies

For a parent-child phierarchy, select the child/successor attribute as Key Attribute and the parent/predecessor attribute as Parent attribute :

Then, validate, close, d ti t thsave and activate the

attribute view.

© 2012 SAP AG. All rights reserved. 148© 2012 SAP AG. All rights reserved. 148

Create Attribute Based HierarchiesUsing HierarchiesUsing Hierarchies

© 2012 SAP AG. All rights reserved. 149© 2012 SAP AG. All rights reserved. 149

Create Attribute Based HierarchiesUsing HierarchiesUsing Hierarchies

© 2012 SAP AG. All rights reserved. 150© 2012 SAP AG. All rights reserved. 150

SummaryUsing HierarchiesUsing Hierarchies

You should now be able to:You should now be able to:

Explain how to implement leveled hierarchies, Explain how to leverage parent / child hierarchies,Explain how to leverage parent / child hierarchies, Explain how to create attribute based hierarchies.

© 2012 SAP AG. All rights reserved. 151151

Creating Attribute Views

Unit 4: Advanced Modeling

Creating Restricted & Calculated MeasuresUsing Hierarchies

Using Filter Operations

SAP HANA SQL - Introduction

Using Filter OperationsUsing Variables

SQLScript and Procedures

Using Currency Conversion

ObjectivesCreating Restricted & Calculated MeasuresCreating Restricted & Calculated Measures

At the end of this Lesson you will be able to:At the end of this Lesson you will be able to:

Understand the benefits of Restricted Measures Use Restricted Measures Understand when to use Calculated Measures Create Calculated Measures

© 2012 SAP AG. All rights reserved. 153153

OverviewUsing Filter OperationsUsing Filter Operations

This module covers the following topics:This module covers the following topics:

Concepts for Restricted & Calculated Measures Using Restricted MeasuresUsing Restricted Measures Creating Calculated Measures

© 2012 SAP AG. All rights reserved. 154154

The benefits of Restricted MeasuresCreating Restricted & Calculated Measures

What is a Restricted Measure?

Creating Restricted & Calculated Measures

C t M th A t

• As the name implies it is a measure that does not give the complete picture of a measure, it

Country Month AmountDE 2010‐01 12.345,00   DE 2010‐02 15.678,00   DE 2010‐03 25.814,00   DE 2010‐04 21.586,00   DE 2010‐05 21 861 00

Restricted by Country:p p ,

is restricted to a subset of the original measure.

• The benefit of a Restricted

DE 2010 05 21.861,00   DE 2010‐06 11.258,00   DE 2010‐07 12.387,00   DE 2010‐08 13.589,00   DE 2010‐09 12.345,00   DE 2010‐10 15.678,00   

DE US Difference209.941,00    205.838,00    4.103,00   

• The benefit of a Restricted Measure is, that it expands the modeling options in a view, giving the modeler the possibilities of

DE 2010‐11 25.814,00   DE 2010‐12 21.586,00   US 2010‐01 21.861,00   US 2010‐02 11.258,00   US 2010‐03 12.387,00   

Country Q1 Q2DE 53.837,00    54.705,00   US 45.506,00 41.612,00

Restricted by Months:

creating objects that can be easily reported on or reused.

US 2010‐04 13.589,00   US 2010‐05 12.345,00   US 2010‐06 15.678,00   US 2010‐07 25.814,00   US 2010‐08 21.586,00   US 2010 09 21 861 00

US 45.506,00    41.612,00   

US 2010‐09 21.861,00   US 2010‐10 11.258,00   US 2010‐11 12.387,00   US 2010‐12 25.814,00   

© 2012 SAP AG. All rights reserved. 155155

Using Restricted MeasuresCreating Restricted & Calculated Measures

Picture the example in the right table.

Creating Restricted & Calculated Measures

Cost Type Amountp gYou have a transactional table with cost data items, with each cost type split on a different line.

Cost Type Amount

Purchasing Price € 1 200

If you want to find out the shipping cost you could create an Analytic View

Shipping Cost € 80

VAT € 346with Cost Type as an Attribute, and Amount as a Measure.

Y ld th t i t t b

Processing Cost € 150

You could then restrict your report by reporting on Cost Type, setting the Attribute filtered on Cost Type = “Shipping Cost”

Margin € 300

“Shipping Cost”.

© 2012 SAP AG. All rights reserved. 156© 2012 SAP AG. All rights reserved. 156156

Using Restricted Measures Creating Restricted & Calculated Measures

In order to utilize a Restricted Measure, you can instead create one which

Creating Restricted & Calculated Measures

, yalready limits the results to Shipping Costs only within the measure itself.

© 2012 SAP AG. All rights reserved. 157© 2012 SAP AG. All rights reserved. 157

Using Restricted Measures Creating Restricted & Calculated Measures

The Attribute you filter the Restricted

Creating Restricted & Calculated Measures

yMeasure does not have be limited to one single Attribute.

You can set it restricted to multiple attributes depending on your reporting requirements.

There are also multiple operators to choose from.

© 2012 SAP AG. All rights reserved. 158© 2012 SAP AG. All rights reserved. 158

Using Restricted Measures Creating Restricted & Calculated Measures

Further, the Restricted Measure does not

Creating Restricted & Calculated Measures

have to be a straight sum of the Measure that it is based on.

The Aggregation Types that you have available are:

SUM SUM

MIN

MAX

© 2012 SAP AG. All rights reserved. 159© 2012 SAP AG. All rights reserved. 159

When to use Calculated Measures Creating Restricted & Calculated MeasuresCreating Restricted & Calculated Measures

In a data model sometimes not all Measures available in the base data will give your users sufficient information for reporting if you just provide the basereporting if you just provide the base Measures in your views.

SAP HANA has a type of Measure available called Calculation Measures where the modeler is able to include calculations already within the view in order to help reporting or furtherorder to help reporting or further modeling.

© 2012 SAP AG. All rights reserved. 160160

When to use Calculated Measures Creating Restricted & Calculated Measures

Cli t A li tiCli t A li ti

Creating Restricted & Calculated Measures

When you include calculations in Client ApplicationClient Application

A G Y Zyour views using Calculated Measures you take advantage of the speed of SAP HANA letting the database engine perform the

Calculation EngineCalculation EngineDo calculation after aggregation

database engine perform the calculations, instead of doing these calculations in your end client reporting tool.

OLAPEngineOLAPEngine

JoinEngine

JoinEngine

A B C D G Y

Having ready defined calculations in views can also help simplifying reporting by unifying calculations EngineEngine EngineEnginep g y y ghaving them calculated in the same way for all users instead of having users or developers create their own versions of the Avoid calculation

Column Store

Column Store

Row StoreRow Store

their own versions of the calculations.

Avoid calculation before aggregation on line item level

© 2012 SAP AG. All rights reserved. 161161

Creating Calculated MeasuresCreating Restricted & Calculated MeasuresCreating Restricted & Calculated Measures

A Calculated Measure is defined in the view and when you create one you can use the calculations, mathematical functions etc. available in the editor.

© 2012 SAP AG. All rights reserved. 162© 2012 SAP AG. All rights reserved. 162

,

Creating Calculated MeasuresCreating Restricted & Calculated MeasuresCreating Restricted & Calculated Measures

Product Units Price Total Sales (Units * Price)

Keyboards 100 € 40 € 4 000Keyboards 100 € 40 € 4 000

LCD Screens 50 € 300 € 15 000

Network Switches 75 € 90 € 6 750

VOIP Telephones 200 € 65 € 13 000

Servers 30 € 2 000 € 60 000

SUM: 455 € 2 495 € 1 135 225

For certain measure it is not possible to perform the calculations when the measures are already aggregated. The aggregated granularity of for example Price does not mean anything

© 2012 SAP AG. All rights reserved. 163© 2012 SAP AG. All rights reserved. 163

Price does not mean anything.

Creating Calculated MeasuresCreating Restricted & Calculated MeasuresCreating Restricted & Calculated Measures

For these types of Measures you can predefine the Calculated Measure to calculate each individual item before aggregating.

This is done by l ti th tiselecting the option

“Calculate Before Aggregation”.

© 2012 SAP AG. All rights reserved. 164© 2012 SAP AG. All rights reserved. 164

Creating Calculated MeasuresCreating Restricted & Calculated MeasuresCreating Restricted & Calculated Measures

This way you can be sureProduct Units Price Total Sales

(Units * Price)This way you can be sure that you end up with a correct sum as the calculation are performed

Keyboards 100 € 40 € 4 000

LCD S 50 € 300 € 15 000 calculation are performed on the correct granular level.

LCD Screens 50 € 300 € 15 000

Network Switches 75 € 90 € 6 750

VOIP Telephones 200 € 65 € 13 000

Servers 30 € 2 000 € 60 000

SUM: € 98 750

© 2012 SAP AG. All rights reserved. 165© 2012 SAP AG. All rights reserved. 165

ObjectivesUsing currency ConversionUsing currency Conversion

You should now be able to:You should now be able to:

Understand the benefits of Restricted Measures Use Restricted Measures Understand when to use Calculated Measures Create Calculated Measures

© 2012 SAP AG. All rights reserved. 166166

Creating Attribute Views

Unit 4: Advanced Modeling

Creating Restricted & Calculated MeasuresUsing Hierarchies

Using Filter Operations

SAP HANA SQL - Introduction

Using Filter OperationsUsing Variables

SQLScript and Procedures

Using Currency Conversion

ObjectivesUsing Filter OperationsUsing Filter Operations

At the end of this Lesson you will be able to:At the end of this Lesson you will be able to:

Explain how to compare constraint filter and WHERE clause, Explain how to create client dependant views,p p , Explain how to model domain fix values.

© 2012 SAP AG. All rights reserved. 168

OverviewUsing Filter OperationsUsing Filter Operations

This module covers the following topics:This module covers the following topics:

Compare constraint filter and WHERE clause, Create client dependant views,p , Model domain fix values.

© 2012 SAP AG. All rights reserved. 169169

Filter OperationsUsing Filter OperationsUsing Filter Operations

Client ApplicationClient Application

Calculation EngineCalculation Engine Reduce data transfer between the engines by using Filter O ti lik

OLAPE iOLAPE i

JoinE i

JoinE i

Operations like : Using a Constraint or WHERE

clauseC ti Cli t D d t ViEngineEngine EngineEngine Creating Client Dependant Views Using Model Domain Fix Values

Column Store

Column Store

Row StoreRow Store

© 2012 SAP AG. All rights reserved. 170170

Compare Constraint Filter & WHERE ClauseUsing Filter OperationsUsing Filter Operations

Constraint filter :• Is defined on design time on a

tabletable,

• The filter applies on the table before the query starts to

WHERE clause :• Is defined on runtime in theexecute,

• Normally faster than WHERE clause as the results set is

• Is defined on runtime in the SQL query,

• The filters applies on the f

Vs

clause, as the results set is reduced before proceeding with the query execution plan, e.g. constraints applied before

results set of a query.

e.g. constraints applied before a table join is executed.

© 2012 SAP AG. All rights reserved. 171171

Create Client Dependant ViewsUsing Filter OperationsUsing Filter Operations

Define « Default Client » as « dynamic » in properties of your views (Attribute Views and Analytic Views)

Define the value of the « Session Client » in the definition of the UserClient » in the definition of the User ID. The variable constraint is substituted at runtime by the client that is set for the current user

© 2012 SAP AG. All rights reserved. 172© 2012 SAP AG. All rights reserved.

running a query on the model:

172

Model Fix ValuesUsing Filter OperationsUsing Filter Operations

© 2012 SAP AG. All rights reserved. 173© 2012 SAP AG. All rights reserved. 173

Model Fix ValuesUsing Filter OperationsUsing Filter Operations

© 2012 SAP AG. All rights reserved. 174© 2012 SAP AG. All rights reserved. 174

SummaryUsing Filter OperationsUsing Filter Operations

You should now be able to:You should now be able to:

Explain how to compare constraint filter and WHERE clause, Explain how to create client dependant views,p p , Explain how to model domain fix values.

© 2012 SAP AG. All rights reserved. 175175

Creating Attribute Views

Unit 4: Advanced Modeling

Creating Restricted & Calculated MeasuresUsing Hierarchies

Using Filter Operations

SAP HANA SQL - Introduction

Using Filter OperationsUsing Variables

SQLScript and Procedures

Using Currency Conversion

ObjectivesCreating VariablesCreating Variables

At the end of this Lesson you will be able to:At the end of this Lesson you will be able to:

• Explain SAP HANA Variables• Create Variables• Create Variables

© 2012 SAP AG. All rights reserved. 177

OverviewCreating VariablesCreating Variables

This module covers the following topics:This module covers the following topics:

• Creating Attribute Value Variables• Creating Static Value Lists• Creating Static Value Lists• Creating Variables with Formulas• Creating Date Variables

© 2012 SAP AG. All rights reserved. 178178

SAP HANA Variables ConceptsCreating VariablesCreating Variables

You use variables to filter data atClient ApplicationClient Application You use variables to filter data at runtime. You assign values to these variables by entering the value manually, or by selecting it f th d d li t

Client ApplicationClient Application

from the drop-down list.

Using variables means that you do not need to decide the

Calculation EngineCalculation Engine

restriction on the value of attributes at the design time.

You can apply variables in theOLAPEngineOLAPEngine

JoinEngine

JoinEngine You can apply variables in the

analytic and calculation views.

If a calculation view is created i l ti i ith

EngineEngine EngineEngine

using an analytic view with variables, those variables are also available in the calculation view but cannot be edited.

Column Store

Column Store

Row StoreRow Store

© 2012 SAP AG. All rights reserved. 179179

Variables TypesCreating VariablesCreating Variables

The following types of variables are supported:

Type DescriptionAttributeValue Use this to apply a filter when the value of the filter comes from

an attribute.

Currency Use this during currency conversion to specify the targetCurrency Use this during currency conversion to specify the target currency.

Date Use this to apply a filter when the value of the filter is in date format, for example, to specify the date during currency , p , p y g yconversion.

Static List Use this to a apply filter when the value of the filter comes from a user-defined list of values.

© 2012 SAP AG. All rights reserved. 180180

Creating Attribute Value VariablesCreating VariablesCreating Variables

The Variable type called ”AttributeValue”The Variable type called AttributeValue restricts the results in the view for the selected Attribute.

You select the Attribute in the view that you want to filter on, and you also define the:

Selection Type: Whether selections should be based on intervals, ranges or single valuessingle values.

Multiple Entries: Whether mutliple values of the selection types should be ypallowed.

© 2012 SAP AG. All rights reserved. 181© 2012 SAP AG. All rights reserved. 181

Creating Attribute Value VariablesCreating VariablesCreating Variables

When displaying the values of a View with an Attribute Value Variable includedWhen displaying the values of a View with an Attribute Value Variable included, you will be asked to enter the values for the Attribute Values defined. The Value Help Dialog you can help you find the selections you are looking for.

© 2012 SAP AG. All rights reserved. 182© 2012 SAP AG. All rights reserved. 182

Creating Attribute Value VariablesCreating VariablesCreating Variables

The Variable Values selectedThe Variable Values selected will restrict the results as required when you click the ”OK” button.OK button.

Should the user however need to display all values, bypassing the selection criteria completely, it is possible to do so by selecting the “Cancel” button in th “V i bl V l ” di lthe “Variable Values” dialog.

© 2012 SAP AG. All rights reserved. 183© 2012 SAP AG. All rights reserved. 183

Creating Static Value ListsCreating VariablesCreating Variables

When you want to limit theWhen you want to limit the possible values to select for a varaible it can be useful to define the Variable as adefine the Variable as a ”StaticList” type.

When defining this type of variable you can enter the list of values at design-time.

© 2012 SAP AG. All rights reserved. 184184

Creating Static Value ListsCreating VariablesCreating Variables

During refresh of a ”StaticList” type of Variable when the user clicks on ”Find” theDuring refresh of a StaticList type of Variable, when the user clicks on Find , the Value Help Dialog will display the list of values defined during variable creation.

© 2012 SAP AG. All rights reserved. 185185

Creating Variables with formulasCreating VariablesCreating Variables

A variable does not necessarily need toA variable does not necessarily need to restrict the data of a view.

It can also take input from the user and process it, returning dynamic data based on the user selection.

We now want to see how we can createWe now want to see how we can create a function in a Calculated Measure based on the value of a Variable.

© 2012 SAP AG. All rights reserved. 186186

Creating Variables with formulasCreating VariablesCreating Variables

What we first need to doWhat we first need to do is to create a variable to be used in a calculation.

The variable can be of any type, for example a StaticList type.

In this example to the right the user can choose either ”Gross” orchoose either Gross or ”Net” as the selection.

© 2012 SAP AG. All rights reserved. 187© 2012 SAP AG. All rights reserved. 187

Creating Variables with formulasCreating VariablesCreating Variables

We also need somewhere toWe also need somewhere to call the variable from.

In for example a Calculated Measure, we can reference the result of the user selected variable.

This is done by calling it within double dollar signs, see example:see example:

if('$$VAR_GROSS_OR_NET$$'='Gross',"GROSS_AMOUNT","NET_AMOUNT")

© 2012 SAP AG. All rights reserved. 188© 2012 SAP AG. All rights reserved. 188

Creating Date VariablesCreating VariablesCreating Variables

The Variable type”Date” can be usefulThe Variable type Date can be useful when you for example want an input date from the reporting user in order to create further calculations on.create further calculations on.

Whatever input is selected in the variable can be used as a basis for extended calculations.

© 2012 SAP AG. All rights reserved. 189© 2012 SAP AG. All rights reserved. 189

Creating Date VariablesCreating VariablesCreating Variables

Selecting the Variable Type as: ”Date” will make it easier for the endSelecting the Variable Type as: Date will make it easier for the end user to select a date by utilizing a calendar dialog for selecting the appropriate date.

© 2012 SAP AG. All rights reserved. 190© 2012 SAP AG. All rights reserved. 190

Creating Date VariablesCreating VariablesCreating Variables

Calculated AttributeVariable

The date variable selected can then beThe date variable selected can then be used in for example a Calculated Attribute so as to give dynamic values.

© 2012 SAP AG. All rights reserved. 191© 2012 SAP AG. All rights reserved. 191

ObjectivesCreating VariablesCreating Variables

You should now be able to:You should now be able to:

• Explain SAP HANA Variables• Create Variables• Create Variables

© 2012 SAP AG. All rights reserved. 192192

Creating Attribute Views

Unit 4: Advanced Modeling

Creating Restricted & Calculated MeasuresUsing Hierarchies

Using Filter Operations

SAP HANA SQL - Introduction

Using Filter OperationsUsing Variables

SQLScript and Procedures

Using Currency Conversion

ObjectivesSAP HANA SQLSAP HANA SQL

At the end of this Lesson you will be able to:At the end of this Lesson you will be able to:

Explain the language elements used in SAP HANA SQL statements.Q

© 2012 SAP AG. All rights reserved. 194

OverviewSAP HANA SQLSAP HANA SQL

This module covers the following topics:This module covers the following topics:

• Overview SQL Language Elements• Identifiers• Identifiers• SQL Data Types• Predicates and Operators• Functions and Expressions• SQL Statements - Examples

© 2012 SAP AG. All rights reserved. 195195

SQL - DefinitionSAP HANA SQLSAP HANA SQL

• Standardized Class Description Examplelanguage for communication with a relational database.

p p

DDL Data Definition Language

CREATE, ALTER, DROP TABLE

• Used to retrieve, store or manipulate information in the

DML Data Manipulation Language

SELECT, DELETE, INSERT, UPDATE

information in the database. DCL Data Control

LanguageGRANT, REVOKE

© 2012 SAP AG. All rights reserved. 196196

SQL language elementsSAP HANA SQLSAP HANA SQL

Identifiers • Used to represent names used in SQL statementIdentifiers • Used to represent names used in SQL statement

Data types • Specify the characteristics of a data value

Expressions • Clause that can be evaluated to return values

Operators • Used for calculation, value comparison or to assign values

Predicates• Specified by combining one or more expressions or logical

operators and returns one of the following logical or truth values: TRUE, FALSE, or UNKNOWNvalues: TRUE, FALSE, or UNKNOWN

Functions • Used in expressions to return information from the database

© 2012 SAP AG. All rights reserved. 197197

Comment and Code pageSAP HANA SQLSAP HANA SQL

C tComments

--double hyphensdouble hyphens

/*/ <……> */

Codepage

The SAP HANA database supports Unicode to allow use of all The SAP HANA database supports Unicode to allow use of all languages in the Unicode Standard and 7 Bit ASCII code page without restriction.

© 2012 SAP AG. All rights reserved. 198198

IdentifiersSAP HANA SQLSAP HANA SQL

TRAININGUndelimitedIdentifiers

• must start with a letter• cannot contain any symbols other

than digits or an underscore "

TRAININGTraining(treated with upper case!)1TRAININGg _TRAINING%

• enclosed in the delimiterd bl t

"TRAINING"" i i (

Delimited Identifiers

double quotes "<identifier>"

• can contain any character including special characters.

"Training" (case sensitive)"1Training""Training%"p g

• "_SYS_" is reserved exclusively for database engine

Limitationsfor database engine

• Role name and user name must be specified as undelimited identifiers.

• Maximum length for the identifiers i 127 h t

© 2012 SAP AG. All rights reserved. 199

is 127 characters.

199

SQL Data typesSAP HANA SQLSAP HANA SQL

Classification Data Type

Datetime types DATE, TIME, SECONDTIME, TIMESTAMP

Numeric types TINYINT, SMALLINT, INTEGER, BIGINT,SMALLDECIMAL, DECIMAL, REAL, DOUBLE, FLOAT

Character string types VARCHAR, NVARCHAR, ALPHANUM, SHORTTEXT

Binary types VARBINARY

Large Object types BLOB, CLOB, NCLOB, TEXT

© 2012 SAP AG. All rights reserved. 200200

PredicatesSAP HANA SQLSAP HANA SQL

Comparison Predicates <expression> p{ = | != | <> | > | < | >= | <= } [ ANY | SOME| ALL ] { <expression_list> | <subquery> }

Range Predicate <expression1> [NOT] BETWEEN <expression2> AND <expression3>

In Predicate <expression> [NOT] IN { <expression_list> | <subquery> }

E i t P di t [NT] EXISTS ( < b > )Exists Predicate [NT] EXISTS ( <subquery> )

LIKE Predicate <expression1> [NOT] LIKE <expression2> [ESCAPE <expression3>] [ p ]

NULL Predicate <expression> IS [NOT] NULL

© 2012 SAP AG. All rights reserved. 201201

OperatorsSAP HANA SQLSAP HANA SQL

U operator operand unary plus operator(+) ( )Unary operator operand unary negation operator(-)

logical negation(NOT)

Bi operand1 operator operand2multiplicative ( *, / ), additive ( +,- ) comparison operatorsBinary operand1 operator operand2 comparison operators ( =,!=,<,>,<=,>=) logical operators ( AND, OR )

Arithmetic -< expression > Negation Addition SubtractionArithmetic Operators

< expression > < expression > operator < expression >

Negation, Addition, SubtractionMultiplication, Division

String Operator < expression > || < expression > String concatenationOperator

Comparison Operators <expression> operator <expression>

>= Greater or equal to<= Less than or equal to !=, <> Not equal

Logical Operators

Search conditions can be combined using AND or OR operators. You can also negate them using the NOT operator.

AND, OR NOT

S t t f ti th UNION UNION ALL INTERSECT

© 2012 SAP AG. All rights reserved. 202

Set Operators Set operators perform operations on the results of two or more queries.

UNION, UNION, ALL, INTERSECT, EXCEPT

202

FunctionsSAP HANA SQLSAP HANA SQL

Cl ifi ti E lClassification Examples

Data type conversion Functions CAST, TO ALPHANUM, TO BIGINT, …yp , _ , _ ,

DateTime Functions ADD_DAYS, ADD_MONTHS, ADD_YEARS, DAYS BETWEEN, DAYNAME, CURRENT DATE, …DAYS_BETWEEN, DAYNAME, CURRENT_DATE, …

Number Functions ABS, ACOS, ASIN, ATAN, COS …

String Functions CONCAT, LEFT, LENGTH, TRIM, …

Miscellaneous Functions IFNULL, CURRENT SCHEMA, …sce a eous u ct o s , _ ,

© 2012 SAP AG. All rights reserved. 203203

ExpressionsSAP HANA SQLSAP HANA SQL

Case Expressions IF ... THEN ... ELSE logic without using procedures in SQL statements.

Function Expressions SQL built-in functions can be used as an expression.

A E i Uses an aggregate function to calculate a single value from the valuesAggregate Expressions Uses an aggregate function to calculate a single value from the values of multiple rows in a column.

Subqueries in expressions SELECT statement enclosed in parentheses.expressions

© 2012 SAP AG. All rights reserved. 204204

Expressions: Examples SAP HANA SQLSAP HANA SQL

Case expressionCase expression You can use IF ... THEN ... ELSE logic without using procedures in SQL statements.

<expression> ::= CASE <expression>

WHEN <expression>

THEN <expression>, ...

[ ELSE <expression>]

{ END | END CASE }

Aggregate Expressions Aggregate Expressions <expression> ::= COUNT(*) | <agg_name> ( [ ALL | DISTINCT ] <expression> ) <agg_name> ::= COUNT

| MIN | MAX | SUM | AVG | STDDEV | VAR

© 2012 SAP AG. All rights reserved. 205

| MIN | MAX | SUM | AVG | STDDEV | VAR

205

SQL statement: Create Table SAP HANA SQLSAP HANA SQL

CREATE [<table_type>] TABLE <table_name> <table_contents_source> ;

table_type ::= COLUMN | ROW | HISTORY COLUMN | GLOBAL TEMPORARY | LOCAL TEMPORARY

table_contents_source ::= ( <table_element>, … )|[ (column_name, ...) ] | [<like_table_clause> | <as_table_subquery>] [ WITH [NO] DATA ] ]

table_element ::= column_definition column_constraint | table_constraint( column_name, ... )

like table clause ::= LIKE like table name_ _ _ _

as_table_subquery ::= AS (<select_query>)

column definition ::= column name data type [<column store data type>] co u _de t o :: co u _ a e data type [ co u sto e data type ][<ddic data type>] [DEFAULT default_value] [GENERATED ALWAYS AS <expression> ]

© 2012 SAP AG. All rights reserved. 206206

Create Table - Table TypesSAP HANA SQLSAP HANA SQL

COLUMN-based storage should be used, if the majorityCOLUMN

COLUMN based storage should be used, if the majority of access is through a large number of tuples but with only a few selected attributes.

ROW ROW-based storage is preferable, if the majority of ROW g p j yaccess involves selecting a few records with all attributes selected.Creates a table with a particular transaction session type

HISTORY COLUMN called HISTORY. Tables with session type HISTORY support time travel; the execution of queries against historic states of the database is possible.T bl d fi i i i l b ll il bl hil d i i ibl

GLOBAL TEMPORARYTable definition is globally available while data is visible only to the current session. The table is truncated at the end of the session.Th t bl d fi iti d d t i i ibl l t th t

LOCAL TEMPORARYThe table definition and data is visible only to the current session. The table is truncated at the end of the session.

© 2012 SAP AG. All rights reserved. 207207

Create Table - ExampleSAP HANA SQLSAP HANA SQL

T bl TTable Type

Table Elements

Column Constraint

Column Definition

Data Type

© 2012 SAP AG. All rights reserved. 208208

SQL statement: Insert SAP HANA SQLSAP HANA SQL

INSERT INTO <table_name> [ ( column_name, ... ) ] _ _{ VALUES (expr, ... ) | <subquery> } ;

© 2012 SAP AG. All rights reserved. 209209

SQL statement: Select SAP HANA SQLSAP HANA SQL

SELECT [TOP number ] [ ALL | DISTINCT ]

<select_list>

<from_clause >

[<where_clause>]

[<group_by_clause>]

[<having_clause>]

[ d b l ][<order_by_clause>]

[<limit_clause>]

[<for update clause>][<for_update_clause>]

[<time_travel_clause>] ;

© 2012 SAP AG. All rights reserved. 210210

SummaryApproaching SAP HANA ModelingApproaching SAP HANA Modeling

You should now be able to:You should now be able to:

Explain the language elements used in SAP HANA SQL statements.Q

© 2012 SAP AG. All rights reserved. 211211

Creating Attribute Views

Unit 4: Advanced Modeling

Creating Restricted & Calculated MeasuresUsing Hierarchies

Using Filter Operations

SAP HANA SQL - Introduction

Using Filter OperationsUsing Variables

SQLScript and ProceduresUsing Currency Conversion

ObjectivesSQLScript and ProceduresSQLScript and Procedures

At the end of this Lesson you will be able to:At the end of this Lesson you will be able to:

• Explain SQLScript and SQLScript extensions• SQLScript implementation logicSQLScript implementation logic• Create and call a Procedure• Explain calculation engine and calculation model

E l i f i li f C l l i i• Explain functionality of Calculation engine operators

© 2012 SAP AG. All rights reserved. 213

OverviewSQLScript and ProcedureSQLScript and Procedure

This module covers the following topics:This module covers the following topics:

• Introduction to SQLScript• Overview of SQLScript ExtensionsOverview of SQLScript Extensions• SQLScript implementation logic• Procedures

I d i l l i i d l l i d l• Introduction to calculation engine and calculation model• Introduction to Calculation engine operators

© 2012 SAP AG. All rights reserved. 214214

SQLScript: ConceptSQLScript and ProceduresSQLScript and Procedures

SQLScript is a collection of extensions to Structured Query Language (SQL) SQLScript is a collection of extensions to Structured Query Language (SQL).

Data Extension Allows the definition of table types without corresponding tablescorresponding tables.

Functional Extension Allows definitions of (side-effect free) functions which can be used to express and encapsulate

l d t flcomplex data flowsProcedural Extension Provides imperative constructs executed in the

context of the database process.

SQLScript allows developer to push data intensive logic into the database.

SQLScript encourages developer to implement algorithms using a set SQLScript encourages developer to implement algorithms using a set-oriented paradigm instead of one tuple at a time paradigm.

SQLScript allows usage of imperative as well as declarative statements.

© 2012 SAP AG. All rights reserved. 215

Q p g p

215

SQLScript: Implementation LogicSQLScript and ProceduresSQLScript and Procedures

SQL Script ClientSQL Script Client

xOrchestration Logic

I ti E t i

x

xImperative Extension x

xDeclarative Logic

x

Functional Extension

© 2012 SAP AG. All rights reserved. 216216

SQLScript: Data Type ExtensionsSQLScript and ProceduresSQLScript and Procedures

Scalar Data Type :Scalar Data Type :

The SQLScript type system is based on the SQL-92 type system and supports following primitive data type:g p yp

TINYINT, SMALLINT, INTEGER, BIGINT

DECIMAL(p, s), REAL, FLOAT, DOUBLE

VARCHAR, NVARCHAR, CLOB, NCLOB

VARBINARY BLOBVARBINARY, BLOB

DATE, TIME, TIMESTAMP

© 2012 SAP AG. All rights reserved. 217217

SQLScript: Data Type ExtensionsSQLScript and ProceduresSQLScript and Procedures

Table Type :Table Type :

SQLScript’s datatype extension also allows the definition of table types. These table types are used to define parameters for a procedure.

A table type is created using the CREATE TYPE and delete using DROP TYPE statement.

Syntax:

CREATE TYPE [schema.]name AS TABLE (name1 type1 [, name2 type2,...])

DROP TYPE [schema.]name [CASCADE]

© 2012 SAP AG. All rights reserved. 218218

SQLScript: Functional ExtensionsSQLScript and ProceduresSQLScript and Procedures

• Functional extension allow to describe complex dataflow logic using p g gside-effect free procedures.

• Procedures can have multiple input parameters and output parameters(which can be of scalar or table types).

• Procedures describe a sequence of data transformations on data d i t d d t b t blpassed as input and database tables.

• Data transformations can be implemented as queries that follow the SAP HANA database SQL syntax by calling other proceduresSAP HANA database SQL syntax by calling other procedures.

• Read-only procedures can only call other read-only procedures.

© 2012 SAP AG. All rights reserved. 219219

SQLScript: ProcedureSQLScript and ProceduresSQLScript and Procedures

• Procedure is a reusable processing block. It is implemented using p g p gSQLScript.

•DROP and CREATE statement is used to modify the definition of a procedure.

• A procedure can be created as read only(without side-effect) or read-write.

• Procedure can be implement using SQLScript, L or R language.

© 2012 SAP AG. All rights reserved. 220220

SQLScript: Procedure Creation using SQL editorSQLScript and ProceduresSQLScript and Procedures

SSyntax:

CREATE PROCEDURE {schema.}name {({IN|OUT|INOUT}{({IN|OUT|INOUT}

param_name data_type {,...})} {LANGUAGE <LANG>} {SQL SECURITY <MODE>} {READS SQL DATA {WITH RESULT VIEW <view name>}} AS{READS SQL DATA {WITH RESULT VIEW <view_name>}} AS

BEGIN ...

ENDEND

READS SQL DATA defines a procedure as read-only.

f f SQ S Implementation LANGUAGE can be specified . Default is SQLScript.

WITH RESULT VIEW is used to create a column view for output parameter of type table which can be used in SQL query

© 2012 SAP AG. All rights reserved. 221

type table which can be used in SQL query.

221

SQLScript: Procedure Creation using WizardSQLScript and ProcedureSQLScript and Procedure

Start Procedure creation wizard from context menu of package.

Provide creation parameter.

Set “Access Mode” for read-only or read-write classification.

Security mode can be select by Security mode can be select by setting the value of attribute “Run With”

© 2012 SAP AG. All rights reserved. 222© 2012 SAP AG. All rights reserved. 222222

SQLScript: Procedure Creation using WizardSQLScript and ProcedureSQLScript and Procedure

Define output and input parameter of procedure.

Write application logic in Script view using SQLScript.

© 2012 SAP AG. All rights reserved. 223© 2012 SAP AG. All rights reserved. 223

SQLScript: Calling a ProcedureSQLScript and ProcedureSQLScript and Procedure

CALL - Procedure Called From ClientCALL Procedure Called From Client A procedure (or table function) can be called by a client on the outer-most level, using any of the supported client interfaces.

SyntaxCALL [schema.]name (param1 [, ...])

For table output parameters it is possible to either pass a table or ‘?’. ‘?’ can be used to represent an empty parameter binding.? can be used to represent an empty parameter binding.

© 2012 SAP AG. All rights reserved. 224224

SQLScript: Calling a ProcedureSQLScript and ProcedureSQLScript and Procedure

CALL...WITH OVERVIEW From ClientCALL...WITH OVERVIEW From Client This CALL statement returns one result set that holds the information of which table contains the result of a particular table’s output variable. This is used to populate an existing table by passing it as parameter.p p g y p g pWhen passing ‘?’ to the output parameters, temporary tables holding the result sets will be generated.

SyntaxCALL [schema.]name (param1 [, ...]) WITH OVERVIEW

© 2012 SAP AG. All rights reserved. 225225

SQLScript: Calling a ProcedureSQLScript and ProcedureSQLScript and Procedure

CALL - Internal Procedure CallCALL Internal Procedure CallFor internal calls, i.e. calls of one procedure by another procedure, IN variables are bound by literals or variable references, new OUT variables are bound to the result of the call.

SyntaxCALL [schema.]name (:in_param1, out_param [, ...])

© 2012 SAP AG. All rights reserved. 226226

Calculation EngineSQLScript and ProceduresSQLScript and Procedures

Calculation engine is the execution engine for SQLScript.Calculation engine is the execution engine for SQLScript.

SQLScript statement are parsed into calculation model as much as possible. The calculation engine instantiates a calculation model at time of query execution.

© 2012 SAP AG. All rights reserved. 227227

Calculation ModelSQLScript and ProceduresSQLScript and Procedures

© 2012 SAP AG. All rights reserved. 228228

Calculation Model ExampleSQLScript and ProceduresSQLScript and Procedures

© 2012 SAP AG. All rights reserved. 229229

SQLScript: Calculation Engine Plan OperatorsSQLScript and ProcedureSQLScript and Procedure

• Calculation engine plan operators encapsulate data-transformationCalculation engine plan operators encapsulate data transformation functionality.

• It is an alternative to using SQL statements as their logic is directly implemented in the calculation engine, i.e. the execution environment of SQLScript.

• Operator has been categorized as Data Source Access and Relational• Operator has been categorized as Data Source Access and Relational.

© 2012 SAP AG. All rights reserved. 230230

SQLScript: Data Source Access OperatorsSQLScript and ProcedureSQLScript and Procedure

CE_COLUMN_TABLE ("table_name"{, ["attrib_name", ...]})

Example:

ot_books1 = CE_COLUMN_TABLE("BOOKS"); ot books2 = CE COLUMN TABLE("BOOKS" ["TITLE" "PRICE" "CRCY"]);ot_books2 = CE_COLUMN_TABLE( BOOKS ,[ TITLE , PRICE , CRCY ]);

This example only works on a column table and does not invoke the SQL processor. It is semantically equivalent to the following:

ot_books3 = SELECT * FROM books;ot_books4 = SELECT title, price, crcy FROM books;

© 2012 SAP AG. All rights reserved. 231231

SQLScript: Data Source Access OperatorsSQLScript and ProcedureSQLScript and Procedure

CE_JOIN_VIEW("join_view_name"{, ["attrib_name", ...]})

Example:

out = CE_JOIN_VIEW("PRODUCT_SALES",

["PRODUCT_KEY", "PRODUCT_TEXT", "SALES"]);

Retrieves the attributes PRODUCT_KEY, PRODUCT_TEXT, and SALES from the join i PRODUCT SALES I i i l h f ll i SQLview PRODUCT_SALES. It is equivalent to the following SQL:

out = SELECT product key, product text, sales FROM product sales;p _ y p _ p _

© 2012 SAP AG. All rights reserved. 232232

SQLScript: Data Source Access OperatorsSQLScript and ProcedureSQLScript and Procedure

CE_OLAP_VIEW("OLAP_view_name"{, ["DIM", "KEY_FIG", ... ]})

Example:

out = CE_OLAP_VIEW("OLAP_view", ["DIM1", "KF"]);

Is equivalent to the following SQL:

l di 1 (kf) i di 1out = select dim1, SUM(kf) FROM OLAP_view GROUP BY dim1;

© 2012 SAP AG. All rights reserved. 233233

SQLScript: Data Source Access OperatorsSQLScript and ProcedureSQLScript and Procedure

CE_CALC_VIEW ("CALC_VIEW_NAME"{, ["attrib_name", ...]})

Example:

out = CE_CALC_VIEW("_SYS_SS_CE_TESTCECTABLE_RET", ["CID" "CNAME"]);[ CID , CNAME ]);

Semantically equivalent to the following SQL:

out = SELECT cid, cname FROM "_SYS_SS_CE_TESTCECTABLE_RET";

© 2012 SAP AG. All rights reserved. 234234

SQLScript: Relational OperatorsSQLScript and Procedure

CE JOIN (:var1 table :var2 table [join attr ]{ [attrib name ]})

SQLScript and Procedure

CE_JOIN (:var1_table, :var2_table, [join_attr, ...]{, [attrib_name , ...]})

Example:

ot_pubs_books1 = CE_JOIN (:lt_pubs, :it_books,["PUBLISHER"]); ot_pubs_books2 = CE_JOIN (:lt_pubs, :it_books,["PUBLISHER"],

["TITLE","NAME","PUBLISHER","YEAR"]);

This example is semantically equivalent to the following SQL but does not invoke the SQL processor.

t b b k 3 SELECT P bli h AS bli h t tot_pubs_books3 = SELECT P.publisher AS publisher, name, street, post_code, city, country, isbn, title, edition, year, price, crcy

FROM :lt pubs AS P, :it books AS B _p , _WHERE P.publisher = B.publisher;

ot_pubs_books4 = SELECT title, name, P.publisher AS publisher, year FROM :lt pubs AS P :it books AS B

© 2012 SAP AG. All rights reserved. 235

FROM :lt_pubs AS P, :it_books AS B WHERE P.publisher = B.publisher;

235

SQLScript: Relational OperatorsSQLScript and ProcedureSQLScript and Procedure

CE_PROJECTION (:var_table, [param_name [AS new_param_name],...]{,[Filter]})

Example:

ot_books1 = CE_PROJECTION (:it_books,["TITLE","PRICE", _ _ _"CRCY" AS "CURRENCY"], '"PRICE" > 50');

Semantically equivalent to the following SQL:.

ot_books2= SELECT title, price, crcy AS currency FROM :it_books WHERE price > 50;

© 2012 SAP AG. All rights reserved. 236236

SQLScript: Relational OperatorsSQLScript and ProcedureSQLScript and Procedure

CE_CALC ('<expr>', <result type>)

Example:

with tax = CE PROJECTION(:product, ["CID", "CNAME", "OID", "SALES", _ _ ( p , [ , , , ,CE_CALC('"SALES" * :vat_rate', decimal(10,2)) AS "SALES_VAT"],

'"CNAME" = :cname');'"CNAME" = :cname');

Notice, that all columns used in the CE_CALC have to be included in the projection list.

© 2012 SAP AG. All rights reserved. 237237

SQLScript: Relational OperatorsSQLScript and ProcedureSQLScript and Procedure

CE_AGGREGATION (:var_table, [aggregate ("column") {AS "renamed_col"}] {,["column", ...]});

Example:

ot books1 = CE AGGREGATION (:it books, _ _ ( _ ,[COUNT ("PUBLISHER") AS "CNT"], ["YEAR"]);

Semantically equivalent to the following SQL:Semantically equivalent to the following SQL:

ot_books2 = SELECT COUNT (publisher) AS cnt, year FROM :it_books GROUP BY year;

© 2012 SAP AG. All rights reserved. 238238

SQLScript: Relational OperatorsSQLScript and ProcedureSQLScript and Procedure

CE_UNION_ALL (:var_table1, :var_table2)

Example:

ot all books1 = CE UNION ALL (:lt books, :it audiobooks); _ _ _ _ ( _ , _ );

Semantically equivalent to the following SQL:

ot_all_books2 = SELECT * FROM :lt_booksUNION ALL SELECT * FROM :it_audiobooks;

© 2012 SAP AG. All rights reserved. 239239

SQLScript: Control statementSQLScript and ProcedureSQLScript and Procedure

IF <bool-expr1>

THEN Example:

SELECT count(*) INTO found

{then-stmts1}

{ELSEIF <bool-expr2>

FROM books WHERE isbn = :v_isbn;

IF :found IS NULL THEN

THEN

{then-stmts2}}

CALL ins_msg_proc('result of count(*) cannot be NULL');

ELSE{ }}

{ELSE

{else stmts3}}

ELSE

CALL ins_msg_proc('result of count(*) not NULL - as e pected'){else-stmts3}}

END IF

expected');

END IF;

© 2012 SAP AG. All rights reserved. 240240

SQLScript: Control statementSQLScript and ProcedureSQLScript and Procedure

WHILE <bool-stmt> DO

{stmts} { }

END WHILE

FOR <loop-var> IN {REVERSE} <start> .. <end> DO

{stmts}

END FOREND FOR

© 2012 SAP AG. All rights reserved. 241241

SQLScript: Dynamic SQLSQLScript and ProcedureSQLScript and Procedure

EXEC '<sql-statement>'

• Dynamic SQL statement is used to construct SQL statements at runtime in a procedure.p

• Dynamic SQL allows to use variables where they might not be supported in SQLScript. It provides more flexibility in creating SQL statements.

• Optimization of dynamic SQL statement is limited.

• It is not possible to bind result of a dynamic SQL statement to a SQLScript p y pvariable.

• Dynamic SQL is prone to SQL injection.

• EXEC '<sql-statement>‘ is used to construct dynamic SQL.

© 2012 SAP AG. All rights reserved. 242242

SummaryApproaching SAP HANA ModelingApproaching SAP HANA Modeling

You should now be able to:You should now be able to:

• Explain SQLScript and SQLScript extensions

SQLS i t i l t ti l i• SQLScript implementation logic

• Create and call Procedure

• Explain calculation engine and calculation model

• Explain functionality of Calculation engine operators

© 2012 SAP AG. All rights reserved. 243243

Creating Attribute Views

Unit 4: Advanced Modeling

Creating Restricted & Calculated MeasuresUsing Hierarchies

Using Filter Operations

SAP HANA SQL - Introduction

Using Filter OperationsUsing Variables

SQLScript and Procedures

Using Currency Conversion

ObjectivesUsing Currency ConversionUsing Currency Conversion

At the end of this Lesson you will be able to:At the end of this Lesson you will be able to:

• Understand Currency Conversion in SAP HANA• Apply Currency Conversion in Analytic ViewsApply Currency Conversion in Analytic Views• Leverage Fixed Currencies• Leverage Source Currency from Attributes

C t T t C V i bl• Create Target Currency Variables• Use Currency conversion in Calculation Views

© 2012 SAP AG. All rights reserved. 245

OverviewUsing Currency ConversionUsing Currency Conversion

This module covers the following topics:This module covers the following topics:

Currency Conversion in SAP HANA Currency Conversion in Analytic ViewsCurrency Conversion in Analytic Views Using Fixed Currencies Using Source Currency from Attributes

C ti T t C V i bl Creating Target Currency Variables Currency Conversion in Calculation Views

© 2012 SAP AG. All rights reserved. 246246

Currency ConversionUsing Currency ConversionUsing Currency Conversion

As most frontend tools do not allow defining or switching reporting currency in the UI, and as there might not be such information in master data,

h t t th iblwe have to convert the possibly many monetary document currencies into just a few.

SAP HANA has the necessary functions needed to achieve currency conversion during data modeling.conversion during data modeling.

© 2012 SAP AG. All rights reserved. 247247

Currency ConversionUsing Currency ConversionUsing Currency Conversion

As currency exchange rates fluctuate constantly in the global markets, when converting it is necessary not only to define the source and target currencies

h ti b t l t d fi thwhen converting, but also to define the time when currency conversion should take place. Examples could be:

Billing Date

Posting Date

Financial Year End

Today’s DateToday s Date

© 2012 SAP AG. All rights reserved. 248248

Currency Conversion in SAP HANAUsing Currency ConversionUsing Currency Conversion

The preferred way to define currency conversion for measures is to model in an Analytic View.

© 2012 SAP AG. All rights reserved. 249249

Currency Conversion in SAP HANAUsing Currency ConversionUsing Currency Conversion

But still, sometimes due to the constraints in the master data, or because of the complexity of the reporting requirements, it might be necessary to model the conversion within a Calculation View.

© 2012 SAP AG. All rights reserved. 250250

Currency Conversion in SAP HANAUsing Currency ConversionUsing Currency Conversion

The following standard SAP tables need to be included in the SYSTEM schema or other specified schema, as they are used for currency conversion.

What we need are some of the TCUR* tables. They must be replicated so that the conversions are working correctly

Table Name Description

conversions are working correctly.

TCURR Exchange Rates

TCURV Exchange rate types for currency translation

TCURF Conversion Factors

TCURN Quotations

TCURX Currency Decimals

© 2012 SAP AG. All rights reserved. 251251

Currency Conversion in Analytic Views Using Currency ConversionUsing Currency Conversion

Process Flow - Currency Conversion in Analytic Views

Create a Measure Select Target

Currency

Select Date of Conversion and Exchange Type•Date of Conversion will use the exchange rate of the d fi d d•Define it as

Measure Type: “Amount with Currency”

Currency•This is the currency we want to convert to.

defined date.•Exchange Type is the type of exchange rate we want to use.

Enable for Conversion Define Source Currency

•This is option gives us the possibility to convert the currency.

•This is the currency we want to convert from.

• It is the currency type that our measure is stored in.

© 2012 SAP AG. All rights reserved. 252© 2012 SAP AG. All rights reserved. 252

Currency Conversion in Analytic ViewsUsing Currency ConversionUsing Currency Conversion

Analytic ViewA measure in an Analytic

Analytic ViewView can be defined with the Measure Type:

“Amount with Currency”Amount with Currency

This is the necessary Measure Type for the ypmethod.

Date of

Create a Measure

Enable for

Target Curren

cy

Source Currency

Conversion and Exchange

Type

© 2012 SAP AG. All rights reserved. 253© 2012 SAP AG. All rights reserved.

for Conver

sion

Currency

253

Currency Conversion in Analytic ViewsUsing Currency ConversionUsing Currency Conversion

Enabling the Measure for conversion releases further options in the Measure definition in

d t l t thorder to complete the conversion as required.

Date of

Create a Measure

Enable for

Target Curren

cy

Source Currency

Conversion and Exchange

Type

© 2012 SAP AG. All rights reserved. 254© 2012 SAP AG. All rights reserved.

for Conver

sion

Currency

254

Currency Conversion in Analytic ViewsUsing Currency ConversionUsing Currency Conversion

Selecting the Currency brings up the Currency Dialog where the Target Currency can be defined.

A Fixed Currency will convert the Source Currency into a singleCurrency into a single currency.

Date of

We also have the option of creating the Target Currency not based on a Fixed Currency, but rather based on an Attribute or Variable

Create a Measure

Enable for

Target Curren

cy

Source Currency

Conversion and Exchange

Type

rather based on an Attribute or Variable.

© 2012 SAP AG. All rights reserved. 255© 2012 SAP AG. All rights reserved.

for Conver

sion

Currency

255

Currency Conversion in Analytic ViewsUsing Currency ConversionUsing Currency Conversion

Clicking on the Source Currency, once again brings up the Currency Dialog, this time to set th S Cthe Source Currency.

Date of

If we know the base Currency we can set it as a Fixed Type. If it varies we can set it as an Attribute type and it will change based on an

Create a Measure

Enable for

Target Curren

cy

Source Currency

Conversion and Exchange

Type

Attribute type and it will change based on an Attribute.

© 2012 SAP AG. All rights reserved. 256© 2012 SAP AG. All rights reserved.

for Conver

sion

Currency

256

Currency Conversion in Analytic ViewsUsing Currency ConversionUsing Currency Conversion

The Exchange Type is the type of Exchange Rate we want to use, as supplied from our SAP TCUR* base tables.

The Date Mapping defines the date when we want the currency conversion to occurcurrency conversion to occur, based on either a Fixed date, an Attribute or a Variable.

Date of

Create a Measure

Enable for

Target Curren

cy

Source Currency

Conversion and Exchange

Type

© 2012 SAP AG. All rights reserved. 257© 2012 SAP AG. All rights reserved.

for Conver

sion

Currency

257

Leverage Fixed CurrenciesUsing Currency ConversionUsing Currency Conversion

When the source, target or both the source and target currencies are known, it is beneficial to set the currency of either or both types to “Fixed”.

Using this method all lines for the measure in the Analytic View will be converted using the same currencyconverted using the same currency.

Sales Order

Amount GBP

Sales Order

Amount USD

001 £2 500002 £10 000003 £3 000004 £1 650

001 $3 250002 $13 000003 $3 900004 $2 145

© 2012 SAP AG. All rights reserved. 258258

Leverage Fixed CurrenciesUsing Currency ConversionUsing Currency Conversion

To achieve a conversion using fixed currencies we set the Currency Type as “Fixed” and define the currencies to th i t dthe appropriate source and target currencies.

This way we achieve a one-This way we achieve a one-to-one conversion.

© 2012 SAP AG. All rights reserved. 259© 2012 SAP AG. All rights reserved. 259

Leverage Source Currency from AttributeUsing Currency ConversionUsing Currency Conversion

There can sometimes be instances of master data where the base currencies vary across the table.

Sales Order Currency Amount

On one line you might find for example a sales order with a value in Euro, on another line you might find a different

001 EUR € 2 500

another line you might find a different value expressed in Japanese Yen etc.

Summing up these different currencies

002 JPY ¥100 000

003 CHF CHF 3 000Su g up t ese d e e t cu e c eswould give us a useless value. 004 SEK 165 000 kr

© 2012 SAP AG. All rights reserved. 260260

Leverage Source Currency from AttributeUsing Currency ConversionUsing Currency Conversion

With multiple currencies in the master data we are not able to set the source t i l fi d tcurrency to a single fixed type.

Instead, in order to convert the currency, we will need to define the source currency based on an attribute in the master datacurrency based on an attribute in the master data

Source Currency Attribute

Sales Order

Amount USD

001 $3 250002 $13 000

Sales Order Currency Amount

001 EUR € 2 500002 JPY ¥100 000 002 $13 000

003 $3 900004 $2 145

002 JPY ¥100 000003 CHF CHF 3 000004 SEK 165 000 kr

© 2012 SAP AG. All rights reserved. 261261

Leverage Source Currency from AttributeUsing Currency ConversionUsing Currency Conversion

When using an Attribute Type to define the Source Currency we set the attribute that contains the currency code to be used for the conversion to the target currency.

This way SAP HANA knows which currency exchange rate to use for eachThis way SAP HANA knows which currency exchange rate to use for each individual line.

© 2012 SAP AG. All rights reserved. 262© 2012 SAP AG. All rights reserved. 262

Use Currency Conversion in Analytic ViewsUsing Currency ConversionUsing Currency Conversion

SAP HANA includes some further functionality to ease currency conversion.

Enable for decimal shifts

This option is to be used when you want to shift the decimal separator to the appropriate place according to the currencyappropriate place according to the currency exchange rate data available in the master data tables.

Upon Conversion Failure

This selection gives you the opportunity to define how SAP HANA should deal withdefine how SAP HANA should deal with conversion failures. You can opt to either:

Fail / Set to NULL / Ignore

© 2012 SAP AG. All rights reserved. 263© 2012 SAP AG. All rights reserved.

Fail / Set to NULL / Ignore

263

Use Currency Conversion in Analytic ViewsUsing Currency ConversionUsing Currency Conversion

To summarize currency conversion in Analytic views, you can set:

Decimal Shift – Yes/No

Target Currency – Fixed or Attribute Based

Source Currency – Fixed or Attribute Based

Exchange Type – When you have multiple Exchange Rates, you specify the one to use

Exchange Date – The date when conversion should be performed

Upon Conversion Failure: Fail/Set to NULL/Ignore

© 2012 SAP AG. All rights reserved. 264© 2012 SAP AG. All rights reserved. 264

Use Currency Conversion in Analytic ViewsUsing Currency ConversionUsing Currency Conversion

There can however be circumstances where theThere can however be circumstances where the Target Currency options “Fixed” or “Attribute”-based are not sufficient.

You might instead want the option to let the reporting user choose the currency that the measure should be displayed in.

This will be dealt with in the following topic, “Create Target Currency Variable”.

© 2012 SAP AG. All rights reserved. 265265

Create Target Currency VariableUsing Currency ConversionUsing Currency Conversion

To enable a prompt where the reporting user can specify the target currency of the measure, we first need to create a new Variable.

The Variable should be defined as:

Type: Currencyyp y

Data Type: VARCHAR, Length: 5

© 2012 SAP AG. All rights reserved. 266© 2012 SAP AG. All rights reserved. 266

Create Target Currency VariableUsing Currency ConversionUsing Currency Conversion

After the variable has been defined, you can then set the Target Currency to be expressed not as a Fixed or Attribute Type, but rather as a Variable.

The variable created can then be selected as the Currency Type.

© 2012 SAP AG. All rights reserved. 267© 2012 SAP AG. All rights reserved. 267

Create Target Currency VariableUsing Currency ConversionUsing Currency Conversion

When you later view the data in the Analytic View, you get the option of choosing the measure target currency based on the variable that you have created.

© 2012 SAP AG. All rights reserved. 268© 2012 SAP AG. All rights reserved. 268

Use Currency conversion in Calculation ViewsUsing Currency ConversionUsing Currency Conversion

Calculation ViewIt is also possible to perform currency conversions in a Calculation View.

The method used to convert currencies differs from how it is done in Analyticdiffers from how it is done in Analytic Views.

Rather than defining the conversion grules graphically as done in the Analytic Views, the definitions will need to be written by the modeler.

© 2012 SAP AG. All rights reserved. 269269

Use Currency conversion in Calculation ViewsUsing Currency ConversionUsing Currency Conversion

The function we want to use to perform currency conversion in Calculation Views is called CE_CONVERSION.

When calling CE_CONVERSION you specify the input table (in most cases an Analytic view) and then define how you want the currency conversionan Analytic view), and then define how you want the currency conversion done.

© 2012 SAP AG. All rights reserved. 270270

Use Currency conversion in Calculation ViewsUsing Currency ConversionUsing Currency Conversion

The different argument definitions necessary when using CE_CONVERSION

Key Values Default Meaning

are similar to what needs to be defined when performing currency conversions graphically in an Analytic View.

y g

'error_ handling' 'fail on error', 'set to null', 'keep unconverted'

'fail on error' describe reaction if a rate could not be determined for a row

'client' any none define the client number used for currency conversion

'family' 'currency' 'unit' none describe the family of the conversion to be usedfamily currency , unit none describe the family of the conversion to be used

'method' 'ERP' none describe the conversion method to be used

'conversion_type' any none define the type of exchange rate used for currency conversion

'source unit' any none define the default source unit for any kind of conversionsou ce_u a y o e de e e de au sou ce u o a y d o co e s o

'target_unit' any none define the default target unit for any kind of conversion

'reference _date' any none define the default reference date for any kind of conversion

'schema' any current h

define the default schema in which the conversion tables should be l k dschema any schema looked up

'output'

combinations of 'input', 'unconverted', 'converted', 'passed_through', 'output_unit', 'source_unit', 't t it' ' f d t '

'converted, passed _through, output unit'

define which attributes should be included in the output

© 2012 SAP AG. All rights reserved. 271

'target_unit', 'reference_date' ou pu _u

Please note the above is not a complete list, there are further optional arguments if required. See SAP HANA reference manual.

271

Use Currency conversion in Calculation ViewsUsing Currency ConversionUsing Currency Conversion

A simple Calculation View with pthe sole purpose of converting a measurement into a different currency could be written in three steps:

Define the input table

Perform the Conversion using the CE_CONVERSION function

Please note the above is pseudo-code and does not run unmodified.

function

Project the results

© 2012 SAP AG. All rights reserved. 272272

ObjectivesUsing Currency ConversionUsing Currency Conversion

You should now be able to:You should now be able to:

• Understand Currency Conversion in SAP HANA• Apply Currency Conversion in Analytic Views• Apply Currency Conversion in Analytic Views• Leverage Fixed Currencies• Leverage Source Currency from Attributes

Create Target Currency Variables• Create Target Currency Variables• Use Currency conversion in Calculation Views

© 2012 SAP AG. All rights reserved. 273273

Unit 5:Processing Information ModelsProcessing Information Models

ObjectivesUnit 5 Processing Information ObjectsUnit 5 – Processing Information Objects

At the end of this Lesson you will be able to:At the end of this Lesson you will be able to:

• Explain how to validate models• Explain how to compare versions of information objectsExplain how to compare versions of information objects• Explain how to check model references• Explain how to generate auto documentation

© 2012 SAP AG. All rights reserved. 275

OverviewProcessing Information ObjectsProcessing Information Objects

This module covers the following topics:This module covers the following topics:

• Validating Models• Comparing Versions of Information ObjectsComparing Versions of Information Objects• Checking Model References• Generating: Auto Documentation

© 2012 SAP AG. All rights reserved. 276

Model Validation Processing Information ObjectsProcessing Information Objects

Set preferences for validation rulesSet preferences for validation rules

Create Data Model

Attribute Views

Create Data Model

Attribute Views Validate Data Validate Data Activate Data Activate Data Analytical Views

Calculation Views

Analytical Views

Calculation Views

ModelModel ModelModel

© 2012 SAP AG. All rights reserved. 277

Set Preferences for Validation Rules Processing Information ObjectsProcessing Information Objects

In the SAP HANA STUDIO, go to “Windows” -> “Preferences” , g

And then select “Modeler” -> “Validation Rules”

© 2012 SAP AG. All rights reserved. 278

Set Preferences for Validation Rules Processing Information ObjectsProcessing Information Objects

You can select precisely which rules are applied during

At any moment, you can restore default settings.

the validation of the Information Objects

© 2012 SAP AG. All rights reserved. 279

Execute Validation RulesProcessing Information ObjectsProcessing Information Objects

To validate Information Objects, you can use the button “Validate” or right click directly on the object.

You can also select several

Information Objects.

© 2012 SAP AG. All rights reserved. 280

Execute Validation RulesProcessing Information ObjectsProcessing Information Objects

In Job Log, in menu “Current”, you can see the job detail by double clicking on it.

In menu “History” all job logsIn menu History , all job logs appear for a period set in “Preferences”.

© 2012 SAP AG. All rights reserved. 281

Object VersionsProcessing Information ObjectsProcessing Information Objects

View Inactive

View Inactive

View ActiveView

ActiveView

InactiveView

InactiveView

ActiveView

Activeact eact e ActiveActive InactiveInactive ActiveActive

Validation, Save and Activation

Validation, Save and Activation

Modification and Save

Creation of the view the

and Activation and Activation and Save

Activation of the view

Modification of the view

Activation of the viewthe view, the

view is inactive

of the view, the view is

active

of the view, the view is

inactive

of the view, the view is

active

© 2012 SAP AG. All rights reserved. 282

Object Versions – Comparing versionsProcessing Information ObjectsProcessing Information Objects

View Inactive

View Inactive

View ActiveView

Active

Modification of the View Active by Adding fields

© 2012 SAP AG. All rights reserved. 283

Object Versions – View Version HistoryProcessing Information ObjectsProcessing Information Objects

Only Active Versions are displayed.

Name of the user activating the view ActivationName of the user activating the view, Activation Date and Period from the last activation are

available in Version History

© 2012 SAP AG. All rights reserved. 284

References- Checking Model References Processing Information ObjectsProcessing Information Objects

In the modeler, it is possible to , pcheck where are used different Information objects in the schema. This function could be very helpful to study the impacts of changes in the data model.Select an object, do a right click j , gand select « Where Used » function.

© 2012 SAP AG. All rights reserved. 285

References- Checking Model References Processing Information ObjectsProcessing Information Objects

In the « Where-Used List », the number ,of usages of the object is available. Thereby, « Type », « Name » and « Package » of each object which are« Package » of each object which are currently used for the selected object are displayed.

© 2012 SAP AG. All rights reserved. 286

Auto DocumentationProcessing Information ObjectsProcessing Information Objects

It is possible to generate automatically documentation about the data model in p g yHANA. These documents could provide a list of all objects containing in a package or details on previous selected objects.

You can generate Auto Documentation with a right click on an Information Objects or directly with the button below.

© 2012 SAP AG. All rights reserved. 287

Auto Documentation – Select Document TypeProcessing Information ObjectsProcessing Information Objects

Two document types are ypavailable :

Model Details (display each ti l it f I f tiparticularity of an Information

Objects)

Model List (display a list of Model List (display a list of each component of the package)

© 2012 SAP AG. All rights reserved. 288

Auto Documentation – Add Objects to Target List Processing Information ObjectsProcessing Information Objects

All Information Objects jin the Content are available.

Y h t l tYou have to select one or several objects and use the “Add” button.

Use the button “Remove” to cancel the selection.the selection.

You can add objects from different packages in the same generated document.

© 2012 SAP AG. All rights reserved. 289

Auto Documentation –Select Export Type & Save to LocationProcessing Information Objects

Unfortunately, it is not y,possible yet to change the export file type. Only .pdf type is supported for the moment.

Then choose anThen, choose an target emplacement to save the generated documentsdocuments.

© 2012 SAP AG. All rights reserved. 290

SummaryProcessing Information ObjectsProcessing Information Objects

You should now be able to:You should now be able to:

• Explain how to validate models• Explain how to compare versions of information objectsExplain how to compare versions of information objects• Explain how to check model references• Explain how to generate auto documentation

© 2012 SAP AG. All rights reserved. 291

U it 6Unit 6: Managing Modeling ContentManaging Modeling Content

ObjectivesManaging Modeling ContentManaging Modeling Content

At the end of this Lesson you will be able to:At the end of this Lesson you will be able to:

• Explain how to manage schemas• Explain how to import and export data modelsExplain how to import and export data models• Explain how to copy information objects

© 2012 SAP AG. All rights reserved. 293

OverviewManaging Modeling ContentManaging Modeling Content

This module covers the following topics:This module covers the following topics:

• Schemas• Import & ExportImport & Export • Copying Objects

© 2012 SAP AG. All rights reserved. 294

Schemas – Creating SchemasManaging Modeling ContentManaging Modeling Content

You create schemas to group the tables. For import you need to create g p p ythe schema where all the tables are imported.

Schemas are created with a SQL Script statement.

SQL Syntax : CREATE SCHEMA schema_name [OWNED BY name]

Parameters : OWNED BY Specifies the name of the schema owner.p

Description : The CREATE SCHEMA statement creates a schema in the current database.

© 2012 SAP AG. All rights reserved. 295

Schemas – Managing Schemas MappingManaging Modeling ContentManaging Modeling Content

You use this procedure to map the logical schemas with the physical schemas p p g p ywhile transferring information objects from a source system to target in case of SAP shipped content.

Y d fi diff t h i i th tiYou can define different schema mappings in the same time.

© 2012 SAP AG. All rights reserved. 296

Schemas – Managing Schemas MappingManaging Modeling ContentManaging Modeling Content

Import TABLE1 into Export TABLE1 pSYSTEM S2 and modify SCHEMA_S1 into SCHEMA_S2

pfrom SYSTEM S1 with SCHEMA_S1

SYSTEM S2SYSTEM S1

SCHEMA_S1.TABLE1 SCHEMA_S1.TABLE1

SYSTEM S2

SCHEMA_S2.TABLE1

© 2012 SAP AG. All rights reserved. 297

Import & ExportManaging Modeling ContentManaging Modeling Content

You can import models from your local system or from a server.p y y

Procedure :

Creating Delivery

Unit

Exporting Models (Server)

Importing Models (Server)

SYSTEM S1

SYSTEM S2

Exporting Models (Client)

Importing Models (Client)(Client) (Client)

© 2012 SAP AG. All rights reserved. 298

Import & Export – Create Delivery UnitManaging Modeling ContentManaging Modeling Content

You use a Delivery Unit to create a group of transportable objects for content

From the Quick Launch

y g p p jdelivery and to export information models from source system to target server.

From the Quick Launch tab page, choose « Delivery Units.. » and follow the steps given p gbelow.

© 2012 SAP AG. All rights reserved. 299

Import & Export – Create Delivery UnitManaging Modeling ContentManaging Modeling Content

From the Delivery Units dialog box choosedialog box, choose create.

You need to associate packages with delivery units This is requiredunits. This is required when you export models.

© 2012 SAP AG. All rights reserved. 300

Import & Export – Create Delivery UnitManaging Modeling ContentManaging Modeling Content

Enter the delivery unit name.y

Enter the responsible user.

In the Version field enter the deliveryIn the Version field, enter the delivery unit version.

Enter the support package version of pp p gthe delivery unit.

Enter the patch version of the d li itdelivery unit.

© 2012 SAP AG. All rights reserved. 301

Import & Export – Export Model to ServerManaging Modeling ContentManaging Modeling Content

You use this procedure to pexport models that use content delivered by SAP. A user with an administratorrole can also export models for user-defined content.

Prerequisites :Y h t dYou have created a delivery unit.

© 2012 SAP AG. All rights reserved. 302

Import & Export – Export Model to ServerManaging Modeling ContentManaging Modeling Content

Select the system and click on “Next” ybutton.

Select the delivery unit.

Then choose the package containing models you want to export on the server and click on “Finish” button.

© 2012 SAP AG. All rights reserved. 303

Import & Export – Import Models from ServerManaging Modeling ContentManaging Modeling Content

You use this procedure to pimport models that use content delivered by SAP.

A user with an administrator role can also import models for user-defined content.

Prerequisites :Y h t d d lYou have exported models to a target server.

© 2012 SAP AG. All rights reserved. 304

Import & Export – Import Models from ServerManaging Modeling ContentManaging Modeling Content

Select the systemSelect the system.

Select the file repository on the server where models have been exportedmodels have been exported.

Then select models you want to import.

Define parameters as “Overwritten inactive versions” and “Activate objects” and then click on “Finish” button

© 2012 SAP AG. All rights reserved. 305

click on Finish button

Import & Export – Export Models to ClientManaging Modeling ContentManaging Modeling Content

You use this procedure to pexport models that use user-defined content.

© 2012 SAP AG. All rights reserved. 306

Import & Export – Export Models to ClientManaging Modeling ContentManaging Modeling Content

Select the system and click on “Next” button.

Then choose the package or models you want to export,

l t t t it dselect a target repository and click on “Finish” button.

© 2012 SAP AG. All rights reserved. 307

Import & Export – Import Models from ClientManaging Modeling ContentManaging Modeling Content

You use this procedure to pimport models that use user-defined content.

Prerequisites : You have exported the information models.

© 2012 SAP AG. All rights reserved. 308

Import & Export – Import Models from ClientManaging Modeling ContentManaging Modeling Content

Select the system andSelect the system and click on “Next” button.

Then define the folderThen define the folder location and select the package or models you want to export.a o e po

Then select a target repository and click on

© 2012 SAP AG. All rights reserved. 309

p y“Finish” button.

Copying Information ObjectsManaging Modeling ContentManaging Modeling Content

Select the system and click on “Next” button.

Then define the folder location and select the package or models you want p g yto export.

Then select a target repository and click on “Finish” button.

© 2012 SAP AG. All rights reserved. 310

Copying Content Delivered by SAPManaging Modeling ContentManaging Modeling Content

You use this procedure to copy standard content shipped byYou use this procedure to copy standard content shipped by SAP or an SAP partner to your local repository (see note 1608552 for implementing RDS content).

Prerequisite:To copy the contents of objects, the administrator needs to create a mapping in thecreate a mapping in the_SYS_BI.M_CONTENT_MAPPING table.

Procedure:1. From the Quick Launch tab page, choose Mass Copy.2. Select the required object(s).3. Choose Add.4. Choose Next.Copy checkbox.5. Choose Finish.

© 2012 SAP AG. All rights reserved. 311

The status of content copy can be viewed in Job log.

SummaryManaging Modeling ContentManaging Modeling Content

You should now be able to:You should now be able to:

• Explain how to manage schemas• Explain how to import and export data modelExplain how to import and export data model• Explain how to copy information objects

© 2012 SAP AG. All rights reserved. 312

User Management & Security

Unit 7: Security and Authorizations

Template Roles Types of Privileges

AdministrativeAdministrative

ObjectivesUser Management & SecurityUser Management & Security

At the end of this Lesson you will be able to:At the end of this Lesson you will be able to:

• Explain How To Handle User Management And User Provisioning,• Explain The Authentication Methods,p ,• Explain User and Role Concept in SAP HANA,• Explain How To Maintain User’s Roles,• Explain How To Maintain SAP HANA Privileges.Explain How To Maintain SAP HANA Privileges.

© 2012 SAP AG. All rights reserved. 314

OverviewUser Management & SecurityUser Management & Security

This module covers the following topics:This module covers the following topics:

• User and Role Concept,• User and Role Creation,,• Manage User or Role,• Grant and Revoke User or Role,• Assign Privilege to User or Role.Assign Privilege to User or Role.

© 2012 SAP AG. All rights reserved. 315

User Management and Security in SAP HANAUser Management & SecurityUser Management & Security

C UCreate UsersAssign Initial PasswordsImportant User p

Parameters

Manage UsersLock UsersAssign Security Lock UsersReset PasswordsCheck User Privileges

g yControl Access to ObjectsRow-Level SecurityRestrict allowed actions Integration with BIRestrict allowed actions

© 2012 SAP AG. All rights reserved. 316

Relationships Between Entities User Management & SecurityUser Management & Security

The relevant entities mentioned below relate to each other in the following way:

• A principal is either a role or a user. • A known user can log on to the database. A user

can be the owner of database objectscan be the owner of database objects.• A role is a collection of privileges and can be

granted to either a user or another role (nesting). • A privilege is used to impose restrictions on

operations carried out on certain objects

© 2012 SAP AG. All rights reserved. 317

User management is configured using SAP HANA studio.

User Provisioning - Get Users into the SystemUser Management & SecurityUser Management & Security

Roles allow grouping privileges• Create roles for specific tasks, e.g. Create data models (on a given subset

of the data) Activate data models Consume models

• All types of privileges can be granted to a role Individual privileges Roles ( create a hierarchy of roles)

Roles / privileges can be assigned to users Package:

create / editPackage:

create / edit SQL:selectSQL:select

Package:activate

Package:activate

SQL:writeSQL:write

• User / Role management are closely related Reflected in almost identical editor

modelsmodels selectselect activateactivateruntimeobject

runtimeobject

© 2012 SAP AG. All rights reserved. 318

User Provisioning - User and Role ConceptUser Management & SecurityUser Management & Security

Creating Named Users in SAP gHANA• Actual Database Users Create via SAP HANA StudioCreate via SAP HANA Studio Or using standard SQL

statements

Authentication Methods• User / Password Set up and manage passwords p g p

using SAP HANA Studio or SQL

• Kerberos Authentication Certificate-based Requires Named User in SAP

HANA DB

© 2012 SAP AG. All rights reserved. 319

Authentication conceptUser Management & SecurityUser Management & Security

SAP HANA database provides the following p goptions for authentication:• Direct logon to the SAP HANA database with

user name and passworduser name and password• Kerberos (third-party authentication provider) for

SSO Environment

For more administrative operations :• Such as database recovery, the credentials of

the SAP operating system user (<sapsid>adm)the SAP operating system user (<sapsid>adm) are also required.

I t ti i t Si l Si O E i tIntegration into Single Sign-On Environments SAP HANA supports the Kerberos protocol for single sign-on. It has been tested with Windows Active Directory Domain Kerberos implementation and MIT Kerberos network authentication protocol. The ODBC database client and the JDBC database client support

© 2012 SAP AG. All rights reserved. 320

authentication protocol. The ODBC database client and the JDBC database client support Kerberos.

Managing Users and RolesUser Management & SecurityUser Management & Security

DefineDefine and

Create Roles

Create Users

Assign P i il

Grant Role Privileges to Roles

to User

© 2012 SAP AG. All rights reserved. 321© 2012 SAP AG. All rights reserved. 321

Managing Users and RolesUser Management & SecurityUser Management & Security

DefineDefine and

Create Roles

Create Users

Assign P i il

Grant Role Privileges to Roles

to User

© 2012 SAP AG. All rights reserved. 322© 2012 SAP AG. All rights reserved. 322

Creating Role using SAP HANA StudioUser Management & SecurityUser Management & Security

Graphical UI for Creating /Graphical UI for Creating / managing rolesIn SAP HANA Studio Navigator Tree

P th <SID> (<U >) C t l Path: <SID> (<User>) Catalog Authorizations Right-Click “Roles” folder Select “New” “Role” from context Select New Role from context

menu

Using SQL Syntaxg yRun the following statement: CREATE ROLE <ROLE_NAME>;

© 2012 SAP AG. All rights reserved. 323© 2012 SAP AG. All rights reserved. 323

Managing Users and RolesUser Management & SecurityUser Management & Security

DefineDefine and

Create Roles

Create Users

Assign P i il

Grant Role Privileges to Roles

to User

© 2012 SAP AG. All rights reserved. 324© 2012 SAP AG. All rights reserved. 324

Assign Privileges to RolesUser Management & SecurityUser Management & Security

On the appropriate privilege tab:On the appropriate privilege tab:Click on the green iconIn the search box, start typing For System / Object Privileges : the

object name For direct privilege assignment: the

privilege nameprivilege name

Select the desired object or privilegeClick OK

© 2012 SAP AG. All rights reserved. 325© 2012 SAP AG. All rights reserved. 325

Managing Users and RolesUser Management & SecurityUser Management & Security

On the appropriate privilege tab:On the appropriate privilege tab:Click on the green iconIn the search box, start typing For System / Object Privileges : the

object name For direct privilege assignment: the

privilege nameprivilege name

Select the desired object or privilegeClick OK

© 2012 SAP AG. All rights reserved. 326© 2012 SAP AG. All rights reserved. 326

Assign Privileges to Roles and saveUser Management & SecurityUser Management & Security

Using the “save” button

Using the “deploy” button (green arrow)

Errors during saveT i ll i i i il f ditiTypically: missing privilege for editing user (USER ADMIN)Or missing grant option: For Object/Privilege

combinations: on object For direct privilege

i i ilassignment: on privilege

© 2012 SAP AG. All rights reserved. 327© 2012 SAP AG. All rights reserved. 327

Managing Users and RolesUser Management & SecurityUser Management & Security

DefineDefine and

Create Roles

Create Users

Assign P i il

Grant Role Privileges to Roles

to User

© 2012 SAP AG. All rights reserved. 328© 2012 SAP AG. All rights reserved. 328

Create Users or RolesUser Management & SecurityUser Management & Security

Graphical UI for Creating / managing rolesp g g gIn SAP HANA Studio Navigator Tree Path: <SID> (<User>) Catalog Authorizations Right Click “Users” folder Right-Click Users folder Select “New” “User” from context menu

Ch th ti ti th dChoose authentication methods Define the initial password (user/password) Or define the external User ID (e.g. Kerberos

to set up SSO)

Other user settingsTo save the user:

g Define default client

This is used as an implicit filter value whenreading from SAP HANA data models

© 2012 SAP AG. All rights reserved. 329© 2012 SAP AG. All rights reserved. 329

Managing Users and RolesUser Management & SecurityUser Management & Security

DefineDefine and

Create Roles

Create Users

Assign P i il

Grant Role Privileges to Roles

to User

© 2012 SAP AG. All rights reserved. 330© 2012 SAP AG. All rights reserved. 330

Grant Roles to UserUser Management & SecurityUser Management & Security

Using Studio:Using Studio:Switch to tab “Granted Roles” in User Editor Open search dialog ( ) Open search dialog ( ) Start typing the role name Add the role

All /di ll ti th l Allow/disallow granting the role(note: System Privilege “ROLE ADMIN” supersedes this GRANT OPTION)

Using SQL SyntaxRun the following statement:Run the following statement: GRANT <ROLE_NAME> TO <user>;

© 2012 SAP AG. All rights reserved. 331© 2012 SAP AG. All rights reserved. 331

Grant Role to UserUser Management & SecurityUser Management & Security

Using the “save” button

Using the “deploy” button (green arrow)

Errors during saveTypically: missing privilege for editing useruser E.g.: System privilege ROLE ADMIN

missing Or (without ROLE ADMIN): GRANTOr (without ROLE ADMIN): GRANT

OPTION for role missing

© 2012 SAP AG. All rights reserved. 332© 2012 SAP AG. All rights reserved. 332

Revoke Roles from UserUser Management & SecurityUser Management & Security

Using Studio:gSwitch to tab “Granted Roles” in User Editor Select the role from list of granted roles Click the icon Click the icon Save the user

(this also revokes a GRANT OPTION)

Using SQL SyntaxRun the following statement: REVOKE <ROLE NAME> FROM <user>;REVOKE <ROLE_NAME> FROM <user>;

Note on Cascaded Dropping of PrivilegesgIf the user had granted the role to other users, revoking the role (and the grant option) also revokes the role from these grantees

© 2012 SAP AG. All rights reserved. 333© 2012 SAP AG. All rights reserved. 333

revokes the role from these grantees

ExerciseUser Management & SecurityUser Management & Security

© 2012 SAP AG. All rights reserved. 334© 2012 SAP AG. All rights reserved. 334

SummaryUser Management & SecurityUser Management & Security

You should now be able to:You should now be able to:

Explain How To Handle User Management and User Provisioning, Explain The Authentication Methods,Explain The Authentication Methods, Explain User and Role Concept in SAP HANA, Explain How To Maintain User’s Roles, Explain How To Maintain SAP HANA PrivilegesExplain How To Maintain SAP HANA Privileges.

© 2012 SAP AG. All rights reserved. 335

User Management & Security

Unit 7: Security and Authorizations

Template Roles Types of Privileges

AdministrativeAdministrative

ObjectivesTypes of privilegesTypes of privileges

At the end of this Lesson you will be able to:At the end of this Lesson you will be able to:

• Explain The Authorization Concept,• Explain What is SQL PrivilegeExplain What is SQL Privilege,• Explain What is SYSTEM Privilege,• Explain What is Package Privilege,

E l i Wh t i A l ti P i il• Explain What is Analytic Privilege,• Explain What is a Template Role.

© 2012 SAP AG. All rights reserved. 337

OverviewTypes of privilegesTypes of privileges

This module covers the following topics:This module covers the following topics:

• Authorization Concept,• SQL PrivilegeSQL Privilege,• SYSTEM Privilege,• Package Privilege,

A l ti P i il• Analytic Privilege.

© 2012 SAP AG. All rights reserved. 338

Authorization conceptTypes of privilegesTypes of privileges

When accessing the SAP HANA database using a client interface (such as ODBC, JDBC, MDX), any access to data must be backed by corresponding privileges. Different schemes are implemented

SQL SYSTEM

SQL PrivilegePrivilege SQL statement

type (for example

System PrivilegeUsed for

administrati eprivilege privilege

Authorization

type (for example, SELECT, UPDATE, and CALL…)

administrative tasks.

System Privileges are assigned toAuthorization

Conceptare assigned to users and roles.

Package PrivilegeRestrict the access to Analytic Privilege

Package privilege Analytic privilege

Restrict the access to and the use of packages in the repository

Analytic Privileges are used to provide row-level authorization

© 2012 SAP AG. All rights reserved. 339

authorization Views.

SQL PrivilegeTypes of privilegesTypes of privileges

In the SAP HANA database, a number of privileges are available to control the authorization of SQL commands. Following the principle of least privilege, users should only be given the smallest set of privileges required for their role.

Two groups of SQL Privileges are available:Two groups of SQL Privileges are available:

System Privileges

These are system wide privileges that control someThese are system-wide privileges that control some general system activities mainly for administrative purposes, such as creating schema, creating and changing users and roles.

Object Privileges

These privileges are bound to an object, for example, ese p eges a e bou d o a objec , o e a p e,to a database table, and enable object-specific control activities, such as SELECT, UPDATE, or DELETE to be performed.

© 2012 SAP AG. All rights reserved. 340

System Privilege Types of privilegesTypes of privileges

6 types of system privilege are available on SAP HANA Database:

Analytics Auditing

Catalog and SystemgSchema

Management

System Management

SystemUsers and Data ImportSystem privilege

Users and Roles

Data Import and Export

© 2012 SAP AG. All rights reserved. 341

Package Privilege – Assign to users/rolesTypes of privilegesTypes of privileges

• In the SAP HANA studio, you can , ymanage the package privileges on the Package Privileges tab

Th SAP HANA d t b it i• The SAP HANA database repository is structured hierarchically with packages assigned to other packages as subpackages If you grantas subpackages. If you grant privileges to a user for a package, the user is automatically also authorized for all corresponding subpackagesfor all corresponding subpackages.

© 2012 SAP AG. All rights reserved. 342

Package Privilege – Create package & subpackageTypes of privilegesTypes of privileges

The SAP HANA database repository is structured hierarchically with packages p y y p gassigned to other packages as subpackages. If you grant privileges to a user for a package, the user is automatically also authorized for all corresponding subpackages. p g

Create a subpackage (right click under a package

Create a package (right click under « Content »)

© 2012 SAP AG. All rights reserved. 343

Package Privilege – Native & Imported Types of privilegesTypes of privileges

In the SAP HANA database repository a distinction is made between native and p yimported packages. Native packages are packages that were created in the current system and should therefore, be edited in the current system. Imported packages from another system should not be edited except by newlyImported packages from another system should not be edited, except by newly imported updates.

An imported package should only be manually edited in exceptional cases.

Hence different privileges are required to manage Native or Imported privileges

NativeImportedImportedExported

SAP HANA 2

Native packages

ImportedpackagesImportedpackages

SAP HANA 1

Exportedpackages

SAP HANA 2SAP HANA 1

Package can be edited

© 2012 SAP AG. All rights reserved. 344

Package can be edited

Package cannot be edited, only import changes on the package

Analytic Privilege - The conceptTypes of privilegesTypes of privileges

Analytic Privileges are used to control access to SAP HANAAnalytic Privileges are used to control access to SAP HANA data models • Without Analytic Privilege, no data can be retrieved from

A ib Vi Attribute Views Analytic Views Calculation Views

Implement row-level security with Analytic Privileges • Restrict access to a given data container to selected Attribute Values Field from Attribute View Field from Attribute View Field from Attribute View used in Analytic View Private Dimension of Analytic View Attribute field in Calculation View Combinations of the above Single value, range, IN-list

© 2012 SAP AG. All rights reserved. 345

Analytic Privilege - Start creation wizardTypes of privilegesTypes of privileges

Analytic Privileges are repositoryAnalytic Privileges are repository objects Create and manage via SAP HANA Studio

C i k Create in any package Does not need to be the same package as views

Call creation wizard:Call creation wizard: Right-click folder “Analytic Privileges” in

packageE t d d i ti Enter name and description

Click Next

© 2012 SAP AG. All rights reserved. 346© 2012 SAP AG. All rights reserved. 346

Analytic Privilege – Select Information ModelsTypes of privilegesTypes of privileges

Select applicable InformationSelect applicable Information Models Views have two functions in

privilege Views you want to grant access to Views from which you want to

select fields for restrictionsselect fields for restrictions

You can add further views to the privilege laterto the privilege later

© 2012 SAP AG. All rights reserved. 347© 2012 SAP AG. All rights reserved. 347

Analytic Privilege - Editor Overview Types of privilegesTypes of privileges

Restrictions apply to all views inRestrictions apply to all views in list of “Reference Models”

Choose “Add” in “Reference Models” section Pick any appropriate view From any package

Do not use the “Applicable to All Content Models”-option

Reason: Can have surprising side-effects You give away control over model

access

© 2012 SAP AG. All rights reserved. 348© 2012 SAP AG. All rights reserved. 348

Analytic Privilege - Select field for attribute restrictionTypes of privileges

You may implement value restrictions for all selectedYou may implement value restrictions for all selected fieldsIf no value restriction implemented no restriction (wildcard)p ( )Otherwise: user will only be allowed to see listed values UI offers single value or range condition

C dd l diti fi ld ( bi d i “AND”) Can add several conditions per field (combined via “AND”)

© 2012 SAP AG. All rights reserved. 349© 2012 SAP AG. All rights reserved. 349

Analytic PrivilegeTypes of privilegesTypes of privileges

Like views: activation required to create run-time objectLike views: activation required to create run-time objectOnly run-time object is grantable to users / roles Name of run-time object: “<package>/<privilege_name>”

OR

© 2012 SAP AG. All rights reserved. 350© 2012 SAP AG. All rights reserved. 350

SummaryTypes of privilegesTypes of privileges

You should now be able to:You should now be able to:

Explain The Authorization Concept, Explain What is SQL Privilege,Explain What is SQL Privilege, Explain What is SYSTEM Privilege, Explain What is Package Privilege, Explain What is Analytic PrivilegeExplain What is Analytic Privilege, Explain What is a Template Role.

© 2012 SAP AG. All rights reserved. 351

User Management & Security

Unit 7: Security and Authorizations

Template Roles Types of Privileges

AdministrativeAdministrative

ObjectivesTemplate RolesTemplate Roles

At the end of this Lesson you will be able to:At the end of this Lesson you will be able to:

Explain The Purpose Of the Pre-Delivered Roles, Explain Which role is Required for Information Composer.p q p

© 2012 SAP AG. All rights reserved. 353

OverviewTemplate RolesTemplate Roles

This module covers the following topics:This module covers the following topics:

Pre Delivered Role, Role for Information Composer.p

© 2012 SAP AG. All rights reserved. 354

Pre-delivered RolesTemplate RolesTemplate Roles

SAP HANA comes with several pre-defined / standard roles :pRoles that should (must) be used unchanged PUBLIC – minimal privileges for a user to work with the database at all Is implicitly granted whenever a user is created Is implicitly granted whenever a user is created

Role templates CONTENT ADMIN the only role in the system with vital privileges e g : CONTENT_ADMIN – the only role in the system with vital privileges, e.g.:

SQL Privileges on Schema _SYS_BIC – with GRANT OPTION SQL Privileges on Schema _SYS_BI – with GRANT OPTION

MODELING – a very richly privileged role that enables Creation and activation of Information Models Creation and activation of Analytic Privilegesy g

MONITORING – role with full read-only access to all meta data, monitoring and statistics

Regard these roles as “templates” name change coming soon

© 2012 SAP AG. All rights reserved. 355

Regard these roles as templates name change coming soon Do not use these roles – build your own roles instead

Information Composer RoleTemplate RolesTemplate Roles

The SAP HANA Information Composer is a Web application that allows you toThe SAP HANA Information Composer is a Web application that allows you to upload and manipulate data on the SAP HANA database. The SAP HANA Information Composer uses the SAP NetWeaver Core Engine for Partners 1.0 (LJS 1.0), which interacts with the SAP HANA database. ( JS 0), c te acts t t e S database

The roles required to access to the SAP HANA Information Composer client: IC_MODELER role: This role allows users to upload new content into the SAP HANA

database and to create physical tables and calculation views. IC_PUBLIC role : This role allows users to see the shared physical tables and calculation

views

As long as the SAP HANA Information Composer is in use, the SAP_IC user must not be deleted. Otherwise, the IC_MODELER and IC_PUBLIC roles will also be deleted

© 2012 SAP AG. All rights reserved. 356

also be deleted.

SummaryUser Management & SecurityUser Management & Security

You should now be able to:You should now be able to:

Explain the purpose of the pre-delivered Roles, Explain which role is required for Information Composer.Explain which role is required for Information Composer.

© 2012 SAP AG. All rights reserved. 357

User Management & Security

Unit 7: Security and Authorizations

Template Roles Types of Privileges

AdministrativeAdministrative

ObjectivesAdministrativeAdministrative

At the end of this Lesson you will be able to:At the end of this Lesson you will be able to:

Explain How To Deactivate a User, Explain How To Reactivate a User,p , Explain How To Reset a Locked User, Explain How To Manage User Password.

© 2012 SAP AG. All rights reserved. 359

OverviewAdministrativeAdministrative

This module covers the following topics:This module covers the following topics:

Deactivate / Reactivate User, Manage Connection Attempt,g p , Set Initial Password to User, Force User To Change Password.

© 2012 SAP AG. All rights reserved. 360

Deactivate / Reactivate a userAdministrativeAdministrative

Deactivation of UsersThe administrator can deactivate a user account with the following SQL command: ALTER USER <user_name> DEACTIVATE USER NOW;After the user account is deactivated the user cannot log on to the SAP HANAAfter the user account is deactivated, the user cannot log on to the SAP HANA database until the administrator resets the user’s password.

Reactivation of UsersThe administrator can reactivate a user account. A user account can be locked because of the following reasons: g• The user’s password has expired. • The user has made too many invalid logon attempts. If the user’s password has expired, the user has to change the password to a new value. If the user has made too many invalid logon attempts, the administrator can use an SQL command to unlock the user account.

© 2012 SAP AG. All rights reserved. 361

Manage connection attemptsTemplate RolesTemplate Roles

The number of invalid logon attempts allowed is set to 6 by default). Which means g p y )after too many wrong attempts, the user will be locked. The Administrators can reset the number of invalid logon attempts with the following SQL command:

ALTER USER RESET CONNECT ATTEMPTSALTER USER <user_name> RESET CONNECT ATTEMPTS ;

With the first successful logon after an invalid logon attempt, an entry is made into the INVALID CONNECT ATTEMPTS view showing:the INVALID_CONNECT_ATTEMPTS view showing: • The number of invalid logon attempts since the last successful logon • The time of the last successful logon

Administrators and users can delete the information of invalid logon attempts with the following SQL command: ALTER USER <user name> DROP CONNECT ATTEMPTS;ALTER USER user_name DROP CONNECT ATTEMPTS;

© 2012 SAP AG. All rights reserved. 362

Manage user password Template RolesTemplate Roles

Defines whether users have to change their initial passwords at first logonDefines whether users have to change their initial passwords at first logon.

Logging on with the initial password is still possible but only

ALTER USER t PASSWORD d th d bALTER USER <current_user> PASSWORD <password>; the command can be executed. All other statements give the error message "user is forced to change password".

Administrators can force a user to change the password at any time with the following SQL command:

ALTER USER <user_name> FORCE PASSWORD CHANGE

© 2012 SAP AG. All rights reserved. 363

SummaryUsing HierarchiesUsing Hierarchies

You should now be able to:You should now be able to:

Explain How To Deactivate a User, Explain How To Reactivate a User,Explain How To Reactivate a User, Explain How To Reset a Locked User, Explain How To Manage User Password.

© 2012 SAP AG. All rights reserved. 364

© 2012 SAP AG. All rights reserved.g

SAP R/3 SAP N W D P Ed B D i SAP B i ObjNo part of this publication may be reproduced or transmitted in any form or for any purpose without the express permission of SAP AG. The information contained herein may be changed without prior notice.Some software products marketed by SAP AG and its distributors contain proprietary software components of other software vendors.Microsoft Windows Excel Outlook and PowerPoint are registered trademarks of

SAP, R/3, SAP NetWeaver, Duet, PartnerEdge, ByDesign, SAP BusinessObjects Explorer, StreamWork, and other SAP products and services mentioned herein as well as their respective logos are trademarks or registered trademarks of SAP AG in Germany and other countries.

Business Objects and the Business Objects logo, BusinessObjects, Crystal Reports, Crystal Decisions, Web Intelligence, Xcelsius, and other Business Microsoft, Windows, Excel, Outlook, and PowerPoint are registered trademarks of

Microsoft Corporation. IBM, DB2, DB2 Universal Database, System i, System i5, System p, System p5, System x, System z, System z10, System z9, z10, z9, iSeries, pSeries, xSeries, zSeries, eServer, z/VM, z/OS, i5/OS, S/390, OS/390, OS/400, AS/400, S/390 Parallel Enterprise Server, PowerVM, Power Architecture, POWER6+, POWER6, POWER5+ POWER5 POWER OpenPower PowerPC BatchPipes

p , y , g , ,Objects products and services mentioned herein as well as their respective logos are trademarks or registered trademarks of Business Objects Software Ltd. Business Objects is an SAP company.

Sybase and Adaptive Server, iAnywhere, Sybase 365, SQL Anywhere, and other Sybase products and services mentioned herein as well as their respective logosPOWER5+, POWER5, POWER, OpenPower, PowerPC, BatchPipes,

BladeCenter, System Storage, GPFS, HACMP, RETAIN, DB2 Connect, RACF, Redbooks, OS/2, Parallel Sysplex, MVS/ESA, AIX, Intelligent Miner, WebSphere, Netfinity, Tivoli and Informix are trademarks or registered trademarks of IBM Corporation.Linux is the registered trademark of Linus Torvalds in the U.S. and other countries

Sybase products and services mentioned herein as well as their respective logos are trademarks or registered trademarks of Sybase, Inc. Sybase is an SAP company.

All other product and service names mentioned are the trademarks of their respective companies. Data contained in this document serves informational purposes only. National product specifications may vary.

countries.Adobe, the Adobe logo, Acrobat, PostScript, and Reader are either trademarks or registered trademarks of Adobe Systems Incorporated in the United States and/or other countries.Oracle and Java are registered trademarks of Oracle and/or its affiliates.UNIX X/Open OSF/1 and Motif are registered trademarks of the Open Group

The information in this document is proprietary to SAP. No part of this document may be reproduced, copied, or transmitted in any form or for any purpose without the express prior written permission of SAP AG.

UNIX, X/Open, OSF/1, and Motif are registered trademarks of the Open Group.Citrix, ICA, Program Neighborhood, MetaFrame, WinFrame, VideoFrame, and MultiWin are trademarks or registered trademarks of Citrix Systems, Inc.HTML, XML, XHTML and W3C are trademarks or registered trademarks of W3C®, World Wide Web Consortium, Massachusetts Institute of Technology.

© 2012 SAP AG. All rights reserved. 365