Skip to Content

In this blog post we will show how you can migrate ui5 app that was developed in Eclipse into Web IDE.

Web IDE is the recommended tool for developing/extending/deploying UI5 apps either to the cloud or to your on-premise network. More details about WebIDE can be found here: Getting Started with SAP Web IDE

Prerequisites

Let’s get started!

The app that we will migrated is a very simple one. This app will contain only one table elements which display data from ES4 backend system. The service that we will use is GWDEMO http://sapes4.sapdevcenter.com/sap/opu/odata/IWBEP/gwdemo and our app will output the list of sales order items which are exists under the SalesOrderCollection.

/wp-content/uploads/2016/05/2016_05_23_10_44_03_958593.png

Eclipse project structure vs. WebIDE project structure

Our eclipse project structure looks like the following:

/wp-content/uploads/2016/05/2_958594.png

While the structure for the same project in Web IDE will look like the following:

/wp-content/uploads/2016/05/3_958676.png

From the images above we can immediately see the differences. A new project in eclipse contains very basic files of view, controller and index.html while a new project in WebIDE contains more artifacts which are relevant like Component.js, manifest.json etc.

It is possible to create the same structure in eclipse but it will require some effort, something that WebIDE can give us for “free”.

Note! UI5 project structure is influence by the UI5 runtime version. The project structure that we see above is the project structure for the latest and greatest version of UI5.

In this blog we will show how you can import an app that was developed in eclipse to WebIDE and run it without changing the project structure.

Export from eclipse and import to WebIDE

In eclipse

  • Select the WebContent folder under the root folder
  • Right click > Export

    /wp-content/uploads/2016/05/4_958677.png

  • In the dialog select Archive File and click Next
  • Uncheck the WebContent folder, expand it and select only the mylasteclipseui5app folder and index.html file which appear on the right side. Also make sure that Save in zip format is selected.
  • Specify under To archive file the path where the zip file will be saved. Make sure that the name of the zip file is MyLastEclipseUI5App.zip (relevant for this blog post)

    /wp-content/uploads/2016/05/5_958712.png

  • Click on Finish

In Web IDE

  • Right click on Workspace folder > Import > From File System
  • In the dialog browse for the file MyLastEclipseUI5App.zip (the one that was exported from eclipse) and make sure that Extract archive option is checked then click on OK

    /wp-content/uploads/2016/05/7_958713.png

  • A new folder with the name MyLastEclipseUI5App will be created under your workspace
  • Expand the root folder of the project until you see the index.html file

    /wp-content/uploads/2016/05/8_958714.png

  • Next we will cut all the content (files and folders) which exist under the WebContent folder and then paste it under the project root folder

    /wp-content/uploads/2016/05/9_958736.png

    /wp-content/uploads/2016/05/10_958737.png

  • Then delete all the unnecessary folders under the root folder (make sure that you delete the MyLastEclipseUI5App folder which exist under the root folder and not the root folder itself)

    /wp-content/uploads/2016/05/11_958738.png

  • At the end our app structure in WebIDE should look like the following:

    /wp-content/uploads/2016/05/12_958742.png

Add WebIDE artifacts

    • First we will need to create cloud connectivity configuration file in our project. this file will allow HCP front-end server to run our app with all the necessary resources (ui5 resources, our oData service etc.)
  • To  create the cloud connectivity configuration files, go trough the following steps:
    • Select the root folder
    • Right click > New > Cloud Connectivity Configuration

      /wp-content/uploads/2016/05/13_958743.png

    • A new file with the name neo-app.json will be created under our project root folder
  • Next we will need to create a destination in HCP cockpit that will point to ES4 system. We will not explain how to create a new destination here but we will show how you can import a new one to your HCP cockpit. To import a new destination into your HCP cockpit, go trough the following steps:
    • Download the ES4 file which attached to this blog post
    • Open your HCP cockpit by clicking on the following link: Cloud Cockpit
    • Select Destinations and then click on Import Destination button
    • Select the destination file that you download and then click on the Save button at the bottom of the page to save it

      /wp-content/uploads/2016/05/15_958744.png

  • Next we will need to add the destination to our cloud connectivity configuration file. To do so please go trough the following steps:
    • Double click on neo-app.json file to open it in the text editor
    • Add the following objects under the routes array

      /wp-content/uploads/2016/05/16_958772.png

    • The full neo-app.json file structure is attached to this blog post so please feel free to download it and compare it with yours.

Modify and run the app

The last thing that left now is to do some minor modification to our controller in order to run it on HCP. To do so please go trough the following steps:

  • Double click on SalesOrders.controller.js file to open it in the text editor
  • Go to the row where you initiate a new oDataModel object
  • replace proxy/sap/opu/odata/IWBEP/gwdemo/ with /sap/opu/odata/IWBEP/gwdemo (just remove the proxy at the beginning)
  • Change user and password parameters to your user and password

    /wp-content/uploads/2016/05/17_958773.png

  • Save the file
  • Select the index.html file and click on the Run button (at the top) to run the app

    /wp-content/uploads/2016/05/18_958774.png

  • If everything went well, you should see the same app but this time runs on HCP. From here you can deploy your app either to on-premise or to the cloud, use WYSIWYG to build your UI using a simple and intuitive drag and drop editor, write your code with WebIDE code editor which provide fast auto complete and syntax validation for both JavaScript and XML files, use GIT as your source control and more… and more…


That’s it 🙂

To report this post you need to login first.

9 Comments

You must be Logged on to comment or reply to a post.

  1. Harry Fumey

    Nice post. Thank you.

    We developed without GW and using js views. To fully use WebIDE we would need XML views.


    Would you have a suggestion how to migrate form js views to XML views?



    (0) 
    1. Ran Hassid Post author

      Hi,

      By migrating your views to XML’s will allow you to edit your views via Web IDE layout editor (WYSIWYG) and also from my POV it is much more easy to understand views in XML than in JS because in XML you have hierarchy so you know exactly where each control needs to be located and in JS it’s very hard to understand it. If we look on other technologies like Android, IOS both are using XML’s for creating the view (Yes.. iOS are using XML’s behind the scenes 🙂 )

      (0) 
  2. Gowthami Bhogireddy

    Hello Ran

    Could you please suggest a workaround for the inverse scenario as well. When I import a WEB IDE application directly into Eclipse, I am unable to run the application in Eclipse because of the differences in project structures.

    Does this have any easy solution? or do I have to manually copy the files from WEB IDE to Eclipse?

    Please suggest.

    (1) 

Leave a Reply