SAP HANA Live CLF Consulting Note PDF

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 19

Classification Views: Background Information

TABLE OF CONTENTS
BACKGROUND INFORMATION ...................................................................................................................... 3
General prerequisites - System and database connection ......................................................................... 3
General prerequisites - Database schema .................................................................................................... 3
Known limitations for classification view generation .................................................................................. 3
Classification view re-generation .................................................................................................................. 3
Authorization checks for view generation .................................................................................................... 6
Analytic privileges for view access ............................................................................................................... 6
Texts for characteristics and characteristic values ..................................................................................... 7
Performance aspects ...................................................................................................................................... 7
EXAMPLE ......................................................................................................................................................... 9
Step 1: Used class and characteristics ......................................................................................................... 9
Step 2: Generate classification view ........................................................................................................... 10
Step 3: Enhance generated classification view with texts ........................................................................ 11
Step 4: Join enhanced classification view with query view ...................................................................... 14
Step 5: Define analytical privileges ............................................................................................................. 16

2
CLASSIFICATION VIEWS: TIPS AND TRICKS

This document is aimed at data analysts or system administrators as users of the report
BSCL_CLASS_VIEW_GENERATION for classification view generation. The purpose of this
document is to give some background information regarding classification views, illustrate the end-
to-end process for generating and using them and describe some best practices.

BACKGROUND INFORMATION
General prerequisites - System and database connection
To be able to use the classification view generation, you need an SAP Business Suite system which contains
an unlocked version of report BSCL_CLASS_VIEW_GENERATION (that is, prerequisite is note 1826411).

Furthermore, you need a HANA system into which you generate the classification views. This can either be
the Business Suite system itself (“on-HANA” case) or a separate system which is connected to the Business
Suite system via a database connection (“side-by-side” case).

Be aware of the following detail: From a technical perspective, the generated classification views represent
stored SQL procedures which refer to the internal identifiers (“ATINN”) of the individual characteristics
contained in the view. These internal identifiers are determined in the system where you execute the report.
So for the generated views to contain meaningful data you must execute the report in a system out of which
the classification data is directly replicated into the HANA with the generated classification views. Note that if
you generate the classification views out of a system that has identical characteristic names (like in a test
system) the internal identifiers might still deviate leading to distorted classification views.

Before you get started with the classification view generation we recommend you also take a look at the
documentation in the system (info button on the selection screen of the report) which describes the detailed
features of the generated views. In particular this system documentation describes how the names of the
generated views and the names of the view columns are assembled.

General prerequisites - Database schema


The generated classification views - as stored SQL procedures - access database tables by addressing them
via the schema SAP_ECC. Therefore, the ability to generate the classification views requires a schema
mapping for SAP_ECC.
The mapped schema needs to contain the following tables:

CABN AUSP CAWN KSML TCLAX TCLAO

CABNT KLAH CAWNT TCLA TCLT TCLTT

INOB KSSK SWOR TCLAT TCLO TCLC

Known limitations for classification view generation


 The generated classification views do not consider the template definitions of the involved
characteristics.
 Testing reveals that view generation for a class with more than 200 characteristics is not possible,
depending on the structure of the involved characteristics.
→ Please consider proposals in section ‘Performance aspects’.
 In the case of reference characteristics, the generated classification views only contain columns for
these characteristics if they use redundant storage. That is, for a reference characteristic to appear
in the classification view, the object type must be configured for redundant storage.

Classification view re-generation


In case you change the definition of a characteristic or class, that change does not affect the corresponding
generated classification view automatically. So after you adjusted a characteristic or class definition, you

3
CLASSIFICATION VIEWS: TIPS AND TRICKS

have to run the generation report again in order to re-generate the corresponding classification view.
(Remark: You have to run the generation report only in case you changed the characteristic/class definition
but not in case you maintained a classification, e.g. for a material.)

It is possible for example to add a characteristic to a class and re-generate the corresponding classification
view although the generated classification view is used in other HANA views.

It is not possible to
 remove a characteristic from a class and regenerate the corresponding classification view if the
classification view column of the characteristic is used in another HANA view
 change from multiple value characteristic to single value characteristic and regenerate if the
corresponding column "..._SORT" within the generated classification view is used in another HANA
view

 change from no interval to interval characteristic and regenerate if the corresponding column within
the generated classification view is used in another HANA view; or if you want to change from
interval to no interval characteristic

In addition you have to consider the generated name for characteristics with long names. As mentioned in
the generation report documentation, in case the characteristic's name has more than 22 characters it is
shortened to its first 19 characters. Then a two digit counter is appended, separated from the radical by the
symbol %. The counter of these long characteristics is generated with respect to the sequence of the
corresponding internal number (CABN-ATINN). Assume an example class with two characteristics which
have a long names:

4
CLASSIFICATION VIEWS: TIPS AND TRICKS

The characteristics names within the generated view are shortened as described:

Assume an additional characteristic with a long name is added to the example class. The internal ID of that
characteristic (ATINN) is between the internal ID’s of the already added characteristics.

After re-generation of the classification view, the shortened name of characteristic


T_LONG_NAME_AAAAAAAAAAAAAAAAA3 changed because the new added characteristic
T_LONG_NAME_AAAAAAAAAAAAAAAAA2 has a lower internal ID:

5
CLASSIFICATION VIEWS: TIPS AND TRICKS

That have to be considered within the views which do use the generated classification view.

Authorization checks for view generation


When executing report BSCL_CLASS_VIEW_GENERATION for view generation you need two sets of user
privileges:

 In the system where you run the report:


Authorization for the class type for which you generate the views. The corresponding authorization
object is C_TCLA_BKA.

 For the database system into which you generate the views:
Database user with object privilege to create and activate packages and calculation views, at least
for package sap.hba.class-go. In case you generate the classification views into another system (that
is, database connection is not ‘DEFAULT’) typically

Analytic privileges for view access


For a general introduction to the authorization model as implemented for HANA see the SAP HANA
Developer Guide on http://help.sap.com  SAP In-Memory Computing  SAP HANA Appliance Software 
Development Information. All in all, classification views follow these general concepts. In this document we
describe only deviations or special handling.

Analytic privileges for HANA are designed to work as a filter on the selected data. Classification data as such
is however additional data for a business object. Because of this authorization checks for classification data
must be implemented in such a way that a business user who is not authorized to access classification data
can still access the data of the associated business object. In the following we describe how this can be
realized.

Classification views are intended to be used in conjunction with business object views. For an illustration see
section “Example -- Join enhanced Classification View with Query View” below. Consider the following rules
to realize the desired behavior that lacking user privileges for authorization data do not filter out associated
business object data:
 Apply the privilege check regarding classification data at the classification view level, not at the level
of the joined view. To do so, create two analytic privileges per classification view:
o one for users who are allowed to see the classification values of that view
o one for users who are not allowed to see the classification values of that view.
 Combine the business object view with the classification view via an outer join

Classification views enable you to implement analytic privileges which follow the same pattern as the existing
authorization objects C_TCLA_BKA, C_TCLS_BER and C_TCLS_MNT on ABAP side. That is, the
classification views contain columns “ClassType” and “OrganizationalArea” which correspond to the
authorization object fields “KLART” and “SICHT” respectively.

To manage access to the data exposed by the classification views create two analytic privileges per
classification view. Define attributes and restrictions as illustrated in the example below:

6
CLASSIFICATION VIEWS: TIPS AND TRICKS

Suppose you have a generated classification view for organizational area E of class CBD_BIKES (class type
001) named 004_001_MARA_CBD_BIKES_E. For the analytic privilege for users who are allowed to see the
values of the view, set the following attributes and attribute restrictions:

Attribute Restriction Value Restriction Operator

SAPClient 004 =

ClassType 001 =

OrganizationalArea E =

For the analytic privilege for users who are not allowed to see the values of the view, set the attribute
restrictions to blank:

Attribute Restriction Value Restriction Operator

SAPClient (blank) =

ClassType (blank) =

OrganizationalArea (blank) =

Finally, assign the analytic privileges to user roles as applicable.

Texts for characteristics and characteristic values


For a characteristic with data type ‘Character’ you can define values with corresponding descriptions. The
generated classification views do provide the language independent characteristic values but not the
corresponding language dependent descriptions.

You can enhance the generated classification views with the help of a reuse view for the characteristic
descriptions and a reuse view for the characteristic value descriptions. Both reuse views are delivered within
the SAP HANA Analytics Foundation for SAP Business Suite:
 sap.hba.ecc.CharacteristicDesc: language dependent description of a characteristic
 sap.hba.ecc. CharacteristicValueDesc: language dependent description of a characteristic value

To enhance the generated classification view by the value descriptions, for example, you have to join the
generated view with the reuse view sap.hba.ecc. CharacteristicValueDesc based on the Attributes SAPClient
(ABAP Dictionary MANDT), Characteristic (ABAP Dictionary ATNAM) and CharacteristicValue (ABAP
Dictionary ATWRT). An example is given within the next chapter.

Both reuse views provide the current version of the descriptions based on the date given by input parameter
P_KeyDate. So both reuse views do consider change numbers, but only date validity and not parameter
efficiency is supported. A second constraint of reuse view CharacteristicValueDesc is that we do not
consider class specific characteristic value descriptions.

Performance aspects
 Based on the results of several tests, the performance of read operations on generated classification
views depend firstly on the number of characteristics within a view.
 To improve the performance do generate classification views with less characteristics by
considering:
o usage of the organizational area within the classification view generation in order to filter the
characteristics of the class

7
CLASSIFICATION VIEWS: TIPS AND TRICKS

o usage of additional classes which only contain the characteristics you need within the
generated classification view for analytical purposes.

8
CLASSIFICATION VIEWS: TIPS AND TRICKS

EXAMPLE

Step 1: Used class and characteristics


This example is based on a class for the classification of materials. The example class is used to describe
bicycles in more detail and consists of the three characteristics: bicycle type, type of gear change and bicycle
frame size. The class was created by help of transaction CL02, the characteristics by help of transaction
CT04.

9
CLASSIFICATION VIEWS: TIPS AND TRICKS

Step 2: Generate classification view

To generate a classification view for the example class, start transaction SE38 and execute the report
BSCL_CLASS_VIEW_GENERATION. Enter the class type and class name, choose the database
connection to the HANA database and push the button “Execute”.

In case you did not deselected the checkbox “Show list before generation” you now see the list with
classification views which can be generated. If you do not want to generate one of the listed views, deselect
the corresponding checkbox in front of the view. For our example only one classification view is listed.

When you click on the button “Execute” again, the report generates the classification view into the HANA
database. You will receive a success or error message.

10
CLASSIFICATION VIEWS: TIPS AND TRICKS

You can logon to the HANA database using HANA studio and check the generated classification view in
package sap.hab.class-go.

For our example the interface of the generated view contains the columns shown below:

Step 3: Enhance generated classification view with texts


To enhance the generated classification view, we create a new graphical calculation view in a different
package and add both the generated classification view and the reuse view sap.hba.ecc.
CharacteristicValueDesc as nodes.

11
CLASSIFICATION VIEWS: TIPS AND TRICKS

Because we have two characteristics with value descriptions within our generated classification view, we
need to create two projections for the view “CharacteristicValueDesc”. Each projection delivers the value
descriptions for one characteristic based on a filter with the characteristic name.

Projection CBD_TYPE

Projection CBD_GEAR_CHG

12
CLASSIFICATION VIEWS: TIPS AND TRICKS

Next we have to join the generated classification view node with the two projection nodes:

Join for CBD_TYPE

(left outer join)

Join for CBD_GEAR_CHG

13
CLASSIFICATION VIEWS: TIPS AND TRICKS

(left outer join)

Finally, we add the output of the second join to the output of the whole view. Thereby you can rename the
attributes and descriptions (which is useful in case you want to consume the view by help of an analytical
tool). In addition you have to create an input parameter on output node level and map it to the input
parameter of the included view “CharacteristicValueDesc”.

Check that for the enhanced classification view, the flag “Enable Analytical Privilege” is set.

Step 4: Join enhanced classification view with query view

To enhance an existing query view, for example sap.hba.ecc.MaterialWarehouseStockQuery, with a


classification view, you first have to copy the query view into your own package.

In our example we want to use the query view sap.hba.ecc.MaterialWarehouseStockQuery and the
enhanced classification view to build a stock overview for bicycles. So we first copy the query view and then
remove the relationship between the most upper node “J_Material” and the output node from the copied
view.

14
CLASSIFICATION VIEWS: TIPS AND TRICKS

To add the classification information, embed the classification view and join it with the most upper node
“J_Material”.

(left outer join)

Finally we can adjust the output node. Again, you have to map the input parameter of the enhanced
classification view to an input parameter of the enhanced query view.

15
CLASSIFICATION VIEWS: TIPS AND TRICKS

Step 5: Define analytical privileges

For the authorization check of the enhanced query view we need three analytical privileges:
 one for the enhanced query view itself (which will not be described further).
 one for user who are allowed to see the values of the used classification view.
 one for user who are not allowed to see the values of the user classification view.

Within this section we will describe by an example how the analytical privileges should be created and what
needs to be granted to a user.

Definition of analytical privileges

The analytical privilege for users who are allowed to see the classification values does contain:

a) the generated and enhanced classification view:

16
CLASSIFICATION VIEWS: TIPS AND TRICKS

b) the restriction attributes for the enhanced classification view: “SAPClient” and “ClassType”:

c) for each restriction attribute the corresponding restriction value:

The analytical privilege for users who are not allowed to see the classification values does contain the same
views and restriction attributes, but the restriction values have to be cleared:

User setup

17
CLASSIFICATION VIEWS: TIPS AND TRICKS

A user who should be able to select data from the enhanced query view and see the classification values,
needs the following authorizations (either granted directly or by role):

a) Object privilege to select data from the enhanced query view:

b) The analytical privilege for the enhanced query view and the analytical privilege which enables to see the
values of the classification view:

When the user selects data from the enhanced query view, the columns with the classification data should
be filled for materials which are classified with the used class:

A user who should be able to select data from the enhanced query view but should not be able to see the
classification values, also needs the object privilege to select from the enhanced query view. But the
analytical privilege which enables you to see the classification data needs to be replaced by the one which
does not enable to see the classification data:

When the user selects data from the enhanced query view, the columns with the classification data should
be empty for all materials:

18
www.sap.com

© 2013 SAP AG or an SAP affiliate company. All rights reserved.

No 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. National product
specifications may vary.

These materials are provided by SAP AG and its affiliated companies (“SAP
Group”) for informational purposes only, without representation or warranty of
any kind, and SAP Group shall not be liable for errors or omissions with
respect to the materials. The only warranties for SAP Group products and
services are those that are set forth in the express warranty statements
accompanying such products and services, if any. Nothing herein should be
construed as constituting an additional warranty.

SAP 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.

Please see
http://www.sap.com/corporate-en/legal/copyright/index.epx#trademark
for additional trademark information and notices.

You might also like