cancel
Showing results for 
Search instead for 
Did you mean: 

HANA - SQL to CREATE STRUCTURED PRIVILEGE

0 Kudos

Hello,

just wanted to create a simple analytical privilege based on a graphical calculation view without any filter. To do so I was following the documentation here:

CREATE STRUCTURED PRIVILEGE Statement (Access Control)

CREATE STRUCTURED PRIVILEGE <privilege_name> FOR <action>

ON <view_name> <filter_condition>;

and failed.

Current situation:

  • System: HANA 2.00.061.00, xs classic in use.
  • Calculation view "TEST" has been created in package "TRAINING" in Eclipse. "SQL Analytic Privilege" has been applied for this CV.

When trying to create an analytical privilege in SQL by running the statement:

CREATE STRUCTURED PRIVILEGE "TRAINING/AP_TEST1" FOR SELECT

ON "_SYS_BIC"."TRAINING/TEST"

I got this response:

Could not execute 'CREATE STRUCTURED PRIVILEGE "TRAINING/AP_TEST1" FOR SELECT ON "_SYS_BIC"."TRAINING/TEST"'

SAP DBTech JDBC: [257]: sql syntax error: line 2 col 18 (at pos 77)

2 Questions:

1. Where to find the executed statement, which was processed while activation of the AP created in Eclispe?

2. How to change my sql statement that it is working on HANA XS?

Many many thanks for taking time to provide a useful hint.

Br.

Telli

Accepted Solutions (1)

Accepted Solutions (1)

jan_zwickel
Product and Topic Expert
Product and Topic Expert

Hi Telli,

the syntax requires also a filter, e.g.

CREATE STRUCTURED PRIVILEGE "TRAINING/AP_TEST1" FOR SELECT

ON "_SYS_BIC"."TRAINING/TEST" WHERE "<column_name>"='<value>'

should work.

If you really want no filter:

CREATE STRUCTURED PRIVILEGE "TRAINING/AP_TEST1" FOR SELECT

ON "_SYS_BIC"."TRAINING/TEST" WHERE 1=1

If you activate an analytic privilege you should get a success message. If you double-click on it, the create statement should be visible in the log.

However, by using this statement you create only a catalog object. This means lifecycle management needs to be done manually by SQL statements. If you want to have the lifecycle management controlled via design time files, Web IDE running on XSA or BAS with SAP HANA Cloud would be alternatives.

Best,

Jan

0 Kudos

Hello Jan,

many thanks for your response, explaination and additional provided insight.

You saved my live. 🙂

Best regards,

Telli

Answers (1)

Answers (1)

junwu
Active Contributor
0 Kudos

you should stay away from XSC

0 Kudos

Hi Jun,

it is like it is, can´t change this.

Br.

T.