ESPM Webshop on light weight HTML5 applications
With the availability of HTML5 applications on the trial landscape and Rui Nogueira’s blog post we decided to try it out for our ESPM webshop scenario. As we already had destinations present in the ESPM scenario and we had separate folders for UI code, it was a breeze to get our ESPM webshop application running on the cloud (with some minor tweaks 🙂 ). You can check out the running application here.
We basically followed Rui’s blog step-by-step replacing the destinations and UI code with our stuff wherever necessary. Also, going with the times we modified the theme of our application to blue crystal.
These minor changes required us to modify a few files, so we decided to create a new branch in our public github space so others don’t have to worry about the modifications.
Prerequisites
Before we move on to how to get the code and get this application running some prerequisite checks.
1. Check that you are able to access the following service. It will be used to fetch the data (OData) and images in our application
https://cloudmodelespmhana.hana.ondemand.com/espm-cloud-web/espm.svc/
2. Create a trial account on SAP HANA Cloud Platform. If you don’t have it already, you can register for free here:
https://help.hana.ondemand.com/help/frameset.htm?65d74d39cb3a4bf8910cd36ec54d2b99.html
3. Install the latest version of the Eclipse Kepler IDE (SR2 used for this scenario). You can find the latest release here:
http://www.eclipse.org/downloads/packages/eclipse-ide-java-ee-developers/keplersr2
Obtaining the code for this app
As mentioned above we have created a separate branch in out github space to help others run this application quickly.
- Download the code as a zip file from https://github.com/SAP/cloud-espm-scenarios/archive/scenario-html5.zip
- Unzip and check the contents.
- There should be a ReadMe file which contains the exact same steps as mentioned here. Also, there will be two folders.
- “destinations” folder contains the destinations for the OData service and the images.
- “webshop-ui” folder contains the webshop UI code modified for this scenario.
Define destinations in your cloud account
- Navigate to the cockpit in your trial account, or copy paste this URL in your browser https://account.hanatrial.ondemand.com/cockpit
- Click on the Destinations tab, then click New Destination
- Click on Import from File and select the cloudbackend file in the destinations folder you downloaded above.
- Save the destination once it is uploaded.
- Repeat step 3 to step 5 for the cloudbackendimages file.
Create the ESPM Webshop HTML5 application
- Navigate to the cockpit in your trial account, or copy paste this URL in your browser https://account.hanatrial.ondemand.com/cockpit
- Click on HTML5 Applications and then click on New Application
- Enter “espmwebshop” as the application name. (You can provide any other name also)
- Click Create.
- Click on “espmwebshop”.
- Your application is now created and ready for use.
Clone Git Repository in Eclipse
- Once you have completed the above steps click on the Development tab in the left pane.
- Under “Source Location” copy the Git Repository Link
- It should be something like https://git.hanatrial.ondemand.com/<pNumber>trial/espmwebshop
- Start Eclipse and switch to the Git Perspective.
- Under Git Repositories, click on “Clone a Git Repository”.
- Paste the Git-URL you’ve copied in step b above into the URI field of the popped-up window, enter your user name and password of your SAP HANA Cloud Platform trial account into the fields User and Password, click on Next, click on Next again and click on Finish.
- Check your connection settings, (proxy in Eclipse) ifany of the above steps fail.
- You should now have an empty repository configured in your Eclipse.
Copy and upload code to repository
- Once you have completed the steps above, right click on the Git repository and select the Import Projects command.
- Select Import as general project, click on Next (note the name of the project) and after that click on Finish.
- Switch to the Web perspective in Eclipse.
- Copy all the files and folders inside the webshop-ui folder from this branch.
- Right-click the project you just created and select Paste .
- Now you have copied all the UI code into your project.
- To upload the code to the Git repository right-click your project.
- Select Team -> Commit.
- Write a short Commit message.
- Select all files (Select-all button is on the right hand side of the “Files” panel)
- Click “Commit and Push”.
- Provide your credentials if prompted.
- You should get a success message with the git repository link.
Version your code and Activate application URL for public access
- Navigate to the cockpit in your trial account, or copy paste this URL into your browser https://account.hanatrial.ondemand.com/cockpit
- Click on HTML5 Applications.
- Click on “espmwebshop” and select Development.
- You should be able to see the commit message you entered above.
- You should also be able to see your destinations under “Required Destinations”.
- The status of the destinations should be green, indicating they are present in the account.
- Click on the commit message and the Webshop application should open up in a new tab.
- In the list of Available Commits select the commit message and click on the “Create Version” icon at the right end of the line.
- Provide a version name 1.0 and click on Add.
- Now switch to the Version Management tab.
- You should see the version you’ve just created before.
- Now click on the icon at the right end of the line to Activate this application version.
- You will get a message telling you that the version has been activated and that the Changes will be effective after (re)-start of the application.
- Confirm the question if you really want to do this with by clicking on Yes.
- Switch to the HTML5 Application Dashboard tab and click on the Application URL.
- This is the URL which others can now use to access your app.
With these simple steps you should have a running application which accesses data from the ESPM cloud backend.
Ankur
COOL!!
Thanks for this great blog post Ankur. Will try it out, too.
Best,
Rui
Hi Ankur,
Thanks for a nice blog ............
Thanks & Regards
Dibyajyoti Nanda
very nice Ankur, thanks !!
Looks pretty cool... will have to give it a try these days!
Thanks for sharing with us Ankur.
Very cool shopping cart! Can you please address the costs of running a shopping cart (similar to your ESPM webshop scenario) in a Hana Cloud production environment ?
Regards
Ankur,
Was able to follow and complete without any issues. Good one. Thanks for posting this blog.
Thanks,
Dheeram
very nice Ankur, thanks !!!
For example if this real shop and man want buy something he go to domain "shop.com" this domain redirects to our URL but buyer have not account.
If man have not in trial account on SAP HANA Cloud Platform can he run this site?
Best regards
Hi Oleksii,
running an app or site on HANA Cloud Platform requires to have an account - but not accessing the app or site. So in your example, the provider of the shop will run the shop in his HANA Cloud Platform account but the users of the shop do not need such account.
Is this answering your question?
Best,
Thomas.
Thanks Thomas.
Do you mean provider it is hosting provider?
Best,
Oleksii
Hi Oleksii,
provider in this case means the application provider, so the one who runs the application in his account.
Regards,
Martin
Thanks Ankur for the nice blog. In the meantime you can reference sapui5 resources as service instead of accessing it via an external URL. Just replace your boostrap URL to
src="/resources/sap-ui-core.js"
and add the following route to your neo-app.json:
{
"path": "/resources",
"target": {
"type": "service",
"name": "sapui5",
"entryPath": "/resources"
},
"description": "SAPUI5 Library"
}
Great post, Ankur.
I have got "not authorized" error when I attempted to clone from git repository so I believe it is not a proxy issue. Do I need an extra permission? Any settings on my hanatrial account or eclipse I could check and verify?
BR,
Chapman
Hi Chapman,
I think you only need to verify the URI, confirm whether using https and also your SCN password, I would recommend opening the cloud cockpit in an Incognito(Private) window and cancelling the single sign on popup and entering your password manually to confirm it.
regards,
Ankur