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.

2. Choose Execute.<br />

You can view the contents of the comma-separated values (CSV) file in the <strong>SAP</strong> <strong>HANA</strong> table.<br />

5.12 Using Imported Table Data in an <strong>SAP</strong> <strong>HANA</strong> XS<br />

Application<br />

Before you start, ensure that you have deployed a table import.<br />

Note: If you activate the files and then log on to the system using the <strong>SAP</strong> <strong>HANA</strong> studio, you do not have<br />

sufficient privileges to execute a SELECT statement on the table that was created. You must execute the<br />

following statement using the SQL editor in the <strong>SAP</strong> <strong>HANA</strong> studio:<br />

call<br />

_SYS_REPO.GRANT_PRIVILEGE_ON_ACTIVATED_CONTENT('select','"Ti<br />

Package::TiTable"','');<br />

The example in the note above is for illustration purposes only. In the example shown, TiPackage is the path to<br />

the table-import package in the repository, where package names are separated by a dot (.); TiTable is the name<br />

of the table that is the target for the data-import operation; and is the name of a valid <strong>SAP</strong> <strong>HANA</strong><br />

database user.<br />

To use imported table in an <strong>SAP</strong> <strong>HANA</strong> XS application, perform the following steps:<br />

1. Create an application-descriptor file and place it in your table-import package, for example, TiPackage.<br />

The application-descriptor file has no contents and no name; it only has the file extension .xsapp.<br />

2. Create an application-access file and place it in the package to which you want to grant access, for example, in<br />

same TiPackage package as the application descriptor file you created in the previous step.<br />

The application-access file does not have a name; it only has the file extension .xsaccess.<br />

3. In the application-access (.xsaccess) file, enter the following lines of text:<br />

{<br />

}<br />

"auth_required" : true<br />

4. Create an application-logic file using server-side JavaScript, for example, TiConsumerApp.xsjs and place it<br />

in your table-import package, for example TiPackage.<br />

The application-logic file is the <strong>SAP</strong> <strong>HANA</strong> XS JavaScript application you use to access the data imported into<br />

the table.<br />

5. Enter the following lines of text into your application-logic file, for example, TiConsumerApp.xsjs.<br />

88<br />

Note: The following example is for illustration purposes only. In the example shown,<br />

.TiPackage is the absolute path to the table-import package in the repository and<br />

TiTable is the name of the table that is the target for the data-import operation.<br />

$.response.contentType = "text/plain";<br />

var conn = $.db.getConnection();<br />

P U B L I C<br />

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

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

Setting Up the Persistence Model

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

Saved successfully!

Ooh no, something went wrong!