Firstly, before you start reading this blog post I would like to recommend you to read the previous blog post ( part 1 ) of this series :
In my previous blog post, I have demonstrated how to create a basic UI5 app using Visual Studio Code.
In this blog post, I would like to demonstrate how to develop UI5 apps using Visual Studio Code that consume OData services from an on-premise SAP System.
Visual Studio Code allows us to develop Ui5 apps using Data Services from various sources like :
- Connect to SAP System
- Connect to Odata Service
- Connect to SAP API Hub
- Upload a Metadata Document
In this blog post, we will look at Option 1 – Connect to SAP System and use Odata Services from it.
Steps are the same until before the Definition of Data Services mentioned in part 1 of this series.
- Start Application Generator
- Writing our code for the app
- Running the app
Open Application Generator ( Ctrl + Shift + P -> Fiori Tools : Open Application Generator )
Select SAP Fiori freestyle SAPUI5 application and click Start.
1. Start Application Generator
Select SAPUI5 application and click Next.
Data Source and Service Selection
Enter below details
Data source : Connect to an SAP System
System : New System
System type : ABAP On Premise
System URL : http://<system host>:<port number>
Enter SAP Client, Service username and password
Please check below screenshot.
After entering the above details click on Login icon ( circled in yellow ) below.
The System prompts to choose the desired OData Service.
Under option service : Press dropdown and type in the first few letters of your service. System will recommend the service name. Select Service and click Next.
Give a suitable View name. Click Next.
Enter Project details. Click Finish.
Below system message will be displayed. Please wait for few minutes.
Below system message will be displayed.
If you wish to open your project in a new workspace, press the blue button or by default the project will be created in current workspace.
Project is created under Project Explorer.
2. Writing our code for the app
Open the view file under webapp and write your desired code.
For this demo, I will create a basic Table control to display the data from OData service in tabular format.
3. Running our app
Save your App and click on Run button on the left.
Click on the dropdown and select your application from the list.
You may see multiple entries for the same app name. This is because they are all different run configurations for the same app.
Choose default run configuration : App_name ( App_name )
if App_name is the name of my app
Press the green button next to it.
You can see app run instructions getting executed in the Terminal Screen below.
The app opens up in default browser.
By this, we have learned how we can develop a simple UI5 app in Visual Studio Code that consumes Odata services from an on-premise SAP System.
Thank you for reading my blog post.
Please share your valuable feedback.