+ All Categories
Home > Documents > Create Some Analytic Priviliges on a Table

Create Some Analytic Priviliges on a Table

Date post: 14-Apr-2018
Category:
Upload: ravi-bathla
View: 219 times
Download: 0 times
Share this document with a friend

of 15

Transcript
  • 7/29/2019 Create Some Analytic Priviliges on a Table

    1/15

    [ SAP HANA Tutorial ]

    mayato How-To Papers in the Area of Business Intelligence

    Title: Create some analytic privileges on a table

    Author(s): Thorsten Fg

    Topic SAP HANA

    Published: December 2012

    Overview

    This tutorial describes how to create some simple analytic privileges on a table in SAP HANA. You limit the access to atable (which is in default client independent) for a user with the help of analytic privileges.Prerequisiteso You have access to an SAP HANA system.o You have SAP HANA Studio installed on your machine.o You have SAP HANA Clients installed on your machine.TopicsIn this tutorial you will learn how to:

    1. Create a table and insert some data2. Create a user and assign a role and SQL privilege3. Create an analytic privilege4. Assign the analytic privilege to the user you created in the previous step5. Delete a user

    The estimated completion time for this tutorial is 40 minutes.Using a simple data model, you will learn the basic steps about how to model data in the SAP in-memory computing

    studio.

    | HOW-TO PAPER

  • 7/29/2019 Create Some Analytic Priviliges on a Table

    2/15

    2

    Create a new tables in SAP HANA

    1. In SAP HANA Studio go to your schema. There you will find a folder named tables. Here you can add a new tableusing a right click. In the screen below the schema TUTORIALS is selected.

    2. Choose a name for the table (in this exercise, the name is FINANCIALS) and create the following fields:Fieldname Settings Data typeID mark the field as key INTMANDANT Dim 3 CHAR

    COUNTRY Dim 20 VARCHAR

    DATE - DATE

    REVENUE Dim 6, not Null DECIMAL

    COTS Dim 6, not Null DECIMAL

    ERNINGS Dim 6, Not Null DECIMAL

    CURRENCY Dim 3 CHAR

  • 7/29/2019 Create Some Analytic Priviliges on a Table

    3/15

    3

  • 7/29/2019 Create Some Analytic Priviliges on a Table

    4/15

    4

    SQL code: Table FINANCIALScreatecolumntable""."FINANCIALS"("ID"INTEGERnotnull,"MANDANT"CHAR (3) nulldefault'',"COUNTRY"VARCHAR (20) nulldefault'',"DATE"DATEnull,"REVENUE"DECIMAL (8,2) notnull,"COSTS"DECIMAL (8,2) notnull,"EARNINGS"DECIMAL (8,2) notnull,"CURRENCY"CHAR (3) nulldefault'',primarykey ("ID"));

    3. As final step in this section deploy the table

    Fill the new table with data

    In the first step right-click on the new table and choose Generate -> Insert Statements from the context menu.

  • 7/29/2019 Create Some Analytic Priviliges on a Table

    5/15

    5

    After that, the SQL editor will appear.

    Enter the following SQL statements to fill the table with data.

    SQL code insert statmentinsertinto""."FINANCIALS"values(1,'100','Germany','01.07.2012',20000.00,5000.00,15000.00,'EUR');insertinto""."FINANCIALS"values(2,'100','Germany','02.07.2012',25000.00,5000.00,20000.00,'EUR');insertinto""."FINANCIALS"values(3,'100','Germany','03.07.2012',1000.55,500.10,500.45,'EUR');insertinto""."FINANCIALS"values(4,'200','USA','01.07.2012',14000.00,4000.00,10000.00,'USD');insertinto""."FINANCIALS"values(5,'100','Germany','01.07.2012',20000.00,18000.50,1999.50,'EUR');insertinto""."FINANCIALS"values(6,'300','China','01.07.2012',55000.00,5000.00,50000.00,'CNY');insertinto""."FINANCIALS"values(7,'300','China','02.07.2012',20000.00,5000.00,15000.00,'CNY');insertinto""."FINANCIALS"values(8,'300','China','03.07.2012',1000.99,200.99,800.00,'CNY');insertinto""."FINANCIALS"values(9,'200','USA','02.07.2012',19000.00,5000.18,13999.82,'USD');insertinto""."FINANCIALS"values(10,'200','USA','03.07.2012',21000.00,4000.00,17000.00,'USD');insertinto""."FINANCIALS"values(11,'400','England','01.07.2012',99000.00,70000.00,29000.00,'GBP');insertinto""."FINANCIALS"values(12,'100','Germany','04.07.2012',1111.11,444.44,666.67,'EUR');After that, open the data preview with right click.

  • 7/29/2019 Create Some Analytic Priviliges on a Table

    6/15

    6

    Finally, your filled table will look like the screen shown below:

    Create a new attribute view

    To create a new attribute view, right-click on your package and choose New.

    Choose a name for the new attribute view, and also a description. Click Next after naming. Ensure that you adhere tothe SAP naming convention (ATR_)

  • 7/29/2019 Create Some Analytic Priviliges on a Table

    7/15

    7

    On the next screen, choose the schema and table you created at begin of this tutorial. After that, click Finish.

    Next, add ID as the key attribute and all other fields as attributes.

  • 7/29/2019 Create Some Analytic Priviliges on a Table

    8/15

    8

    Finally, save and activate the attribute view

    and take a look at the to check that everything went fine.

  • 7/29/2019 Create Some Analytic Priviliges on a Table

    9/15

    9

    Create a new analytic privilege

    In the first step, go to the folder Contents on your SAP HANA Workspace. If you dont see the folder, switch to themodeler perspective (right corner at the top of SAP HANA Studio).

    With a right-click on this folder you can create a new package. You only have to enter a name.

    After that, you can create a new analytic privilege by right-clicking on the package.

    On the next screen enter a name and click NextEnsure that you adhere to the SAP naming convention (AP_).

  • 7/29/2019 Create Some Analytic Priviliges on a Table

    10/15

    10

    After that choose your package and add the attribute view you created before. Then leave the screen by selectingFinish.

    In the next step, a new window appears. At this point, define a new associated attribute restriction.

    In our case, you select the field MANDANT (client).

  • 7/29/2019 Create Some Analytic Priviliges on a Table

    11/15

    11

    After that, you can see the new entry in the area outline in red in the screenshot at the top this page.Now you must assign a restriction for that field, too. To do this, select Add as shown in screenshot.Then a new entry named equal appears in the red marked area in screenshot.Here, you can also choose another operator, but in our case it should be equal. Near to the operator you will find abrowse button for selecting a value.If you click this button, you will see a new popup.Here you can search for client (mandant) 100 like on the screenshot below.

    Finally you can save and deploy the analytic privilege using this button:In the job log you can take a look at the corresponding success message.

  • 7/29/2019 Create Some Analytic Priviliges on a Table

    12/15

    12

    Performe a data preview

    Before we assign the new privilege to our user, performe do a data preview on the actual attribute view. To do this,right-click on your attribute view in the content folder and choose Data Preview.

    At this moment, you will see other entries apart from the entries of MANDANT 100.

    .

  • 7/29/2019 Create Some Analytic Priviliges on a Table

    13/15

    13

    Assign the new analytic privilege

    To apply the new analytic privilege to the table FINANCIALS, you must assign the privilege to users.In this tutorial, you assign the analytic privilege a new SAP HANA user.

    To do this, you switch to the folder Catalog -> Authorization -> Users in the navigator pane.After that, right-click on Usersand choose New User.

    In the next window, enter a user name and password and add the role ANALYZER. This role includes all thenecessarybasic rights for analysts.

    After that, switch to the tab named SQL Privileges, add your attribute view and choose SELECT privilege.

    Next, add your new analytic privilege:

  • 7/29/2019 Create Some Analytic Priviliges on a Table

    14/15

    14

    Finally, click on the deploy button .

    Test the new analytic privilege

    Now you can add a new connection for this user to SAP HANA studio. To do this, right-click on your current connection

    and choose the menu entry Add Additional User

    On the screen that appears, enter username and password of the new user with role ANALYZER.

    After these initial steps, go to the new connection and choose the content folder. As an analyst you do not have anyrights to see tables saved in schemas. For analyses, the modeler creates attribute and analytic views. For this testscenario, you created an attribute view in the previous steps.

    In the content folder, the tutorial package should be available. Browse to the FINANCIAL attribute view and open thedata preview with a right click.

  • 7/29/2019 Create Some Analytic Priviliges on a Table

    15/15

    15

    Here you can see the data restricted by the analytic view to client (mandant) 100. Previously, before assigning theprivilege, you could see the whole content.

    Clean up the system after ending this tutorial. To do this, delete the new user M_ANALYST.

    First, go into your own connection to the authorization folder and right-click on M_ANALYST, which is in the areaUsers. Choose Deleteand select the option Restrict!

    Delete the new connection for M_ANALYST using the right mouse-button, too.

    References

    Part of this tutorial is inspired by SAP training material


Recommended