GeneXus for SAP Systems First Build and Run

Official Content

Now we want to test the transaction we created in the previous steps. To do so, we'll have GeneXus build the application, create the database, and do everything necessary to get the programs ready to be run and tested. This test cycle that developers undertake before the application is ready is called prototyping.

The full version of GeneXus allows prototyping an application locally (that is to say, the programs and the database will be hosted on our network servers) and in a cloud that is available to GeneXus users. Also, we can prototype in any of the programming languages supported.

However, in the specialized version for SAP Systems, the database will be SAP HANA, the language will be Java, and the prototyping tasks will be done on the Tomcat server that is available to us. In our demo, it will be a local one.

To set the necessary information in the HANA database and the web server, we must select the Preferences tab or press F5. We will use this function key very frequently because it allows us to generate all the objects required, as well as compile and run the main object. 

Because it is the first time we press F5, this window is opened to ask us for the server and database details:

GeneXusForSAPSystems_FirstBuildAndRun_Image1

A way to build applications that use SAP HANA database is to do it through the Cloud platform available from SAP, called SAP Cloud Platform.

For trial purposes, a free account may be created at hcp.sap.com.

GeneXusForSAPSystems_FirstBuildAndRun_Image2

Here we register with our email account:

GeneXusForSAPSystems_FirstBuildAndRun_Image3

If we already have an account, we log into it.

From there, going to the option “Databases & Schemas” in the SAP Cloud Platform Cockpit, it is possible to create a new schema within a shared instance of the SAP HANA database offered to free accounts.

GeneXusForSAPSystems_FirstBuildAndRun_Image4

We create a new schema for what will be the database of our TravelAgency application:

GeneXusForSAPSystems_FirstBuildAndRun_Image5

Here we must place the name of the DB that we want to create (Database ID), select Database System: HANA MDC (<trial>), choose a password for the DB (must be 15 characters or greater), select Configure a User for SHINE = ON, which enables us more options to create a Shine User and a Password).

Once this is done and Save is selected, the creation of the DB begins, which we will then use in our GeneXus KB.

To connect this schema through JDBC, we must open a “tunnel”. 
Keep in mind that the process takes a while, and can not be used (open the tunnel) until this process ends, from SCP Cockpit we will receive messages to control when this process ends.

SAPHANADBCreationSCPMsg

At this moment we will have the DB created and we will proceed to open the tunnel using the neo command of SAPHCPSDK.
To do so, having installed the Hana Cloud Platform SDK (check requirements) corresponding to the version of Java Web Tomcat that we're using:

GeneXusForSAPSystems_FirstBuildAndRun_Image6
 
We need to open a command prompt console over the tools folder:

GeneXusForSAPSystems_FirstBuildAndRun_Image7

And there use the command:

GeneXusForSAPSystems_FirstBuildAndRun_Image8

neo open-db-tunnel -a <account> -h <host> -u <user> -p <password> -i <schema>

Where the “account” and “user” details are taken from the account we created in the Cockpit:

GeneXusForSAPSystems_FirstBuildAndRun_Image9

So, we replace those values in the command:

GeneXusForSAPSystems_FirstBuildAndRun_Image10

In this case, in which we're using the trial version, the host is: hanatrial.ondemand.com
The password is that of our account (that we used to log in).
The schema is the one we've just created: TravelAgencyDB.

GeneXusForSAPSystems_FirstBuildAndRun_Image11

Note that the tunnel has been opened as a result of the command execution. It will remain open for 24 hours unless we explicitly close it before that.

If we execute the command and the DB has not yet finished creating, we will receive the message:

Opening tunnel...
(!) ERROR: Failed to connect to the backend: bad request
A database tunnel can only be opened for HANA databases in state 'CREATED', 
but 'testlem' is currently in state 'CREATING'.
If you need help, provide the output of the command and attach the log 
directory [C:\SAPHCPSDK\tools\log]

In case everything is done successfully we will receive the following message:

Opening tunnel...
Tunnel opened.
Use these properties to connect to your schema:
  Host name        : localhost
  Database type    : HANAMDC
  JDBC Url         : jdbc:sap://localhost:30015/
  Instance number  : 00
Use any valid database user for the tunnel.
This tunnel will close automatically in 24 hours on 17/11/2017 at 01:29 PM or when you close the shell.
Press ENTER to close the tunnel now.

In the HANA DataStore properties in the GeneXus KB, you must place the following data:

Server name: localhost
User id: the SHINE User name chosen when the DB was created
Password: the SHINE User password chosen when the DB was created (indeed the new value that will be set, as indicated in the note below)
Database schema: the SHINE User name chosen when the DB was created

NOTE: Before creating the DB from GX, you must enter the HANA Manager web, in order to change the SHINE User password that was placed when the DB was created, because the first time, you are forced to change it, and if run the creation from GX without doing this step, we will receive the error message:

========== Reorganization started ==========
callmake.bat "C:\Models\TestGX4SAP\TstNewTrialSCP\JavaModel\web\GXJMake.exe" 
"C:\Program Files\Java\jdk1.8.0_131\bin\javac.exe" 
Reorganization com\tstnewtrialscp\ options: -O

GeneXus Java Make v1.0

Build succeeded.

"C:\Program Files\Java\jdk1.8.0_131\bin\java.exe"  com.tstnewtrialscp.Reorganization -nogui -noverifydatabaseschema

com.sap.db.jdbc.exceptions.JDBCDriverException: SAP DBTech JDBC: [414]: user is forced to change password: alter 
password required for user <USERNAME>
    at com.sap.db.jdbc.exceptions.SQLExceptionSapDB.createException(SQLExceptionSapDB.java:345)
    at com.sap.db.jdbc.exceptions.SQLExceptionSapDB.generateDatabaseException(SQLExceptionSapDB.java:185)

You can do that from the SAP CP Cockpit, selecting the SAP HANA Web-Base Development Workbench option.
When entering, the first thing you will be asked to do is change the password.

SAPHanaChangePswrd

Once this is done, you are enabled to continue the work from GeneXus.

GeneXus will build the application from the main object known as Launchpad, which we will see later, but for now, we can say that it will contain all the Fiori List Reports of our objects. We don't have any yet, so this object is not useful to us. Therefore, we need GeneXus to run a developer menu to try all the objects that are being created, even if they don't have that Fiori pattern incorporated, without worrying about programming the invocation. 

Let's click on Cancel. In the Preferences tab, we see that the information we've just entered has already been configured in the corresponding properties. So, if we open the DataStores information, we see that we have the Default option (SAP Hana) and if we enable the properties window (by pressing F4, or here on the right):

GeneXusForSAPSystems_FirstBuildAndRun_Image15

Here they are!
Now, let's press F5.

The Output window informs us that the Developer Menu execution has started and will end with a report called “Impact Analysis.”

GeneXusForSAPSystems_FirstBuildAndRun_Image18

In this report, GeneXus examines the impact caused by the new definitions made in the knowledge base. Also, it indicates which additions or structural changes need to be made to the database. 

If we examine the report, we can see that a new table called Customer will be created:

GeneXusForSAPSystems_FirstBuildAndRun_Image19

Also, that this table structure will have the following attributes: 

GeneXusForSAPSystems_FirstBuildAndRun_Image20

As we can see, GeneXus will also create an index by CustomerId automatically. We will explain this concept later on.

GeneXusForSAPSystems_FirstBuildAndRun_Image21

Since we agree to have this table created with this definition in the database, we click on the Create button

GeneXusForSAPSystems_FirstBuildAndRun_Image22

So, GeneXus starts to create the necessary programs to create the Customer table in the database, with this structure. 

Next, GeneXus executes those programs.

GeneXusForSAPSystems_FirstBuildAndRun_Image23

Why did it fail? Why does it show a reorganization error? 

In the Output window, we're informed that the driver to connect to the database hasn't been found within the folder containing all the necessary files to run this application:

GeneXusForSAPSystems_FirstBuildAndRun_Image24

We solve it by copying it to the directory of this Java Environment... within the Drivers folder. 

GeneXusForSAPSystems_FirstBuildAndRun_Image25

Where do we take it from? It can be downloaded from SAP's website, as shown here.

We have downloaded it to the folder where everything related to HANA is saved: 

GeneXusForSAPSystems_FirstBuildAndRun_Image26

Now we press F5 again and click on Create. 

GeneXusForSAPSystems_FirstBuildAndRun_Image27

And the Customer table is created in the database. Next, GeneXus generates other programs (that is to say, all the necessary lines of code in the selected programming language, so that our application does what we want, which in this case is to enter customer details)... Also, we are informed if the result was successful, or if there were any errors or warnings.

 GeneXusForSAPSystems_FirstBuildAndRun_Image28

We're asked which browser we want to use to open the Developer Menu. We choose anyone we want. 

Here we can see the application running: 

GeneXusForSAPSystems_FirstBuildAndRun_Image29

We have one objects: the Customer transaction that we created. 

We right-click on the link and choose to open it in another tab.

Here we have a page that allows us to add, change and delete customers. We enter the details of our first customer.

GeneXusForSAPSystems_FirstBuildAndRun_Image30

This customer will be identified with number 1;
His name is John:
His last name is Smith:
He lives on Fifth Avenue.
His phone number is: 1111
And his email address is jsmith@homtail.com

GeneXusForSAPSystems_FirstBuildAndRun_Image31

We click on Confirm and a message is displayed to inform us that the data has been successfully added; meanwhile, the form is cleared and ready for us to enter another customer:

GeneXusForSAPSystems_FirstBuildAndRun_Image32

Let’s add the second customer... we identify her with number 2:

Her name is Susan:
Her last name is “Brown”:
Her address is on Seventh Avenue
Her phone number is 2222
And her email address is sbrown@gmail.com

GeneXusForSAPSystems_FirstBuildAndRun_Image33

We click on Confirm. Once again, a message is displayed to inform us that the data has been successfully added.

To look for John’s details, we enter his customer number (one) and press the Tab key. 

GeneXusForSAPSystems_FirstBuildAndRun_Image34

We see that John's full details are displayed and that from here we could change some information, such as his phone number.

Also, we could even delete customer John from the customer records using the Delete button.

We can also use the upper section buttons to browse customers by going to the next or the previous one, the first or the last one:

GeneXusForSAPSystems_FirstBuildAndRun_Image35

Also, we can look for a specific customer using this window:

GeneXusForSAPSystems_FirstBuildAndRun_Image36

 This window was automatically created by GeneXus, and it corresponds to this object:

GeneXusForSAPSystems_FirstBuildAndRun_Image37 

Note that if we change the screen size, the controls are adjusted to the space available. 

GeneXusForSAPSystems_FirstBuildAndRun_Image38

What does it mean? GeneXus generates responsive web applications, or sensitive applications, which offer optimum viewing, good navigation and excellent use of screen space.
This is achieved with design features that allow viewing all the information on the screen, using the functions provided by GeneXus to this end. They allow us to show different layouts depending on the screen size of the device.

Now that we’ve seen everything that was automatically generated by GeneXus using the Customer transaction that we've created... let’s go back to the development environment.


 


Was this page helpful?
What Is This?
Your feedback about this content is important. Let us know what you think.