Technology Blogs by Members
Explore a vibrant mix of technical expertise, industry insights, and tech buzz in member blogs covering SAP products, technology, and events. Get in the mix!
cancel
Showing results for 
Search instead for 
Did you mean: 

Most of the time I come across a way of using on-premise(SAP Logon and other) software for building odata service and then using SAP Cloud Connector for integration of on-Premise with the application,lets learn something new and different.


With current trend of switching to cloud, SAP also has introduced new feature of developing service(XSOdata service) in SAP Cloud Platform Cockpit instead of using on-Premise,I will no longer need SAP Cloud Connector in order to integrate service with application.


Moreover,the best part is I can access it any time,any where just by providing credential while its not possible in on-Premise since it is not on the web.

Note :- The XSOdata service which will be developed in SAP Cloud Platform stops after every 12 hours(because I will be using trial version) I just need to restart it.If not done Database and service will be deleted after 20 days.


It is not that I need to do setup or configuration or coding again for restarting,I just need to click on "Start" button again.


Step 1 : Login to SAP Cloud Platform Cockpit and go to "Neo" environment.



 

 


 

Creating Database Instance and configuration


Step 2 : Go to "SAP HANA /SAP ASE"->Databases & Schemas



Step 3 : Click on "New" ,fill up the fields and setup password for database.




Note :- Enable the “DP Server” as well and name Database ID as "bookshopdbinstance".


Step 4 : After clicking on "Create" SAP will do the setup for database creation I can check that on  "Events".



Step 4(a) : Wait until "Tenant DB creation finished successfully (created and configured)" is shown.



Step 4(b) : "Tenant DB creation is done only once (during initial creation of database).


Note :- For first time creation of database it will take around 20 mins(depending on network bandwidth) for setting up but next time when I restart it will take less than a minute.


Step 4(c) : In the "Overview" section once setup is done by SAP it will shown as "Started".



Step 4(d) : From the "Overview" I can start or stop the database.


Step 4(e) : At this stage(since it is initial setup) I need to do some assignment of roles by going to SAP HANA Cockpit(Administration Tools),after this only I will be able to access "SAP HANA Web-Based Development Workbench"(otherwise it will show 403 -Forbbiden).



Step 4(f) : Go to "SAP HANA Cockpit".



Step 4(g) : Click on "Ok".



Step 4(h) : Successful message will be displayed,click on "Continue".



Step 4(i) : Go to "Manage Roles & Users"->"Users"->"SYSTEM"->"Granted Roles".




Step 4(j) : Click on "+" to add roles which includes "CatalogDeveloper","Developer",
"EditorDeveloper".








Step 4(k) : Save the changes,this will complete the assignment of roles.



Note : Step 4(g) and Step 4(k) are only when I am accessing "SAP HANA Cockpit" first time after that it is not needed.


Step 4(l) : Go back to “Overview ,”now the error which is showing in Step 4(e) will be gone and I will be able to access "SAP HANA Web-Based Development Workbench".




Note :- Enter ID as "SYSTEM" and Password(what you have set in Step 3) whenever it asks for credential for login in SAP HANA.


Step 5 : This completes our setup and assignment of roles for accessing our XSOdata service.I will be using "SAP HANA Web-Based Development Workbench" for creating our service.


Step 6 : Follow Step 4(c) to access "SAP HANA Web-Based Development Workbench".In this I have 4 section,I will use "Editor" for coding our XSOdata service and "Catalog" as a way for visualizing table and setting up schema.


Step 7 : Go to "Catalog"(create a scehma),uncheck case sensitive option and name it as    "bookshopSchema".



Note :- Use the same schema name in "Editor" while developing XSOdata service.Table inside the schema in "Catalog" will be created automatically as I develop in "Editor".


Step 8 : Go to "Editor"(here I will build our XSOdata service).


Step 8(a) : Create a "Package" and name it as "bookshop_pkg".




Step 8(b) : From the Package which I have created, select "Create Application" and select "Empty Application" in Template.



Note :- Package name will come by default.


Step 8(c) : This will auto generate 3 files (.xsaccess,.xsapp,index.html)



 
{
"exposed": true,
"authentication": [{
"method": "Form"
}],

"mime_mapping": [{
"extension": "jpg",
"mimetype": "image/jpeg"
}],
"force_ssl": false,
"enable_etags": true,
"prevent_xsrf": false,
"anonymous_connection": null,
"cors": [{
"enabled": true
}],
"cache_control": "no-cache, no-store",
"default_file": "index.html"
}

Note : In ".xsaccess" file make some changes as shown above in Step 9(c).


Step 8(d):Create new file for developing table structure("bookshoptable.hdbtable").




table.schemaName = "bookshopSchema";
table.tableType = COLUMNSTORE;
table.columns = [
{ name = "BookId"; sqlType = VARCHAR; nullable = false; length = 7; },
{ name = "AuthorName"; sqlType = VARCHAR; nullable = false; length = 20; },
{ name = "PublisherName"; sqlType = VARCHAR; nullable = false; length = 35; },
{ name = "Price"; sqlType = VARCHAR; nullable = false; length = 35; }
];
table.primaryKey.pkcolumns = ["BookId"];

Step 8(e) : Create file for defining schema("myschema.hdbschema").




schema_name="bookshopSchema";

Step 8(f) : Create a XSOdata service file("service.xsodata").




service{
"bookshop_pkg::bookshoptable";
}

Step 8(g) : Activate "bookshoptable.hdbtable" file and "service.xsodata" if not activated(check the console).


Step 9 : I can get the service link for consumption by clicking on "service.xsodata" and running this file(by clicking on "Run" button).Check the link whether it is working or not.



Note :- Add "/bookshoptable" in the URL.



Step 10 : I can visualize the table in "Catalog"->"bookshopSchema"->"Tables".



Note :- This table structure is created automatically based on what I have coded in ".hdbtable" file in "Editor".

Step 11 : Enter some data in the table in "Catalog" (by clicking onTables->Table_Name-> “Open Content”).



Step 12 : Check the service link again I will get data which I have entered.



Step 13 : For consumption I will create destination in SAP Cloud Platform Cockpit and use that in our SAP UI5 application.



Note : Providing the URL which I get in Step 9(do not put ("/bookshop_pkg/service.xsodata/"),user id will be "SYSTEM" and password will be what I set in Step 3.



Note :- Check the connection.


Great !,XSOdata service is now successfully created, deployed, created destination and its ready for consumption.


Note :- For Consumption and performing CRUD operation follow this blog post "https://blogs.sap.com/2016/08/15/crud-operations-using-odata-model-xsodata-in-sap-ui5/".

5 Comments
Labels in this area