This is the continuation of the blog presented here.

This blog has been split in 3 parts:

Link Content
Part1 Creating a new application with SAP Web IDE – Adding a new ObjectAttribute to the Detail view
Part2 Running the application with mock data – Creating run configurations
Part3 Deploying the app to HANA Cloud Platform – Deploying the app to SAP Fiori Launchpad (optional)

In this second part we are going to see how to run the application with mock data and how to create run configurations.

1.2 RUN THE APPLICATION WITH MOCK DATA

For this part of the exercise, you will use the Mock Data Server to run the application with mock data. Since we used the new SAPUI5 template for creating our project, there is a new mechanism here for displaying mock data. Now the mock data server is included in the application itself and in order to invoke it you just need to start the app with a different link. Let’s see this in detail.

1. Select the test.html file in the application and click on the Run button on the top toolbar. This will show you another page: on this page, instead of running the application as a standard application in the Fiori Launchpad, we’ll run it as assisted by the mock data service by running it through the second option “test/testFLPService.html

/wp-content/uploads/2015/07/01_826227.jpg

2. The application is executed with some on the fly randomly generated data. The Mock Data Server takes the metadata.xml file in the localService folder and generates the random data for you

/wp-content/uploads/2015/07/02_826238.jpg

3. Open the localService folder and right click on the metadata.xml file. Select Edit Mock Data

/wp-content/uploads/2015/07/03_826239.jpg

4. Select the SalesOrderSet entity set, since that is one of the collections used by our application, and click on the Generate Random Data button. You will get some random data according with their field types.


/wp-content/uploads/2015/07/04_826240.jpg

5. Do the same for the SalesOrderLineItemSet and click on OK to close this window


6. If you look now in your localService folder you will find two new files named SalesOrderSet.json and SalesOrderLineItemSet.json. These two files are containing the random generated data in the JSON format. Just double click on one of these files to show its content

/wp-content/uploads/2015/07/05_826248.jpg

7. Reopen the mock data generator as described at step 3 and change one of the records (i.e. the 4th record). You can change for example the CustomerName and set it equal to Acme and the GrossAmount equal to 2000. Make sure that the “Use the data above as my mock data source” flag is selected and click on OK

/wp-content/uploads/2015/07/06_826260.jpg

8. Create a new subfolder named “mockdata” under the localService folder and move the two JSON files there

/wp-content/uploads/2015/07/06b_826278.jpg

9.Run the application again with mock data and you will see the changes in the SAP Web IDE preview. Close the preview when finished

/wp-content/uploads/2015/07/07_826289.jpg

1.3 CREATING RUN CONFIGURATIONS

For this part of the exercise, you will be creating a run configurations in order to execute your app under some specific constraints.

1. Right click on the name of the project and choose  Run –> New Configuration…

/wp-content/uploads/2015/07/08_826290.jpg

2. Select the Web Application branch, don’t care about other existing run configurations  and click on the button New Run Configuration

/wp-content/uploads/2015/07/09_826291.jpg

3. Enter a name (i.e. “RunWithFrame”), specify the application file path which in our case points to the “/webapp/test.html” file, select the “Open with frame” option, save the file and click on the Run now button to test this new run configuration

/wp-content/uploads/2015/07/10_826295.jpg

4. The application is executed according to your settings, so in this case it’s displayed within the SAP Web IDE Preview frame

/wp-content/uploads/2015/07/11_826296.jpg

5. Now, no matter where your cursor is located inside the project explorer, if you open the Run menu, you can always run your application with the specified settings

/wp-content/uploads/2015/07/12_826297.jpg

Let’s continue with the final part of this exercise!

To report this post you need to login first.

Be the first to leave a comment

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

Leave a Reply