Skip to Content
Author's profile photo Jerry Wang

An example of how to investigate OData usage in UI5 application

Suppose I need to investigate how the entities of Initiatives displayed in the table control below is accessed via OData in UI5 application Customer Engagement Initiative (CEI):

/wp-content/uploads/2014/07/clipboard1_510010.png

Requirement1: find out the OData Access URL for Initiatives in table control.

Launch the CEI application via Chrome, click F12 to open development tool, go to tab Network, switch on Record mode by clicking button “Record Network Log”.

/wp-content/uploads/2014/07/clipboard2_510017.png

Then click the INITIATIVES work center and display the table control as usual. The record icon turns red which indicates currently the network traffic is recorded. You should observe lots of traffic logged as below.

/wp-content/uploads/2014/07/clipboard3_510018.png

Click filter button, and filter by “XHR” ( Xml Http Request), then check starting from the bottom-most, and soon you find the OData access url for initiatives:

/wp-content/uploads/2014/07/clipboard4_510019.png

So this url “https://<hostname>:44300/sap/opu/odata/sap/CUAN_COMMON_SRV/Initiatives?$skip=0&$top=110&$inlinecount=allpages” is just what we are looking for. Write it down for later usage.

Click Preview tab, and you can check the initiative instance contained in Odata response, to compare each field with UI ( for example, ID, Creator, CreatedOnDate, EndDate etc ).
/wp-content/uploads/2014/07/clipboard5_510020.png

The CreatedOn and EndDate store the Unix time-stamp since 1970, you can easily convert it via the link below, the converted time is now exactly the same as what you see in UI.

http://www.unixtimestamp.com/index.php

/wp-content/uploads/2014/07/clipboard6_510022.png

Requirement2: find out which application view has consumed this OData url to access Initiatives data from ABAP backend

Go to Chrome development tool, expand tab “XHR Breakpoints”, choose “Add breakpoint” from context menu, and type the url part we find in step1: /sap/opu/odata/sap/CUAN_COMMON_SRV/Initiatives?$skip=0&$top=110&$inlinecount=allpages.

/wp-content/uploads/2014/07/clipboard7_510024.png

And click Initiative work center, then the breakpoint is triggered. Type “o” in Watch Expressions and we can observe the OData access request is set via line 332 below with the very url we find in step1.

Now we need to find out which view has consumed this OData service. Expand tab “Call Stack”:

/wp-content/uploads/2014/07/clipboard8_510025.png

From the call-stack it is very clear the table which displays the initiative data is being rendered. We focus on call-stack highlighted below, the variable c[i] contains the information of table view. Type “c[i]” in Watch Expressions tab and expand it:

/wp-content/uploads/2014/07/clipboard9_510026.png

Here we could find view name and thus could identify the application view in the right hierarchy, and then find how the OData model is bound to the table control in CUAN_INI_OW_WSI.view.js and how the OData model is initialized in controller CUAN_INI_OW_WSI.controller.js.

/wp-content/uploads/2014/07/clipboard10_510027.png

Assigned Tags

      Be the first to leave a comment
      You must be Logged on to comment or reply to a post.