28.01.2013 Views

SAP HANA Developer Guide - Get a Free Blog

SAP HANA Developer Guide - Get a Free Blog

SAP HANA Developer Guide - Get a Free Blog

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

ool public(default=true);<br />

optional list depends_on_table;<br />

optional list depends_on_view;<br />

The following example shows the contents of a valid transportable view-definition file for a view called MYVIEW:<br />

schema="TEST_DUMMY";<br />

query="SELECT * FROM \"TEST_DUMMY\".\"com.sap.test.tables::<br />

02_HDB_DEPARTMENT_VIEW\"";<br />

depends_on_view=["com.sap.test.tables::02_HDB_DEPARTMENT_VIEW"];<br />

If you want to create a view definition as a design-time object, you must create the view as a flat file and save the<br />

file containing the view definition with the suffix .hdbview, for example, MYVIEW.hdbview in the appropriate<br />

package in the package hierarchy established for your application in the <strong>SAP</strong> <strong>HANA</strong> repository. You can activate<br />

the design-time object at any point in time.<br />

Note: On activation of a repository file, the file suffix, for example, .hdbview, is used to determine which<br />

runtime plugin to call during the activation process. The plug-in reads the repository file selected for<br />

activation, parses the object descriptions in the file, and creates the appropriate runtime objects.<br />

5.8 Creating SQL Views<br />

A view is a virtual table based on the dynamic results returned in response to an SQL statement. <strong>SAP</strong> <strong>HANA</strong><br />

Extended Application Services (<strong>SAP</strong> <strong>HANA</strong> XS) enables you to create a database view as a design-time file in the<br />

repository.<br />

To create a view-definition file in the repository, perform the following steps:<br />

1. Start the <strong>SAP</strong> <strong>HANA</strong> studio.<br />

2. Open the <strong>SAP</strong> <strong>HANA</strong> Development perspective.<br />

3. Open the Project Explorer view.<br />

4. Create the view-definition file.<br />

Browse to the folder in your project workspace where you want to create the new view-definition file and<br />

perform the following tasks:<br />

a) Right-click the folder where you want to save the view-definition file and choose New in the contextsensitive<br />

popup menu.<br />

b) Enter the name of the view-definition file in the File Name box and add the file suffix .hdbview, for<br />

example, MYVIEW.hdbview.<br />

c) Choose Finish to save the new view-definition file in the repository.<br />

5. Define the view.<br />

To edit the view-definition file, in the Project Explorer view double-click the view-definition file you created in<br />

the previous step, for example, MYVIEW.hdbview, and add the view-definition code to the file:<br />

Note: The following code example is provided for illustration purposes only.<br />

schema="TEST_DUMMY";<br />

query="SELECT * FROM \"TEST_DUMMY\".\"com.sap.test.tables::<br />

<strong>SAP</strong> <strong>HANA</strong> <strong>Developer</strong> <strong>Guide</strong><br />

Setting Up the Persistence Model<br />

P U B L I C<br />

© 2012 <strong>SAP</strong> AG. All rights reserved. 81

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!