Jamie Wiseman from the SAP HANA Academy details how to create a table in a SAP HANA Studio development schema, how to insert records into that table and how to access that data via an XS OData web service. As a prerequisite for this lesson set the previous two lesson sets (part 1 and part 2) must be completed. Jamie is using a free developer license for SAP HANA Cloud Platform. Please follow these instructions to get your own free license.
Jamie advises users to download the syntax for Part 3.txt file that contains all of the syntax that will be used in this video set. The file is available here.
Jamie first opens a command prompt in order to navigate back to where the SDK tools for the platform were installed. Jamie enters C:\Users\Administrator>cd c:\program files\sap\hdbsdk\tools into the command prompt. Jamie then enters the unique user platform id (can be found on the SAP HANA Cloud Platform cockpit) into the syntax from line number 1 of syntax file before pasting that syntax into the command prompt window. After entering his HANA Cloud Platform password Jamie successfully tunnel into the SAP HANA Cloud Platform console client.
Next, Jamie copies the user passcode generated in the command prompt window before right clicking on the existing system in SAP HANA Studio. Jamie chooses preferences and then pastes in the new password in the general tab.
Then in SAP HANA Studio Jamie opens the catalog folder and then right clicks on the development schema and opens a SQL. Jamie pastes in the syntax from line 2 of the syntax file into the SQL console and then executes it to create the table.
Jamie then opens schema folder, refreshes the table and then right clicks on the new table. Jamie chooses generate and then insert statement to insert the records into the table.
Next, Jamie goes back to the project tab, right clicks on the project and then chooses new and then folder. Jamie then creates a folder named services. Then, Jamie right clicks on the services folder and chooses new and then file. He names the file mycustomers.xsodata and then pastes in the syntax from line 3 of the syntax file. This syntax contains the schema name that can be found in the insert statement from the previously created table in the SQL console. After saving the project, Jamie right clicks on the project name and chooses team and then activate.
Next, Jamie tests the OData web service by going to the SAP HANA Cloud Platform cockpit and clicking on myhdbpackage and then choosing the URL. Jamie then copies services/mycustomers.xsodata/mcdata?$format=json from the end of line 4 of the syntax file and appends that to the end of the URL. This generates a service exception error, which Jamie expected.
The current issue is that the SAP HANA Cloud Platform user doesn’t have access to the development schema. Back in the system tab of SAP HANA Studio Jamie opens the security folder and right clicks on users and selects find user/role. Jamie then pastes in his SAP HANA Cloud Platform user id in the top toolbar and then double clicks on the id once it’s found. Then, Jamie chooses the object privileges tab and presses the green plus button. He enters the schema name from the command console and then double clicks on it. Jamie then adds the select privilege before pressing deploy.
Finally, Jamie returns to his browser and refreshes the URL to return the data via the XS OData web service.
Jamie’s tutorial video shows how to create a table in a SAP HANA Studio development schema, add data to that table, and create an OData web service off of the table.
View other tutorials on SAP HANA Cloud Platformat the SAP HANA Academy.
SAP HANA Academy - over 500 free tutorial technical videos on using SAP HANA.
-Tom Flanagan
SAP HANA Academy