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

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

The coding is put into the createContent method, which creates the content of the view. The View<br />

wizard creates the body of the method.<br />

Note: In your <strong>SAP</strong>UI5 coding, refer to the resource bundle with the URL containing the file extension,<br />

for example:<br />

var oBundle = jQuery.sap.resources({<br />

url : "i18n/messagebundle.hdbtextbundle",<br />

locale: sLocale})<br />

var oResourceModel = new sap.ui.model.resource.ResourceModel({<br />

bundleURL : "i18n/messagebundle.hdbtextbundle "})<br />

8. To implement the doIt method for the button's press event, insert the following coding into the controller (in<br />

this example: helloworld.controller.js):<br />

doIt : function(oEvent) { alert(oEvent.getSource().getId() +<br />

"does it!"); }<br />

9. Create a .xsapp and a .xsaccess file.<br />

10. Share, commit, and activate your project to transfer the <strong>SAP</strong>UI5 application to the <strong>SAP</strong> <strong>HANA</strong> repository.<br />

11. To start the UI application on <strong>SAP</strong> <strong>HANA</strong>'s Web server, use the following URL: ://:/MyApplication/WebContent/<br />

index.html. Replace the placeholders accordingly; MyApplication refers to the name of your project<br />

according to Step 2.<br />

10.2.1 Local Testing of a <strong>SAP</strong>UI5 Application<br />

This section provides a description how local testing can be performed as an optional step.<br />

If you want to test the <strong>SAP</strong>UI5 application before you activate your project, you can test it within Eclipse on your<br />

local PC. This local testing is optional. If you perform a local test, note the following:<br />

● The src attribute in the bootstrap tag of the index.html file needs to have a different URL than the src<br />

attribute for execution on <strong>SAP</strong> <strong>HANA</strong>'s Web server. This can be achieved by manually changing the URL<br />

before submitting to <strong>SAP</strong> <strong>HANA</strong>'s Web server, or by using a code snippet, that detects if the application runs<br />

locally or not, and sets the URL accordingly.<br />

● If you call a data service in form of a server-side JavaScript or an OData service that resides in the <strong>SAP</strong> <strong>HANA</strong><br />

box, it is necessary to use a URL that points to <strong>SAP</strong> <strong>HANA</strong>'s Web server. It is usually also necessary to use the<br />

so-called proxy servlet to avoid cross-domain issues. In case of the bootstrap URL, for example, the URL for<br />

local execution differs from the URL for execution on <strong>SAP</strong> <strong>HANA</strong>'s Web server. For more information, see the<br />

procedure below and the referenced section in the Demo Kit.<br />

For more information, see the Demo Kit - <strong>Developer</strong> <strong>Guide</strong> under Testing a <strong>SAP</strong>UI5 Application.<br />

To perform a local test, proceed as follows:<br />

1. Change the URL set as "src" in the bootstrap tag of the index.html file (see explanation above). To avoid<br />

232<br />

a manual change before submitting the application, use the following code snippet that detects the context<br />

automatically, in which the application runs, and sets the URL accordingly.<br />

<br />

<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 />

Building UIs with <strong>SAP</strong>UI5

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

Saved successfully!

Ooh no, something went wrong!